Repository navigation
Merge guard: read the required checks' buckets, not gh pr checks' exit code (a cancelled required check exits 0) - #494
Merged
seathatflowsinourveins merged 2 commits intoSep 29, 2026
Conversation
…t code `gh pr checks --required` exits 0 for a cancelled required check (gh v2.101.0 checks.go L248-252: only failed and pending change the exit code; aggregate.go L72-88 sends CANCELLED to bucket cancel), and a failed check wins over a pending one. Measured on #437 after its macOS smoke run was cancelled. The documented guard printed the exit code as the verdict; it now prints the count and the set of buckets and merges only on `pass`. Adds a dated correction to the merge-guard mechanics entry, an anti-pattern log row and a structural test that fails on the previous text. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…t, branch files re-registered) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Collaborator
Author
|
Trading lane acknowledgement (
No objection. |
seathatflowsinourveins
deleted the
claude/merge-guard-buckets-20260929
branch
September 29, 2026 05:36
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.
Scope
docs/lanes.mddocumentedgh pr checks <N> --requiredas a pre-merge read whose exit code says whether every required check passed. That is wrong: a cancelled required check exits 0, and a failed check wins over a pending one. The guard now prints the required-check count and the set of buckets (--json name,bucket) and merges only onpasswith the ruleset's count. The decision record gets a dated correction, the anti-pattern log a row, and a structural test fails if the text drifts back.3ce6f532(main, after Token report: retain selected upstream usage, status and cache reports beside each tool's row #415), merged in by the hot-file protocol; heade845256a.lane:shared.docs/lanes.mdis a shared hot file, so the trading lane must acknowledge on this PR, at the head SHA it acknowledges, before merge (docs/lanes.mdL149-150). No trading path changes.docs/lanes.md(merge-guard block and its first bullet),docs/decisions/2026-09-22-github-automation-closure.md(correction after the "Merge-guard mechanics" entry),docs/harness-defaults.md(one anti-pattern row),tests/test_merge_guard_doc.py(new),manifests/evidence.json(re-registration, last commit).SOTA sources
pkg/cmd/pr/checks/checks.goL248-252:if counts.Failed > 0 { return cmdutil.SilentError } else if counts.Pending > 0 { return cmdutil.PendingError }, otherwise nil. L189-191: the JSON export returns before that logic, so--jsonexits 0 in every state. L70-75: the help names thebucketfield (pass,fail,pending,skipping,cancel) and "Additional exit codes: 8: Checks pending".pkg/cmd/pr/checks/aggregate.goL72-88:CANCELLEDbecomes bucketcanceland incrementscounts.Canceled, which the exit logic never reads;SKIPPEDandNEUTRALbecomeskipping.gh pr checksmanual: the--requiredand--jsonflags.Evidence-class table
gh pr checks --requiredexit 0validate-macosrun cancelled on purpose)rtk proxy gh pr checks 437 --required: sevenpassrows andvalidate-macos fail, exit 0;--json name,bucket:validate-macosbucketcancel;--jqline prints8 required checks, buckets: cancel,passpassonly when every required check passed8 required checks, buckets: pass; on #409, #417 and #492 whilevalidate-macoswas pending:8 required checks, buckets: pass,pending.github/main-ruleset.json; the test compares the documented count with ittests/test_merge_guard_doc.py: 3 tests fail against the previousdocs/lanes.md(red-first, 3 failures) and pass nowLocal commands run
Measured 2026-09-29 by the coordinator at head
e845256a; local integration checks, not upstream tests.Decision record
docs/decisions/2026-09-22-github-automation-closure.md, "Correction (2026-09-29, after the entry above)": it keeps the earlier measured entries (passing, failing and pending PRs gave exit 0, 1 and 8, which fits the source) and adds the cancelled case, the failed-beats-pending precedence, why no merge was wrongly allowed (GitHub's ruleset still refuses a cancelled required check), and the overturn condition (a newer gh that countscancelas failing or changes the--jsonexit code; re-readchecks.gowhen the pinned gh moves).Residuals
Checklist
🤖 Generated with Claude Code