Skip to content

feat(policy): make the review record refuse an author's own verdict - #116

Merged
androidand merged 1 commit into
devfrom
review-record-authenticity
Oct 13, 2026
Merged

androidand merged 1 commit into
devfrom
review-record-authenticity

Conversation

@androidand

Copy link
Copy Markdown
Owner

The gap

The review record shipped in #107 reads, validates and maps onto merge evidence. It enforces nothing: the record is a plain file in the author's working tree, and a model can write a file. An author could write its own LGTM naming any reviewer it liked, and #111 stayed inert because no caller passed the author.

What this adds

write stamps the reviewer from the caller's own session context — never from a model-supplied argument — so a model can record a verdict but cannot record one as somebody else. It validates against the reader's own closed schema before writing, so a record that would fail on read is refused at write time instead of becoming a review that silently never happened. Written atomically: a truncated file reads as corruption and loses a real verdict.

gate supplies the authorSessionID that mayMerge already knew how to compare, so a verdict whose reviewer is the author is refused. It delegates rather than reimplementing — one place knows what a merge requires. It also carries the record's base as the merge base, since mayMerge deliberately refuses without one ("an approval of an unrelated history is not an approval of anything").

Identity comes from ctx.sessionID, which is in-process and not parsed from a message, so this does not wait on callback confirmation — which is not merged.

What it does NOT do — task 1b.5, recorded not assumed

A record forged by shell, naming a real reviewer, is still accepted. The gate compares two ids; it cannot tell a real review from a fabricated one. Denying the path to models (1b.2) does not change this for bash. That test is pinned deliberately, so the limit stays visible. Only OS separation closes it, and nothing here claims it.

This is why the surrounding controls are bounded claims — human-granted, scoped, never-listed — rather than proof of authorship. Same conclusion as #112.

Verification

  • test/policy 166 pass / 8 skip / 0 fail; gate suite 9 pass.
  • Mutation-checked, each failing only the test that owns it: removing the author comparison, and removing the writer's validation.
  • Typecheck clean; openspec validate review-on-done passes; fork:verify 252/252 owned, 117/117 patched.

Still missing

The tool registration (1b.1 wiring) and the path fence (1b.2). Neither is in this PR; write() and gate() are the pieces they call.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

The reader shipped in abadec9 and enforces nothing: the record is a plain
file in the author's working tree, and a model can write a file. This adds the two
pieces that make it mean something, and is explicit about the piece it cannot fix.

write() stamps the reviewer from the caller's own session identity, never from a
model-supplied argument, so a model can record a verdict but cannot record one *as*
somebody else. It validates against the reader's own closed schema before writing —
a record rejected here would be rejected on read too, and the round trip would
look like a review that never happened rather than a refused write — and renames
into place so a reader never sees a truncated file.

gate() supplies the authorSessionID that mayMerge was already asking for but that
no caller passed, so #111 stops being inert. It carries the record's own base as
mergeBase, letting the driver apply its own unrelated-histories rule rather than
second-guessing it.

Does NOT close the hole, and this is pinned as a test rather than left in a
comment: a record forged by shell naming a real reviewer is still accepted. The
gate compares two ids; it cannot tell a real review from a fabricated one.
Deny the path to models is task 1b.2 and does not change this for bash. Only OS
separation would, and nothing here claims it. That is why the surrounding controls
are bounded claims rather than proof of authorship.

Identity comes from ctx.sessionID — in-process, not parsed from a message — so
this does not wait on callback confirmation, which is not merged.

Mutation-checked, each failing only the test that owns it: dropping the author
comparison, and having the writer skip validation. test/policy 166 pass / 8 skip /
0 fail, typecheck clean, fork:verify clean.
@androidand
androidand force-pushed the review-record-authenticity branch from de6eecf to 7a4a882 Compare October 4, 2026 17:10
@androidand
androidand merged commit 61d1a4e into dev Oct 13, 2026
2 of 7 checks passed
@androidand
androidand deleted the review-record-authenticity branch October 13, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant