Skip to content

Gate: tell whether a branch's work already landed on its base - #375

Merged
EdbertChan merged 1 commit into
mainfrom
plan/gate-a-pr-that-is-net-behind-its-base-is-superseded-not-salvageable
Sep 12, 2026
Merged

Gate: tell whether a branch's work already landed on its base#375
EdbertChan merged 1 commit into
mainfrom
plan/gate-a-pr-that-is-net-behind-its-base-is-superseded-not-salvageable

Conversation

@EdbertChan

@EdbertChan EdbertChan commented Sep 10, 2026

Copy link
Copy Markdown
Owner

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.py sorts 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} at scripts/check_branch_not_superseded.py:46, pinned by test_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

  • Does not close, comment on, or rebase any PR.
  • Not wired into a hook, CI, or any skill in this PR.
  • Its examples now use the PROMISED_CATCH / PROMISED_ALLOW / flags_exemplar shape 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 ... OK
  • python3 engine/skills/make-pr/scripts/preflight.py --base origin/main: declare Review Unit: engine-runtime, ok preflight passed
  • python3 -m unittest tests.test_check_docstrings_match_regexes: Ran 5 tests ... OK

Revert Plan

Revert Plan
  • Safe to revert? Yes. Nothing imports the script.
  • Revert command: git revert <merge-sha>
  • Post-revert steps: None, once the stacked land-stack PR is reverted first.
  • Data migration? No

🤖 Generated with Claude Code

https://claude.ai/code/session_01Gnua5cuAAF1ey1b7zRqJCC

@cursor

cursor Bot commented Sep 10, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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
@EdbertChan
EdbertChan force-pushed the plan/gate-a-pr-that-is-net-behind-its-base-is-superseded-not-salvageable branch from 6d708f4 to 181ccb1 Compare September 12, 2026 01:00
@cursor

cursor Bot commented Sep 12, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@EdbertChan EdbertChan changed the title Gate: a PR that is net-behind its base is superseded, not salvageable Gate: tell whether a branch's work already landed on its base Sep 12, 2026
@EdbertChan

Copy link
Copy Markdown
Owner Author

Invoker Mergify babysitting is paused: this is the current bottom PR in the stack, but it is missing the admin-bypass label. Please tag this PR with admin-bypass before babysitting can continue.

@mergify

mergify Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@EdbertChan
EdbertChan merged commit 74613df into main Sep 12, 2026
4 checks passed
EdbertChan added a commit that referenced this pull request Sep 12, 2026
* 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>
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