Files
archie/internal/infrastructure/postgres/migrations/0025_review_gate.sql
T
sam 2aa6a002dc feat(staterpc): carry the review gate and re-review rounds, with one guarded response write
The operator-approval gate needs its conversation with the operator
persisted before it waits and its answer threaded back
(docs/prds/pr-review-operator-response.md, Decision 2). review_gate is a
text column beside review_payload, encoded by the package that owns the
type; rereview_rounds is a bigint counted only by the new guarded write.

RespondReviewGate is the one write beside RetryTask/BeginRemediation: a
transition-table guard, one from-status check, an optional round
increment, and a requeue in one transaction. The re-review cap is
enforced in the row under the guard's lock, and a refusal leaves the
task waiting and the row untouched, surfaced as ErrRereviewCapReached
(added to the wire error table and the conformance battery). The column
joins the column-listing ListTaskSummaries projection and UpdateTask, so
the dashboard reads the offer and the store round-trips the count.
2026-10-02 02:27:59 +10:00

19 lines
1.0 KiB
SQL

-- +goose Up
-- The operator-approval gate's conversation with the operator
-- (docs/prds/pr-review-operator-response.md). review_gate is the JSON
-- document the gate writes before it waits -- the scored findings, the head
-- SHA, the pull request's identity and the workflow the wait resumes -- and
-- the answer the response path fills in. The text type mirrors review_payload,
-- its sibling column: the package that owns the type (internal/domain/
-- workflow/prreview) owns the encoding, so the store never parses it.
ALTER TABLE tasks ADD COLUMN review_gate text NOT NULL DEFAULT '';
-- rereview_rounds counts granted operator re-reviews, capped by the guarded
-- response write itself (prreview.MaxRereviewRounds). Deliberately separate
-- from retry_count and remediation_rounds: one shared counter made unrelated
-- retries draw another phase's budget down.
ALTER TABLE tasks ADD COLUMN rereview_rounds bigint NOT NULL DEFAULT 0;
-- +goose Down
ALTER TABLE tasks DROP COLUMN rereview_rounds;
ALTER TABLE tasks DROP COLUMN review_gate;