Repository navigation
ship accept: a lanes-only head policy gates the final tree; owner-granted test-lane exception (GST-1595) - #4061
Merged
capy-ai[bot] merged 4 commits intoNov 6, 2026
Conversation
…hidden JUnit suites; owner-granted test-lane exception (GST-1595) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
😎 This pull request was merged. |
Each excepted file is preflighted on its own and must run a counted test; the preflighted files count toward the lane's tests_ran; grants are kept per head and file set; lanesOnlyHeadPolicy compares .gstack/generated.json with the fork copy. Review-Finding: v1/outside-voice#1 reader=outside-voice Review-Finding: v1/outside-voice#2 reader=outside-voice Review-Finding: v1/outside-voice#3 reader=outside-voice Review-Finding: v1/adversarial-native#2 reader=adversarial-native Review-Finding: v1/adversarial-native#4 reader=adversarial-native Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
A --policy-from head run loads the regen registry from the branch (lib/pregate/context.ts), so a branch whose .gstack/generated.json differs from main's tip keeps the base policy; comparing with the fork copy would gate under a stale registry. Review-Finding: p2/red-team#1 reader=red-team Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…e exceptions (GST-1595) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
accept honors a lanes-only head policy.
gstack-ship-release accept(andfinishwhen it reruns the whole pregate on the stamped tree) now pass--policy-from headwhen the branch's.gstack/pregate.jsondiffers from the copy it forked from in nothing but added test lanes and.gstack/generated.jsonmatches the base tip's copy. It printsPOLICY: head (unreviewed) …. A removed or shrunk lane, any other changed key (warn,timeout_s,ship_lanes_from, …), or agenerated.jsonthat differs from main's keeps the base policy and printsPOLICY: base … (the branch's copy <what differs> …). Helper:lanesOnlyHeadPolicyinlib/pregate/head-policy.ts.accept and finish now gate the final tree under a branch policy that only adds test lanes, so a PR's own lane no longer fails with PREGATE_NO_LANE.
Before/after as text: accept and finish now gate the final tree under a branch policy that only adds test lanes, so a PR's own lane no longer fails with PREGATE_NO_LANE
inventory_uncovered names the bun import pattern. When a carried lane's inventory file is in no run's
tree.jsonand another inventory test file imports it, the refusal addsCARRY_DIAGNOSIS: bun registers <imported> under <importer>; its JUnit suite won't appear(importedTestLinesinlib/ci-carry.ts). The remote gate's REUSE refusal uses the same helper.Owner-granted test-lane exception.
gstack-approvals lane-exception --head <pushed head> --files <exact files> --reason … --words … --by …records an approved row on the same trust path as ruled notes (#4050). It's refused inside the open /ship run, for a gstack actor, and throughadd, and a row gstack wrote is ignored.gstack-evidence record-cibinds it only at HEAD, only for the exact uncovered set, and only after a localper_filepreflight of those files passes. The CI row and the receipt'sci_carried[].exceptionrecord it, accept printsTEST_LANE_EXCEPTION:, andgstack-ship-receipt write --bodyrefuses a body without theTest-lane exception: …line.Why
"accept refused my PR's own lane." GEVA-2 hit this on gstack-evals #240: the lane line passed preflight under
--policy-from head, then accept failed withPREGATE_NO_LANE, and an imported test file's JUnit suite never showed up in CI's tree with no way to record an exception. Now a branch that only adds lanes passes accept, the carry refusal names the import that hid the suite, and the owner can grant a bound exception for exactly those files.Tests
The test evidence is under Test Coverage and Test plan below.
Blast radius
The head-policy choice touches only the two pregate reruns in
lib/ship-release.ts(finish at :536, accept at :590), and it can only make the gate stricter, because any difference beyond added lanes, or agenerated.jsonthat differs from main's, keeps the base policy (read atlib/pregate/head-policy.ts:85-104, failing-first test intest/ship-accept-head-policy.test.ts). The exception path changes nothing unless an owner row exists for the exact head and file set, and CI run 42198346836 passed the full free suite at this tree.Approvals
Approved: yes (record r-b984cf13c625). The full approval record stays private: this repository is public or its visibility is unknown.
Summary
A PR that adds a runtime file and its own test lane was refused at accept because the final-tree pregate always used main's policy. accept and finish now use the branch's policy when it only adds lanes, carry refusals explain bun's imported-suite blind spot, and an owner can grant a narrow, head-bound test-lane exception that the receipt and PR body must disclose. The review rounds tightened the exception preflight, counted excepted files in
tests_ran, bound grants to head and file set, and restored the base-tipgenerated.jsoncomparison.Test Coverage
Step 7 ran audit-only (no test-writing approval in this unattended run); the gaps it left are listed under Review notes.
test/ship-accept-head-policy.test.ts: the fix: repair workflow YAML parsing and lint CI #240 shape passes; a removed lane, a loosened check, an added lane plus timeout, an added lane plus a carry-map change, and main changing.gstack/generated.jsonafter the fork all keep the base policy. The original cases fail on main 4b1a115; the generated.json case failed on b1f464a and passes at eb64e23.test/ship-accept-lane-exception.test.ts: the import diagnosis; a granted exception binds and lands in the receipt and body; a grant at another head, for another file set, or with a failing preflight refuses; a lane-written grant refuses.Tests ran: tests 1604
Pre-Landing Review
Full panel, two rounds plus one owner-granted fix-check. Round 1 (p1, red-team at 46c37ef): four informational notes. Voices (v1: outside voice openai/gpt-6.1-sol and the native adversarial reader): five fixes in b1f464a (v1/outside-voice#1-3, v1/adversarial-native#2 and #4) and four notes. Round 2 (p2 at b1f464a): one blocking finding, p2/red-team#1 (the generated.json comparison moved to the fork point, so a branch could inherit a registry main had since changed); fixed in eb64e23. Fix-check at eb64e23 (fx2): no blocking finding, one wording note. An earlier fix-check attempt (fx1) was voided because a reader fetched outside its packet (FETCH_VIOLATION); its replies were quarantined and the stage reran clean as fx2.
REVIEW_LOOP: passes=2 blocking_found=4 deferred=0 noted=9 fixed=6 scope=frozen ledgers_read=5 fix_checks=2 dispatches=4
Review-loop exception: accepted by GStack Minder (GSTA-36) 2026-11-06 via approval a-eb67474cef62: one scoped fix-check after round 2 for p2/red-team#1, the last exception for this PR (fix-check at eb64e23, 1 finding)
Gate edits: none detected (2 listed, 0 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)
Outside review: openai/gpt-6.1-sol ran in the voices pass; three findings, all fixed.
Review notes
Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.
lib/ship-release.ts:536finish's full-pregate rerun on the stamped tree now picks its policy with lanesOnlyHeadPolicy and may pass --policy-from head, but no test drives finish on that path. test/ship-accept-head-policy.test.ts covers accept only, so if finish drops or mis-passes the flag, no test fails.lib/ci-carry.ts:102Two refusal branches of the new exception path have no test: a matching grant on a lane with no per_file runner (inventory_uncovered with 'declares no per_file runner'), and a preflight that exits 0 but runs zero tests (exception_preflight_failed 'ran 0 tests' in bin/gstack-evidence). The only preflight test covers a non-zero exit.lib/pregate/index.ts:459The remote gate's clearByRuns refusal now appends importedTestLines diagnoses to its inventory_uncovered / tests_uncovered message, but no test checks the pregate refusal. The only diagnosis test goes through record-ci and accept.lib/pregate/index.ts:459The test-lane exception is honored only by gstack-evidence record-ci's findCarry. Pregate's own remote-gate carry (carryGate → clearByRuns) never consults it. In this repo, .gstack/pregate.json uses the exact same inventory command and profile (ci-reuse/free-tests, test-free-shards.ts --list) for both ship_lanes_from["bun run test"] and remote_gate_runs. So the file the owner excepted is still a required gate file. On a small machine (under SMALL_MACHINE_CORES = 8, which includes the 4-core Capy lanes), where the remote_gate obligation exists, clearByRuns refuses inventory_uncovered and the gate stays uncleared. The verdict is thenrequires-remote (1 uncleared), and accept stops atpregate … on the final treeafter the lane already carried under the grant. The bound grant can't finish accept in gstack itself, which is the main flow docs/pregate.md#carry-imported-tests presents it as the remedy for. Neither new test fixture configures remote_gate_runs, so this path is untested.lib/pregate/head-policy.ts:902.git merge-baseis never checked for failure (FIXABLE). InlanesOnlyHeadPolicy, ifmerge-basefails (a shallow clone or unrelated history),forkis empty andtrustedfalls back to the tip copy. If the base tip changed any other key since the fork, the branch's copy then reads as "also changes X" and keeps the base policy. This only causes false refusals and never loosens the gate.lib/test-lane-exception.ts:14. The grant trust model is advisory only (INVESTIGATE). The only guards are theopenShipRunmarker in this checkout,--bynot naming gstack, and the refusal throughadd. A lane can still record a grant before it dispatches /ship, from another worktree, or by appending a row to the approvals jsonl. It can also put any owner name in--by, and nothing checks--words. This is the same mbin/gstack-ship-receipt:2695. The new body enforcement disappears whenciCarriedfails (INVESTIGATE). Inbin/gstack-ship-receipt,ciCarriedreturnsundefinedon a timeout or bad JSON fromgstack-evidence carried. The receipt then has noci_carried, andlaneExceptionBodyLinesreturns nothing, so the new "body must carryTest-lane exception:" rule passes silently. Swallowing this error was already there, blib/test-lane-exception.ts:286. Grants can't be revoked, and NEXT quotes are escaped (FIXABLE).testLaneExceptionsskips rows that are not approved, so a later declined row never cancels an earlier grant, andlane-exceptioncan't write a non-approved row at all. The only way out is a new push, since grants are bound to a head. Separately, accept'sNEXT:line wraps the body line inJSON.stringify, so a reason contalib/pregate/head-policy.ts:103A lanes-only branch that never touched .gstack/generated.json, where main changed that file after the fork, now keeps the base policy. That is the intended fail-closed result. But accept and finish print the shared keep() line: "the branch's copy comes with a changed .gstack/generated.json ... land it on main first". That blames the branch and gives the wrong fix. The branch has nothing to land, and the real remedy is to bring main's generated.json onto the branch (the test case at test/ship-accept-head-policy.test.ts:64 reproduces this path and locks in the wording).Exploratory QA
Smoke probes of
gstack-approvals lane-exceptionin a fixture repo, all six green: a grant records at a real head; whitespace in--files,--by gstack,addwith a test_lane_exception scope, and an unknown head all refuse; the grant reads back with./stripped and files sorted. Not probed here: record-ci binding, accept and the head-policy rerun (covered by the focused suites), and the open-/ship-run refusal (test/ship-accept-lane-exception.test.ts:133).Design Review
No frontend files changed — design review skipped.
Eval Results
No prompt-related files changed — evals skipped.
Review bot comments
No review bot comments.
Issues
Refs p2/red-team#1
Refs v1/adversarial-native#2
Refs v1/adversarial-native#4
Refs v1/outside-voice#1
Refs v1/outside-voice#2
Refs v1/outside-voice#3
TODOS
No TODO items completed in this PR. The TODOS.md P2 item "finish fallback drops head-policy lanes" is partly addressed (finish now reruns under the head policy for lanes-only branches) and was left open for its owner to confirm.
Documentation
Status: updated. Four factual edits in
docs/troubleshooting.mdbring its result-code entries in line with GST-1595; no blockers.Scope. Base
4b1a1152844ato headeb64e2331e08oncapy/gst-1595-accept-head-policy-lane-exception: 3 commits, 19 committed files, and no staged, unstaged or new files. Changed public surface:gstack-approvals lane-exception; thePOLICY: head|baseline thatgstack-ship-release acceptandfinishprint;CARRY_DIAGNOSIS:; theexception_preflight_failedrefusal;TEST_LANE_EXCEPTION:and theTest-lane exception: …body line; and the optionalci_carried[].exceptionfield in the receipt. I checked the branch's own doc changes (docs/pregate.md#accept-head-policy,#carry-imported-tests,docs/ship-policy.md#test-lane-exceptions) against the code, and they are accurate. Banned-terms check: none (no list on main).Documentation Debt
Test-lane exception: …PR-body line: covered by reference docs (ship-policy.md, pregate.md, troubleshooting.md), but the how-to is missing.ship/sections/pr-body.md.tmpllists theRuled note:andMechanical retake:lines the receipt write requires and leaves this one out. Today only accept'sNEXT:line tells the agent to add it.CARRY_DIAGNOSIS:andexception_preflight_failed: reference only (pregate.md). Neither has a troubleshooting.md entry (how-to quadrant).gstack-approvals lane-exception: reference and how-to exist, with no tutorial. This is low priority for an owner-only command.ci_carried: [{ lane, run, attempt, tree }]shape at docs/pregate.md (Finish, push and accept) leaves out the optionalexceptionfield. The next paragraph documents it.Diagram drift: none. ARCHITECTURE.md has no diagrams that name the pregate, CI carry or ship-release entities.
docs/troubleshooting.mdis an authored doc with no generator entry, so nothing needs regenerating. If you want the pr-body gap filled,/document-generatecan do it, or you can make a parent-owned template edit.Test plan
🤖 Generated with Claude Code