admin-bypass-sweep (2) the merged tally comes from the trunk check - #497
Open
EdbertChan wants to merge 4 commits into
Open
admin-bypass-sweep (2) the merged tally comes from the trunk check#497EdbertChan wants to merge 4 commits into
EdbertChan wants to merge 4 commits into
Conversation
…p 6 compute its merged tally from the trunk ancestry check. Review claim: A sweep cannot report a PR as merged unless its merge commit is an ancestor of the trunk. Review lane: behavior Safety invariant: The merged tally cannot be computed from `gh pr view` state alone; a PR whose ancestry check does not return OK is reported unchecked, not merged. Effectiveness measurement: A fixture PR that closed against a stack branch rather than the trunk must be reported unchecked by the new Step 6 and merged by the old one, asserted in the skill's test directory. Slice rationale: One step of the sweep skill's reporting procedure; stacked behind the probe step because both edit the same SKILL.md. Architectural effect: Step 6 gains a dependency on the already-shipped verify_pr_landed_on_trunk.sh instead of relying on gh pr view alone. Goal: Rewrite Step 6 of product/skills/admin-bypass-sweep/SKILL.md so each PR's status line comes from engine/hooks/gh-write-verification/verify_pr_landed_on_trunk.sh and a non-OK result is reported as unchecked. Motivation: A 19-PR sweep reported 13 merged from gh pr view output alone. A Stop hook had to force the real ancestry check afterwards. All 13 did pass, but the claim went out before the check that proves it, and the same skill had already caused a manual replay of four PRs three days earlier. Alternative considerations: Adding a sentence telling the operator to also run the verifier was rejected: Step 6 already says to re-query every PR and not trust running tallies, and that prose did not produce an ancestry check. Leaving the hook as the only catch was rejected because it fires after the reply is drafted. Implementation details: Replace the `gh pr view --json number,state,mergedAt,title` loop in Step 6 with a loop calling verify_pr_landed_on_trunk.sh per PR, branching on its documented exit codes: engine/hooks/gh-write-verification/verify_pr_landed_on_trunk.sh lines 4-6 (EXIT_OK=0, EXIT_FAIL=1, EXIT_UNCHECKED=3). Report exit 0 as merged, exit 1 as merged-but-not-on-trunk, and exit 3 as unchecked. State in the prose that a merged count may not be reported from gh pr view alone. Add a fixture under the skill's tests directory asserting the new Step 6 text names the verifier and the three outcomes. Non-goals: Does not change the merge commands in Step 4, does not change Step 5's blocked-PR policy, does not modify the verifier script itself, and does not touch any other skill. Layer: domain Feature state: active Files: product/skills/admin-bypass-sweep/SKILL.md, product/skills/admin-bypass-sweep/tests/ Change types: - product/skills/admin-bypass-sweep/SKILL.md: docs-only - product/skills/admin-bypass-sweep/tests/fires_step6_names_verifier.md: create Acceptance criteria: - `python3 -m unittest discover -s product/skills/admin-bypass-sweep/tests -v` exits 0. - Step 6 names verify_pr_landed_on_trunk.sh and all three exit codes. - Step 6 no longer derives a merged count from `gh pr view` state alone. Solution: Make Step 6 compute its merged tally from the trunk ancestry check. Review claim: A sweep cannot report a PR as merged unless its merge commit is an ancestor of the trunk. Review lane: behavior Safety invariant: The merged tally cannot be computed from `gh pr view` state alone; a PR whose ancestry check does not return OK is reported unchecked, not merged. Effectiveness measurement: A fixture PR that closed against a stack branch rather than the trunk must be reported unchecked by the new Step 6 and merged by the old one, asserted in the skill's test directory. Slice rationale: One step of the sweep skill's reporting procedure; stacked behind the probe step because both edit the same SKILL.md. Architectural effect: Step 6 gains a dependency on the already-shipped verify_pr_landed_on_trunk.sh instead of relying on gh pr view alone. Goal: Rewrite Step 6 of product/skills/admin-bypass-sweep/SKILL.md so each PR's status line comes from engine/hooks/gh-write-verification/verify_pr_landed_on_trunk.sh and a non-OK result is reported as unchecked. Motivation: A 19-PR sweep reported 13 merged from gh pr view output alone. A Stop hook had to force the real ancestry check afterwards. All 13 did pass, but the claim went out before the check that proves it, and the same skill had already caused a manual replay of four PRs three days earlier. Alternative considerations: Adding a sentence telling the operator to also run the verifier was rejected: Step 6 already says to re-query every PR and not trust running tallies, and that prose did not produce an ancestry check. Leaving the hook as the only catch was rejected because it fires after the reply is drafted. Implementation details: Replace the `gh pr view --json number,state,mergedAt,title` loop in Step 6 with a loop calling verify_pr_landed_on_trunk.sh per PR, branching on its documented exit codes: engine/hooks/gh-write-verification/verify_pr_landed_on_trunk.sh lines 4-6 (EXIT_OK=0, EXIT_FAIL=1, EXIT_UNCHECKED=3). Report exit 0 as merged, exit 1 as merged-but-not-on-trunk, and exit 3 as unchecked. State in the prose that a merged count may not be reported from gh pr view alone. Add a fixture under the skill's tests directory asserting the new Step 6 text names the verifier and the three outcomes. Non-goals: Does not change the merge commands in Step 4, does not change Step 5's blocked-PR policy, does not modify the verifier script itself, and does not touch any other skill. Layer: domain Feature state: active Files: product/skills/admin-bypass-sweep/SKILL.md, product/skills/admin-bypass-sweep/tests/ Change types: - product/skills/admin-bypass-sweep/SKILL.md: docs-only - product/skills/admin-bypass-sweep/tests/fires_step6_names_verifier.md: create Acceptance criteria: - `python3 -m unittest discover -s product/skills/admin-bypass-sweep/tests -v` exits 0. - Step 6 names verify_pr_landed_on_trunk.sh and all three exit codes. - Step 6 no longer derives a merged count from `gh pr view` state alone. Invoker-Finalize-Id: 616fd5ec-4b0c-4737-9ac1-85da4a7c9f4a
…erministic proof for the trunk-derived merged tally. Review claim: The sweep skill's fixtures assert Step 6 reports from the ancestry check. Review lane: proof Safety invariant: Proof-only; adds no product behavior. Effectiveness measurement: The suite fails if Step 6 stops naming the verifier or drops the unchecked outcome. Slice rationale: One proof slice for this step. Architectural effect: None; verification only. Goal: Prove the trunk-derived merged tally deterministically. Motivation: The defect is a reporting path, so the proof asserts the reporting text names its source. Alternative considerations: Manual verification was rejected as non-deterministic. Implementation details: Execute the command below as the terminal proof. Non-goals: No product edits here; proof only. Layer: app_regression Feature state: active Exit code: 0 Invoker-Finalize-Id: 931b523d-2572-41c1-8c3e-4f3e187d758f
… that no ephemeral inter-task handoff files remain. Review claim: The workflow leaves no scratch handoff artifacts behind. Review lane: cleanup Safety invariant: Read-only; never deletes files, alters the index, or commits caller work. Effectiveness measurement: The gate fails when a plans/invoker-handoff.* or lens-*.json file is still present after the leaf tasks complete. Slice rationale: One terminal hygiene gate for the workflow. Architectural effect: None; check only. Goal: Confirm no ephemeral handoff files survive the run. Motivation: Inter-task scratch files leak into diffs and read as part of the work. Alternative considerations: Deleting them automatically was rejected; the gate reports, it does not mutate. Implementation details: Run scripts/scrub-handoff-artifacts.sh without --apply. Non-goals: No deletion, no index changes, no commits. Layer: app_regression Feature state: active Exit code: 0 Invoker-Finalize-Id: 9d4fd2eb-452d-4846-91e9-4fe370c27a64
…a80cd87b9-03a12c6d — Terminal check that no ephemeral inter-task handoff files remain. Review claim: The workflow leaves no scratch handoff artifacts behind. Review lane: cleanup Safety invariant: Read-only; never deletes files, alters the index, or commits caller work. Effectiveness measurement: The gate fails when a plans/invoker-handoff.* or lens-*.json file is still present after the leaf tasks complete. Slice rationale: One terminal hygiene gate for the workflow. Architectural effect: None; check only. Goal: Confirm no ephemeral handoff files survive the run. Motivation: Inter-task scratch files leak into diffs and read as part of the work. Alternative considerations: Deleting them automatically was rejected; the gate reports, it does not mutate. Implementation details: Run scripts/scrub-handoff-artifacts.sh without --apply. Non-goals: No deletion, no index changes, no commits. Layer: app_regression Feature state: active
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_a5c20b67-3a80-477c-80a0-6aab4b5a84c4) |
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.
Summary
An administrative sweep checks whether pull requests truly reached the main branch before counting them as merged.
Previously, GitHub's merged label could count work that landed only on a stack branch.
Now each result comes from a trunk ancestry check, with separate outcomes for merged, misplaced, and unchecked work.
Review Claim
The sweep counts a pull request as merged only when its commit is present on the trunk.
Review Lane
behavior
Review Unit
product-skill
Safety Invariant
The merged tally cannot be computed from GitHub pull-request state alone; a pull request whose ancestry check is not successful is reported as unchecked, not merged.
Slice Rationale
This slice changes one reporting step and adds its focused contract test; merge commands, blocked-pull-request policy, and the verifier remain separate concerns.
Non-goals
Architecture
Before
graph TD A["GitHub pull-request state"] --> B["Step 6 merged tally"]After
graph TD A["Each pull request"] --> B["Trunk ancestry verifier"] B --> C["merged / merged-but-not-on-trunk / unchecked"] C --> D["Step 6 tally"]Test Plan
Test Plan
python3 engine/skills/make-pr/scripts/preflight.py --base origin/mainok preflight passedpython3 -m unittest discover -s product/skills/admin-bypass-sweep/tests -vRan 5 testsandOKpython3 scripts/check_skill_test_coverage.py --base origin/main --head HEADok skill test coveragepython3 scripts/check_skills_three_harnesses.pyok skills three-harness checkpython3 scripts/check_ecosystem_boundaries.pyok ecosystem boundariesbash scripts/scrub-handoff-artifacts.shscrub-handoff-artifacts-okRevert Plan
Revert Plan
git revert <merge-commit-sha>Note
Low Risk
Documentation and contract tests for post-sweep reporting only; merge steps and the verifier script are unchanged.
Overview
Step 6 no longer treats GitHub
MERGED/gh pr viewstate as proof a sweep PR reached trunk. It now runsverify_pr_landed_on_trunk.shfor each touched PR and classifies results by exit code: merged (0), merged-but-not-on-trunk (1), and unchecked (3); only exit 0 counts toward the merged tally.Final reporting adds merged-but-not-on-trunk and unchecked buckets (with PR numbers/titles), alongside merged and blocked.
A stack-branch landing fixture (PR #1789: GitHub merged but commit not on
origin/master) documents the regression this fixes, and unit tests assert Step 6 names the verifier, maps all exit codes, and forbids driving the merged count from PR state alone.Reviewed by Cursor Bugbot for commit 95362db. Bugbot is set up for automated code reviews on this repo. Configure here.