Repository navigation
v1.91.257.0 feat(pregate): clear --receipt accepts a remote_gate receipt from a stamp-only predecessor tree (gbrain gate-ahead) - #3486
Merged
Conversation
…tamp-only predecessor tree (gbrain gate-ahead) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
😎 This pull request was merged. |
…and base-branch refusals, one substitution type, docs) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ff-tree reconciliation), refuse an unreadable base policy, check the receipt before git work, bind verify to the receipt tree; docs audit corrections Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ict; skip itself on win32 like test/pregate-remote.test.ts Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…tamp-only Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ipt from a stamp-only predecessor tree (gbrain gate-ahead) (#3486) 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
gstack-pregate clear --remote pregate.json/remote_gate --receipt <file>now accepts a remote-gate receipt whose tree is a stamp-only predecessor of the tree pregate.json recorded, and records the substitution. Before, the receipt'sPREGATE_REMOTE: tree=…had to equal pregate.json's tree exactly, so a full gate that ran ahead of /ship's restamp (the "gate ahead of your turn" case gbrain's shipping rules allow) could never clear the small-machine obligation, and every gbrain PR paid a second full gate after /ship (gbrain #7621, #7674, #7681: 17–37 min, 64–128 vCPU each at a 512 quota).A remote-gate receipt from the stamp-only predecessor tree now clears
pregate.json/remote_gateand records the substitution; before, the same receipt on the same head was refused. Captured from the test fixture:beforeis the installed gstack v1.91.253.0 (main),afteris this branch.Before/after as text: A remote-gate receipt from the stamp-only predecessor tree now clears pregate.json/remote_gate and records the substitution; before, it was refused and gbrain paid a second full gate per PR
The rule is the tree receipt's rule, not a new one
lib/pregate/remote-receipt.ts(substituteStampOnlyTree) diffs the two trees and classifies every differing file withclassifyFilefromlib/tree-receipt.ts, under.gstack/ship-policy.jsononorigin/<base>(stamp_files,stamp_patternswith their{version}templates, and the built-in version-file, version-manifest, manifest-version, lockfile-root-version and changelog-heading forms, all throughstampOnlyHunks/rewriteStamps). There is no second stamp-path list and no looser rule: the test asserts the recordedfiles: [{ path, rule }]equalsgstack-tree-receipt --gated G --current H's file verdicts on the same pair, and that a stamp path with a non-stamp hunk ischangedin both. The tree receipt's gate rule holds too: a base policy whosestamp_sensitive_gatesnames the test lane (testsorremote_gate; gstack's own policy liststests) refuses the substitution, because that receipt never marks the test lane reusable across a stamp. So gstack itself never substitutes; gbrain, whose policy does not list its test lane, does.The diff is read with a fixed presentation (
--no-textconv --no-renames --ignore-submodules=none,a/b/prefixes) and reconciled againstgit diff-tree's path inventory, so a diff driver ordiff.*setting can neither hide nor rename a path. Both trees must be 40- or 64-hex object ids and objects in the repository (the gated commit fetched; the head tree is whatbin/gstack-wtreewrote). An unfetched gated tree, a symbolic tree, an unreadable, unfetched or invalid base policy, a pregate.json recorded with--baseagainst another branch thanorigin/HEAD's (the fix namesgit remote set-headwhenorigin/HEADis unset), or two trees at the same version for astamp_fileshunk are refused, never trusted. The receipt's own tests/failed checks run before any git work.clearDecisionwithout a repository root (library callers) keeps the exact tree-mismatch refusal as before.What is recorded
accepted-for=<head> stamp-only=<n>aftertests=(the ship receipt'srequires_remoterow carries it).substitution: { gated_tree, accepted_for, policy, files: [{ path, rule }] }(schema andPregateReceiptSubstitutiontype inlib/headless-artifacts.ts).clearprintsPREGATE_RECEIPT_SUBSTITUTED: …;verifyrepeats the substitution on its ok line; a substitution whoseaccepted_foris not pregate.json's tree, or whosegated_treeis not the receipt string'stree=, isPREGATE_REMOTE_UNCLEARED("clear again").Read-only files touched
lib/tree-receipt.ts: onlyexportadded toclassifyFile(no other change), so pregate imports the rule instead of restating it.lib/restamp.ts,scripts/pregate-remote-gate.sh,scripts/ubicloud/pregate-remote.shand what the remote gates print are untouched.Docs
docs/pregate.md#remote-gate-stamp-only: what is accepted and refused, that a consuming repo declares its stamp paths once in
.gstack/ship-policy.jsonon its base branch (the file the tree receipt and restamp already read; nothing new in.gstack/pregate.json), and the four-command sequence that reuses a gate-ahead run. ThePREGATE_RECEIPT_INVALIDandPREGATE_REMOTE_UNCLEAREDanchors in docs/troubleshooting.md explain every refusal line and the misapplied-substitution case.Why
GBrain Minder's ask, routed by GStack Minder as GSTA-117: gbrain's remote gate is bound to the exact tree, its rules let a head reuse a full gate whose tree differs only in release stamps, but /ship's Step 12 restamp always changes those files, so the gate-ahead path never satisfied
remote_gateand every gbrain PR ran the whole gate twice. The fix reuses gstack's existing stamp rule so the pregate verdict and the tree-receipt verdict can never disagree. After this lands, gbrain fetches the gated commit, runsgstack-pregate --allow-repo-commandson the stamped head, clears with the gate-ahead output, andverifypasses with the substitution on record.Approvals
Source: gstack-approvals record for gsta-117/pregate-remote-stamp-only (display only; not an approval citation).
Coordination
#3480 (GSTA-112, pregate ergonomics) rewrites parts of
lib/pregateand was still OPEN when this PR was opened; this branch is from main. The overlap islib/pregate/index.ts(verifyPregate's tail andclearDecision),lib/pregate/checks/lanes.ts(one addedexport),lib/headless-artifacts.ts(adjacent schema fields) andbin/gstack-pregate(adjacent lines incmdClear/HELP); none of #3480's hunks touch the lines this PR changes, so the train merge should be clean, and if not, #3480's structure wins. #3480 merged as v1.91.254.0 (main 568cd5a) and the train's scratch merge hit a real conflict inlib/headless-artifacts.ts, so under GStack Minder's rule 19 grant main is merged into this branch (b2b2be2): thePregateFileschema keeps #3480'scheckscause/environmentandscratchwith this PR'srequires_remote[].substitutionappended, and the CHANGELOG is additive (our entry stays under[Unreleased], VERSION at main's 1.91.254.0).Summary
lib/pregate/remote-receipt.ts(new),lib/pregate/index.ts(clearDecisiontakes the repo root;verifyPregatechecksaccepted_forandgated_tree),lib/pregate/checks/lanes.ts(exportstreeMismatch),bin/gstack-pregate(printsPREGATE_RECEIPT_SUBSTITUTED, HELP),lib/headless-artifacts.ts(schema).diff-treereconciliation, stamp-sensitive-lane and base-branch refusals, hex object-id guard, unreadable-policy refusal, receipt checks before git work.docs/pregate.md#remote-gate-stamp-only, two troubleshooting anchors,## [Unreleased]entry (VERSION, package.json and the digest stay at main's; the train stamps at the slot).Test Coverage
All new code paths have test coverage.
test/pregate-remote-stamp-only.test.ts(10 tests, 94 assertions): accept with the recorded substitution equal to the tree receipt's verdicts andverifyok; the unchanged same-tree path (no substitution); a same-tree re-clear dropping the substitution; refusals for a path outside the rule, a stamp path with a real change, an unfetched gated tree, an unreadable receipt file, zero tests, a failure, a symbolic tree, a head tree not in the object store, a mode-only difference, a stamp file at the wrong version, a pregate.json recorded against another base (with and withoutorigin/HEAD), an invalid base policy and a stamp-sensitive test lane;verifyon a misappliedaccepted_forand on a swappedgated_tree.Tests ran: tests 11813 pass, 0 fail (full free tier on one Ubicloud VM at the final tree 9fe256f13cc8, main 568cd5a merged in,
PREGATE_REMOTE: tree=9fe256f13cc8… tests=11839 failed=0 spent=0.05; the pre-merge trees e9c1872778de and 722d3f984f44 passed the same way, 11813/0 each).Tests ran: focused 630 pass, 0 fail across 32 files on the merged tree (pregate-, tree-receipt-, headless-artifacts, module-size-ratchet, changelog-*, troubleshooting-anchors, test-free-shards, ubicloud-pregate-remote); 290/0 across 26 files before the merge.
Tests ran: typecheck clean; typecheck:test ratchet 819 known, none new.
Local
bun run test:quickon the 4-core machine failed 15 tests in 13 browse/CSO-witness/gbrain-mcp/Chromium files for environment reasons (Playwright's chromium_headless_shell not installed; generated.agents/skills/*/SKILL.mdabsent). None reference pregate, tree-receipt or headless-artifacts, and the same files pass on the Ubicloud run above where setup is complete.Pre-Landing Review
Three passes (crew rule 23), all read-only, records persisted with
gstack-review-log --finish; each record'sreview_bindingischangedbecause the pass's findings were fixed in the tree while the next pass ran, sogstack-review-readreports them STALE/UNVERIFIED rather than verified. After the adversarial pass: the win32describe.skipIfon the test file (test-only), then the merge of main 568cd5a (v1.91.254.0, #3480) under GStack Minder's rule 19 grant, reviewed by one more delta pass (token 18f58ffe, no findings: the schema resolution keeps #3480'scause/environment/scratchand this PR'ssubstitution;clearDecisionnever reaches #3480's environment classifier; pregate.json and receipt paths are unmoved by the per-run scratch directory):lib/pregate/remote-receipt.ts:91:gate-reuse-bypass— a policy whosestamp_sensitive_gatesnames the test lane must refuse) fixed; 14 informational fixed; skipped as advisory:remote-receipt.ts:84:performance(no early exit on the first changed file),index.ts:205:integration-boundary, two simplification notes.--base mainfix text whenorigin/HEADis unset).diff-treereconciliation; existing-but-unreadable base policy loading as defaults; receipt checks ordered before git work;verifynot bindinggated_treeto the receipt. Deferred as advisory or pre-existing (listed below).Gate edits: 1 listed, 0 eligible, 0 read, 0 findings — 0 kept, 0 restored, 0 open (
GATE_SUMMARY … unmatched=9 candidate=8663c3d25fdc+722d3f984f44; the only listed path is the new test file).Outside review: GPT-6.1 adversarial pass ran (2 findings, both fixed); Codex CLI not installed on this machine, so no Codex verdict (missing coverage, not passed).
Deferred (advisory / pre-existing, not fixed here):
stamp_sensitive_gates(that is the tree receipt's rule and the lane brief: no stricter or looser rule); a repo with no policy at all substitutes under the built-in version-file/manifest/lockfile/changelog forms only.lib/tree-receipt.ts, read-only).lib/evidence-bundle.tslockfile normalizer strips the first"version"line only (pre-existing, read-only).lib/changelog-check.ts, pre-existing).--base release/xnever substitutes whileorigin/HEADismain(fails closed;clearhas no--base).verify's ok line are uncapped.clear --receipt; docs/pregate.md ~272 and ship/sections/pr-body.md.tmpl sayPREGATE_REMOTE_UNCLEAREDclears with a run URL, which theremote_gatelane refuses.Exploratory QA
Not run: no browser, API or worker surface changed. The CLI path is exercised end to end by the test file (
runBin) and the before/after capture above.Design Review
No frontend files changed — design review skipped.
Eval Results
No prompt-related files changed — evals skipped (no skill template or SKILL.md in the diff).
Scope Drift
Scope Check: CLEAN — every changed file is in the lane's owned set (lib/pregate/**, bin/gstack-pregate, docs/pregate.md remote-gate section, additive troubleshooting anchors, test/pregate-*.test.ts, CHANGELOG), plus the one
exportin lib/tree-receipt.ts named above.Issues
ISSUE_LINKS: none
Verification Results
Obligations: remote gate on the final tree PASS (11813/0); focused suites PASS; typecheck PASS; docs audit twice, corrections applied (see Documentation); macOS and Windows CI lanes dispatched on b2b2be2 (free-tests 40395518499 green, windows-free-tests 40395524180 green; on the pre-merge head 60ee688: 40383966238 and 40383971192, both green), both cleared into pregate.json;
gstack-pregate verify: ok for tree 9fe256f13cc8. The first Windows dispatch on 6c536a7 (40382437284) failed only in the new test file, which expects the Linux-host lanes verdict like test/pregate-remote.test.ts; the suite now skips itself on win32 (scripts/lib/windows-curation.ts is held by #3478, #3480 and #3484, so the curation entry is left for whoever owns that file).TODOS
No TODO items completed in this PR.
Documentation
Status: audited twice, read-only (
/document-releasespawned, attempt budget of two used); both audits returnedblockedonly because read-only mode barred the auditor from writing its corrections, and every correction is applied in this head by the parent. Named risk: the final wording edits (docs/pregate.md "tests and failed checks" sentence, thegated_treeclause, CHANGELOG Added/Tests bullets) were verified against the code by the parent, not by a third audit.Scope: base 8663c3d → head on
gsta-117/pregate-remote-stamp-only; docs/pregate.md (changed regions and neighbours, then in full), docs/troubleshooting.md (PREGATE_RECEIPT_INVALID,PREGATE_STALE,PREGATE_REMOTE_UNCLEARED), docs/ship-policy.md, CHANGELOG.md[Unreleased],bin/gstack-pregate --help, against lib/pregate/remote-receipt.ts, lib/pregate/index.ts, lib/pregate/checks/lanes.ts, lib/tree-receipt.tsclassifyFile, lib/ship-policy.ts, lib/result-codes.ts, lib/headless-artifacts.ts.gstack-banned-terms: none.Corrections applied: the clean-checkout paragraph now precedes the command-sequence lead-in;
version-manifestadded to the rule list; the receipt's exit status is not re-checked onclear --receipt(only--remotechecks exit 0), and the docs and CHANGELOG now say so;#pregate-receipt-invalidgained the stamp-sensitive-lane, other-base and unreadable/invalid-policy refusals;#pregate-remote-unclearedand the CHANGELOG name thegated_treecheck.Debt (not filled here): README, CLAUDE.md and docs/skills.md do not link docs/pregate.md (pre-existing); the pre-existing synopsis and run-URL wording listed under Deferred above. No diagram drift.
Test plan
gstack-pregate --stage tests --remote --spend-cap 2 --timeout 2700 --allow-repo-commands(Ubicloud standard-16, 300 s, $0.05):PREGATE_REMOTE: tree=9fe256f13cc8717580903edb0cea20acc9f79548 tests=11839 failed=0(and 11813/0 on each of the two pre-merge trees, $0.05 each)bun test --timeout 120000 test/pregate-*.test.ts test/tree-receipt-*.test.ts test/headless-artifacts*.test.ts test/module-size-ratchet.test.ts test/changelog-*.test.ts test/ubicloud-pregate-remote.test.ts: 290 pass, 0 failbun test --timeout 120000 test/troubleshooting-anchors.test.ts test/pregate-remote-stamp-only.test.ts test/changelog-merge-damage.test.ts: 254 pass, 0 failbun run typecheckclean;bun run typecheck:test819 known diagnostics, none newfree-tests.yml(40395518499) andwindows-free-tests.yml(40395524180) on b2b2be2, both greenbun test --timeout 120000 test/pregate-*.test.ts test/tree-receipt-*.test.ts test/headless-artifacts*.test.ts test/module-size-ratchet.test.ts test/changelog-*.test.ts test/troubleshooting-anchors.test.ts test/test-free-shards.test.ts test/ubicloud-pregate-remote.test.tson the merged tree: 630 pass, 0 failbun test --timeout 120000 test/pregate-remote-stamp-only.test.ts test/test-free-shards.test.ts: 87 pass, 0 fail🤖 Generated with Claude Code