Gate: tell whether a branch's work already landed on its base - #375
Conversation
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_6673530d-7f25-4bc8-8247-22d31eb69906) |
…y landed A branch behind its base still lists differing files, and that list does not say which side is newer. scripts/check_branch_not_superseded.py reads the direction and prints LIVE (exit 0), SUPERSEDED (exit 3) or UNCHECKED (exit 2). It only reads git state. Carved out of #375 onto current main. The exemplars move from GATE_EXEMPLARS/gate_check to the PROMISED_CATCH/PROMISED_ALLOW/ flags_exemplar contract that main's docstring meta-gate now requires. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gnua5cuAAF1ey1b7zRqJCC Change-Id: Id11ddf24d24facf8805295adfbe28d5687becdf5
6d708f4 to
181ccb1
Compare
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_48112938-e74a-44d4-a47c-88be5b32a5cb) |
|
Invoker Mergify babysitting is paused: this is the current bottom PR in the stack, but it is missing the |
|
Tick the box to add this pull request to the merge queue (same as
|
* gate: check_branch_not_superseded says whether a branch's work already landed A branch behind its base still lists differing files, and that list does not say which side is newer. scripts/check_branch_not_superseded.py reads the direction and prints LIVE (exit 0), SUPERSEDED (exit 3) or UNCHECKED (exit 2). It only reads git state. Carved out of #375 onto current main. The exemplars move from GATE_EXEMPLARS/gate_check to the PROMISED_CATCH/PROMISED_ALLOW/ flags_exemplar contract that main's docstring meta-gate now requires. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gnua5cuAAF1ey1b7zRqJCC Change-Id: Id11ddf24d24facf8805295adfbe28d5687becdf5 * land-stack: check a PR is not superseded before rebasing it Step 2 now runs scripts/check_branch_not_superseded.py before any rebase or conflict fix. LIVE goes on; SUPERSEDED closes the PR instead of rebasing it over newer work; UNCHECKED is fixed and rerun, never read as LIVE. The check sits inside step 2 rather than as a new step 3, so the step numbers the playbook-router fixture and tests/test_install.py pin stay put and this slice touches only product/skills/land-stack. Carved out of #375 and stacked on the gate it runs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gnua5cuAAF1ey1b7zRqJCC Change-Id: I91527ae753cc84fe92c8b03088b2cc06740f5ccf --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Summary
A new check tells you when a PR's work is already on main, so nobody rebases it and undoes newer work.
A branch that is behind main still lists changed files. That list does not say which side is newer.
The check reads which side is newer and prints LIVE, SUPERSEDED, or UNCHECKED.
Review Claim
scripts/check_branch_not_superseded.pysorts a branch or#<PR>into LIVE (exit 0), SUPERSEDED (exit 3), or UNCHECKED (exit 2), reading git state only.Review Lane
behavior
Review Unit
engine-runtime
Safety Invariant
The check only reads git state. It never rebases, closes, or edits a PR. A check that cannot run (bad ref, shallow clone, no shared history, git error) exits 2, never 0:
EXIT_CODES = {LIVE: 0, UNCHECKED: 2, SUPERSEDED: 3}atscripts/check_branch_not_superseded.py:46, pinned bytest_unchecked_never_shares_an_exit_code. Nothing calls it yet.Slice Rationale
The check is the thing land-stack will read, so it ships first and the land-stack step that runs it is the next PR, stacked on this one. The make-pr rule puts a reader and the thing it reads in two stacked PRs, producer first.
This branch no longer carries the older banned-action work, which already merged; its diff against main is these two files.
Non-goals
PROMISED_CATCH/PROMISED_ALLOW/flags_exemplarshape main's docstring test asks every gate for; no other gate changes.Test Plan
Test Plan
python3 -m unittest discover -s tests -p 'test_check_branch*':Ran 20 tests ... OKpython3 engine/skills/make-pr/scripts/preflight.py --base origin/main:declare Review Unit: engine-runtime,ok preflight passedpython3 -m unittest tests.test_check_docstrings_match_regexes:Ran 5 tests ... OKRevert Plan
Revert Plan
git revert <merge-sha>🤖 Generated with Claude Code
https://claude.ai/code/session_01Gnua5cuAAF1ey1b7zRqJCC