Files
archie/internal/infrastructure/postgres/migrations/0031_pending_reviews.sql
T
sam 43c4495c9b fix(postgres): queue a review that arrives during a remediation
A review reaction that landed while a remediate run owned the task failed the
pr_open guard, was acked and dropped, and the poll cursor advanced past it.
Runs against one task are serialised, so the unit is appended to
tasks.pending_reviews instead; the transition that returns the task to pr_open
promotes the oldest waiting review back to queued. A re-delivered unit is
absorbed by payload equality, never queued twice.
2026-10-05 14:58:14 +11:00

16 lines
666 B
SQL

-- tasks.pending_reviews holds the review units that arrive while a
-- remediation already owns the task. Remediation runs for one task are
-- serialised (docs/prds/pr-review-remediation.md decision 5), so a distinct
-- review is appended here instead of dropped, and the oldest is promoted into
-- review_payload when the run that owned the task returns it to pr_open.
-- review_payload stays the active unit and is written by the run's own
-- Update; only this column carries the ones waiting behind it.
-- +goose Up
ALTER TABLE tasks ADD COLUMN pending_reviews jsonb NOT NULL DEFAULT '[]'::jsonb;
-- +goose Down
ALTER TABLE tasks DROP COLUMN pending_reviews;