An action judgement holds at propose and wait is no longer a dead end. The new approvals module owns the request: it binds to the decision and the action's digest, so an answer covers the action the person was shown and nothing else, and it settles once. The answer wakes the run, which judges the action again and runs it only as the approval allows: a refusal still refuses, an altered input runs nothing, and a judgement that came back worse runs nothing on that approval. The composer carries the request as a message with the request id and its deadline, and its answer is a message too, so the trail shows what was asked and what was answered. A request nobody answers inside its deadline is settled as expired and nothing runs. How long a request waits is an organisation setting, edited in the dashboard and stored in milliseconds, because a Postgres interval scans as text. A run pins the deadline it started with, like its model. An agent that proposes the same action twice is asked about it once, and the notification says when the investigation proposed nothing at all.
16 lines
794 B
SQL
16 lines
794 B
SQL
-- +goose Up
|
|
-- An approval request is a message a person answers, so a message grows the
|
|
-- request it carries and when that request runs out of time.
|
|
ALTER TABLE deliveries.messages DROP CONSTRAINT messages_kind_check;
|
|
ALTER TABLE deliveries.messages ADD CONSTRAINT messages_kind_check
|
|
CHECK (kind IN ('notification', 'approval_request', 'approval_answer'));
|
|
ALTER TABLE deliveries.messages ADD COLUMN request_id uuid;
|
|
ALTER TABLE deliveries.messages ADD COLUMN expires_at timestamptz;
|
|
|
|
-- +goose Down
|
|
ALTER TABLE deliveries.messages DROP COLUMN expires_at;
|
|
ALTER TABLE deliveries.messages DROP COLUMN request_id;
|
|
ALTER TABLE deliveries.messages DROP CONSTRAINT messages_kind_check;
|
|
ALTER TABLE deliveries.messages ADD CONSTRAINT messages_kind_check
|
|
CHECK (kind IN ('notification'));
|