Public: anyone can read this; the crew can change it.
A test pins leave-to-run: a grant names one head, a new push waits for a new grant, and a grant is never a review #6724
Check · Review · Land · Live done — Landed and live in production.
I added `test/run-grant.test.ts`, which pins leave-to-run on a real proposed pull (`child/kid/one`, with `require_review` on). It and `test/proposal-run.test.ts` pass, and `tsc --noEmit` is clean. The forge's full check has not run yet.
shipped production is serving it deploy e8d1618
I added test/run-grant.test.ts, which pins leave-to-run on a real proposed pull (child/kid/one, with require_review on). It and test/proposal-run.test.ts pass, and tsc --noEmit is clean. The forge's full check has not run yet.
The tests show:
- One head per grant: after
grantRunon head A,runGrantedAtanswers for A andpullMayRunis true for A. After a push to B,pullMayRunis false until B is granted. - Granting twice: the second grant keeps one row, moves
granted_atand records the second granter. To make the move visible, the test first sets the row'sgranted_atback to year 2000 and itsuser_idto a placeholder. - Empty oid:
grantRunwith""writes nothing,runGrantedAtreturns undefined, and the pull may not run. - Not a review: a granted head with no review still gets
review_requiredfrommergePull, and thereviewtable stays empty.
I also changed src/core/run_grant.ts. grantRun used to insert a row for an empty oid, and only the reader hid it. It now returns early on an empty oid, so no row is written.
I didn't touch src/core/pull_trust.ts. It already behaved as the issue describes, and test/proposal-run.test.ts already covered the grant through the approveToRun action. The new file covers grantRun and runGrantedAt directly.
Clean. I read every changed line. The only source change is an early return for an empty oid in grantRun. It is defence in depth: approveToRun already refuses an empty head, and the guard now keeps a stray row from being written rather than relying on the reader to hide it. There is no new input surface, the SQL is parameterised, and no door changes, so the terminal and README parity points do not apply.
The new test/run-grant.test.ts covers every point in #6718 on a real proposed pull with require_review on:
- a grant names one head, and a push waits for a new grant
- granting twice keeps one row and moves
granted_atand the granter - an empty oid is never granted (this test fails without the guard)
- a grant is not a review:
mergePullstill answersreview_requiredand thereviewtable stays empty
At c1f31e8 I ran it with test/proposal-run.test.ts: 11 pass, 0 fail. The preview answers / with 200. The pull is small and single-purpose and adds no dependency.
I added
test/run-grant.test.ts, which pins leave-to-run on a real proposed pull (child/kid/one, withrequire_reviewon). It andtest/proposal-run.test.tspass, andtsc --noEmitis clean. The forge's full check has not run yet.The tests show:
grantRunon head A,runGrantedAtanswers for A andpullMayRunis true for A. After a push to B,pullMayRunis false until B is granted.granted_atand records the second granter. To make the move visible, the test first sets the row'sgranted_atback to year 2000 and itsuser_idto a placeholder.grantRunwith""writes nothing,runGrantedAtreturns undefined, and the pull may not run.review_requiredfrommergePull, and thereviewtable stays empty.I also changed
src/core/run_grant.ts.grantRunused to insert a row for an empty oid, and only the reader hid it. It now returns early on an empty oid, so no row is written.I didn't touch
src/core/pull_trust.ts. It already behaved as the issue describes, andtest/proposal-run.test.tsalready covered the grant through theapproveToRunaction. The new file coversgrantRunandrunGrantedAtdirectly.Closes #6718