Skip to content

Review custody for chg-dispatched reviews (US-47.5) - #1006

Merged
mkreyman merged 2 commits into
masterfrom
feature/us-47.5-review-custody
Oct 19, 2026
Merged

mkreyman merged 2 commits into
masterfrom
feature/us-47.5-review-custody

Conversation

@mkreyman

Copy link
Copy Markdown
Owner

US-47.5 (Epic 47): review custody for chg-dispatched reviews (PRD §6).

  • Who may review a chg-bound story (Loopctl.Changes.ReviewCustody, called from Progress): a key whose dispatch is a STRICT descendant of the source's chg_root_dispatch_id, resolved server-side. The root itself, any other key and a human operator get 409 chg_reviewer_required. One reviewer dispatch records one verdict, enforced by the unique index review_records_reviewer_dispatch_uidx.
  • Which revision: review_records.commit_sha (new, nullable) is required for a chg story and must be the envelope sha of an applied submitted event of the story's CURRENT binding, otherwise 422 commit_sha_not_bound. For a story not bound to chg it is ignored and not stored.
  • Existing gates first, unchanged: self_review_blocked, caller_lineage_required, unresolvable_dispatch_lineage and story_not_reported_done run before the new checks. The non-chg suites are unchanged and green.
  • chg keys never verify: a caller whose lineage root is a registered chg root (live or revoked source, judged on the minting lineage even when the key has expired) gets 409 chg_root_cannot_verify on verify, reject, verify-all, bulk verify and bulk reject, backfill, and bulk mark-complete. It gets 409 chg_root_review_only on claim, bulk claim and report.
  • No review, no verify: a landing whose landed revision has no review escalates merged -> escalated over the new control-only :review_missing edge, inside the landed event's transaction.
  • mcp-server 3.3.0: review_complete takes commit_sha, and the review/verify tool descriptions name the new refusals.
  • Fixed while here: review-complete answered 500 for caller_lineage_required, because the controller had no clause for it. It now gives the documented 409.

Defaults you may overrule (all recorded in PRD §9):

  1. Any intake source naming the root, live or revoked, makes it a chg root (ReviewCustody.chg_rooted?/2).
  2. Refusing claim and report (chg_root_review_only) goes beyond the ACs. Without it, an agent-role child of chg's root could claim a story and a sibling could review it, because siblings pass the lineage gate.
  3. The chg refusals record no custody violation and never trigger a halt.
  4. A landing judges the reviews that exist when landed applies. A later review does not undo the escalation; a human resolves it.
  5. review_complete keeps requiring reported_done, so the pilot's implementing session must report on chg submit. Added as AC-47.8.5.

Not in this PR: the verify-side check that the review names the LANDED revision is AC-47.6.1, in US-47.6. Until it lands, a chg story at merged with a review of an earlier revision is escalated by the stage mapping, but verify_story would still accept it.

review_complete on a chg-bound story is accepted only from a strict descendant of the
source's chg root (409 chg_reviewer_required), names a submitted revision of the current
binding (422 commit_sha_not_bound), and records one verdict per reviewer dispatch (unique
index). Keys rooted at a chg root are refused verify, reject, verify-all, bulk verify and
reject, backfill and mark-complete (409 chg_root_cannot_verify) and claim and report
(409 chg_root_review_only). A landing with no review of its landed revision escalates over
the new control-only :review_missing edge. Existing custody gates run first and unchanged.
mcp-server 3.3.0.
@mkreyman

Copy link
Copy Markdown
Owner Author

Review round 1 (code) counted at ed4eb4924f7f via Skill lean-review. The review-round counter's merge gate reads this marker on any machine.

… of its landing

- ReviewCustody.ensure_landed_review/3, on every path to verified (verify, verify-all, bulk
  verify, backfill, bulk mark-complete): 409 review_missing_escalated while the hold stands,
  409 chg_review_not_for_landed_revision unless a chg review names the newest landing's sha.
- A review_missing hold that cannot be written rolls the landing back (busy, or a counted
  500 chg redelivers) instead of committing the merge unflagged.
- verify-all checks the chg root once; bulk judges the caller through
  ReviewCustody.caller_lineage/2 like the single paths; one CustodyLineage helper replaces
  eight copies.
@mkreyman
mkreyman enabled auto-merge (squash) October 19, 2026 09:50
@mkreyman
mkreyman merged commit 9dce1c1 into master Oct 19, 2026
17 checks passed
@mkreyman
mkreyman deleted the feature/us-47.5-review-custody branch October 19, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant