feat(bin): allow evidenced pre-merge task teardown - #1401
Open
sbracewell64 wants to merge 4 commits into
Open
Conversation
…d preserved branch
Owner
|
Automated reminder: thanks for the PR! This branch currently has a merge conflict with the base branch. When you get a chance, please rebase onto (or merge) the latest base branch, resolve the conflict, and push. After that, checks will re-run and the PR will get looked at again. Noted for firstmate#1401 at |
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.
Intent
Implement the captain's 2026-07-31 cleanup ruling in bin/fm-teardown.sh. Permit cleanup of a completed PR-based task before merge only when the latest completion exactly names the canonically recorded GitHub PR, live GitHub evidence shows that same open non-draft PR has an all-passing completed check suite with zero failed, pending, or skipped/cancelled/expected buckets and is mergeable, the live head exactly matches the recorded PR head, and repository evidence proves local HEAD is contained in that PR head; preserve the local task branch on this path and print its branch/PR identity on successful cleanup, without adding retention metadata or a reaper. Treat absent, duplicated, stale, contradictory, or unavailable completion, check, mergeability, identity, or head evidence as a refusal. Continue refusing red, pending, skipped, or conflicted PRs, uncommitted work, genuinely unpublished commits, and every existing unlanded-work safety condition; merely pushed remote reachability is intentionally insufficient and GitHub outages refuse. Replace the obsolete generic 'land its PR' diagnosis with evidence-specific refusal. Reuse the authenticated configured-remote PR-head fetch path, pin GitHub test mocks to exact canonical arguments, centralize branch finalization, and ensure the preserve notice survives detach failure without broadening retention behavior. Add regression coverage for the allowed path and every refusal boundary, retain existing merged/content/local-only/lock/backend behavior, and run required lint and focused teardown suites.
What Changed
Risk Assessment
✅ Low: Captain, the fix commit resolves all prior findings and the full branch diff now conforms to the source-verifiable teardown safety criteria without introducing another material issue.
Testing
After session bootstrap and diff/coverage inspection, the focused teardown suite passed across the permitted pre-merge path and its refusal boundaries, and a separate CLI-level scenario demonstrated successful cleanup, exact branch/PR preservation notice, and an unchanged preserved ref; no UI artifact applies because this is a shell CLI policy change, and no source or transient working-tree artifacts remained.
Evidence: Focused teardown test suite
Evidence: Successful green, mergeable pre-merge teardown transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 5 issues found → auto-fixed ✅
bin/fm-teardown.sh:643- Intent requires “zero failed, pending, or skipped/cancelled/expected buckets” and explicitly says to continue refusing skipped PRs. This condition instead accepts skipped checks wheneverpassed + skipped == total; requireskipped == 0and update the regression that currently expects skipped checks to pass.bin/fm-teardown.sh:458- Intent requires repository proof that local HEAD is contained in the PR head and refusal of genuinely unpublished commits. The patch-ID fallback accepts a divergent local commit merely because its patch matches a PR commit, even though local HEAD is not an ancestor of the PR head; use strict ancestry for the pre-merge path.bin/fm-teardown.sh:562- Intent says duplicated completion evidence must refuse. Only the final non-empty status line is inspected, so two identical completion events—or an earlier contradictory completion followed by a valid one—still authorize cleanup. Count and validate completion records rather than accepting solely from the last line.bin/fm-teardown.sh:1476- Intent requires that the preserve notice survive detach failure. The notice is emitted only inside the successfulcheckout --detachbranch, so a detach failure silently omits the sole surviving branch/PR identity even though cleanup continues. Emit the preservation notice independently of detach success.bin/fm-teardown.sh:1491- Intent requires branch finalization to be centralized, but the Orca and non-Orca paths duplicate branch discovery, detach, preserve announcement, and deletion logic. Extract one finalization helper so both backends cannot drift—particularly around detach-failure handling.🔧 Fix: Enforce strict pre-merge teardown evidence
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
bin/fm-session-start.shInspectedgit diff f7d0d0a703a717880656709d7906615505b3f2c0..052d4ce166b73f6c1f2edb4a59097abaa5230ccfand the teardown test matrix.bash tests/fm-teardown.test.sh > /tmp/no-mistakes-evidence/01KYWDZ21C7BTCTPBSPAH5EF5Q/fm-teardown-focused-suite.log 2>&1Ran a hermetic end-to-endbin/fm-teardown.sh task-x1scenario using exact canonical GitHub mock arguments and captured live-PR fixtures, CLI output, exit status, and the surviving branch ref ingreen-mergeable-teardown-transcript.txt.Checkedgit status --shortand searched for transient build/cache directories after testing; the working tree remained clean.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.