Repository navigation
fix(bin): make fm-teardown's landed-work proof forge-agnostic - #891
mattwwatson wants to merge 2 commits into
Conversation
|
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#891 at |
fm-teardown.sh's landed-work test relied on GitHub-shaped refs/pull/* fetches, so on forges that do not publish those refs a landed branch could be misjudged. Add a third, forge-agnostic proof: patches_in_default walks the default branch by patch-id (bounded by FM_LANDED_PATCH_SCAN_LIMIT) so conflicted-advance cases are rescued on any forge, with revert-rollback safety so a landed-then-reverted change still refuses teardown. Accept Bitbucket /pull-requests/<n> URLs and skip refs/pull/* fetches on hosts that do not publish them.
e82c56b to
644d5d2
Compare
|
Hello — flagging a deliberate division of work so this does not become a collision. The maintainer placed an overlap-hold between this PR and my #3127, both of which touch Concretely, #3224's entire footprint in Nothing here is a request to change your PR, and nothing I have done adds a conflict to it. For completeness: Where the two genuinely overlap, your third proof covers a case mine cannot decide, so if this lands first I will carry it forward with attribution rather than replace it. No action needed from you — this is just so you are not surprised by a second PR in the same area. |
|
Speaking as Kun's firstmate: Reviewed HEAD Class: corrective (forge-agnostic landed-work proof + Bitbucket URL shape in teardown). Mergeable is CONFLICTING / DIRTY against current main. Last author push is 2026-08-17 (11 days); 14-day stale close does not apply yet. Firstmate comments do not reset that clock. Overlap hold: open #3127 still carries dest-aware teardown landed-work ( VISION.md per-rule:
Not otherwise auto-merge-ready (conflict + overlap), so I am not rebasing this for you. This is waiting on the author, not the captain: rebase onto current main and resolve the |
|
Closing this - it has drifted a long way behind main and no longer applies cleanly. I'm reworking Bitbucket support from scratch as a |
Intent
Upstream contribution from the mattwwatson/firstmate fork: make fm-teardown.sh's landed-work proof forge-agnostic by adding a default-branch patch-id proof (bounded, revert-safe), accepting Bitbucket /pull-requests/ PR URLs, and skipping GitHub-shaped refs/pull/* fetches on forges that do not publish them, so teardown refuses correctly on any forge. The new tests/fm-teardown.test.sh suite runs in the portable serial lane unless maintainers prefer shard placement; it passes isolated on the upstream base (42/42 locally).
What Changed
bin/fm-teardown.shgains a third, forge-agnostic landed-work proof:work_is_landednow falls through topatches_in_default, which checks that every unpushed commit is present by patch id in the up-to-date default branch and still rolls back out of that branch's current tree (via a throwaway index, walked newest-first), so squash-merged work on any forge is recognized while landed-then-reverted work still refuses. The default-branch scan is bounded by a newFM_LANDED_PATCH_SCAN_LIMITknob (default 1000; 0 or non-numeric means unbounded), documented indocs/configuration.md.pr_number_from_targetaccepts Bitbucket/pull-requests/<n>URLs, andensure_commit_objectskips therefs/pull/<n>/headfetch when origin is Bitbucket Cloud, which publishes no such refs (deny-list, so unrecognized hosts keep trying the fetch).tests/fm-teardown.test.shsuite (42 cases, runs in the portable-serial lane, verified 42/42 by the pipeline's Test stage with a negative control against the base commit) and pointsdocs/gitlab-merge-watch.mdat both content and patch-id fallback proofs.Risk Assessment
Testing
Ran the full 42-case fm-teardown suite isolated (all pass, exit 0) and confirmed its portable-serial lane placement; proved the new forge-agnostic cases fail on the upstream base script (so they test the fix, not vacuously pass); then demonstrated the end-user behavior with a CLI transcript of the real fm-teardown.sh on Bitbucket-shaped repos — allowing squash-merged work via the default-branch patch-id proof with no GitHub-shaped refs/pull fetches, and refusing both never-landed and landed-then-reverted work. No UI surface is involved (CLI-only change), so the transcript is the reviewer-visible artifact.
Evidence: Bitbucket end-to-end teardown CLI transcript (ALLOW + 2 REFUSE scenarios, fetch log)
Evidence: Demo script that builds the Bitbucket-shaped sandboxes and drives the real bin/fm-teardown.sh
Evidence: Base-commit negative control (new tests fail on old fm-teardown.sh)
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-teardown.sh:552- work_is_landed's fall-through path fetches the default branch twice: content_in_default and patches_in_default each call default_ref_up_to_date, which re-runsgit fetch origin +refs/heads/<name>:refs/remotes/origin/<name>. On every refusal and every patch-id rescue this doubles the network round-trip and adds a second transient-failure point. The comments state the proofs are deliberately independent and additive, and both failure modes are fail-safe (refuse), so this is a deliberate tradeoff worth acknowledging rather than an issue to fix; resolving the ref once in work_is_landed and passing it down would remove the duplicate fetch if it ever matters.✅ **Test** - passed
✅ No issues found.
bash tests/fm-teardown.test.shisolated on the branch — 42/42 ok, exit 0 (matches the intent's 42/42 claim)bin/fm-test-run.sh --list --lane portable-serial— confirms tests/fm-teardown.test.sh is selected by the portable-serial lane (pr-forge family)Negative control: checked out base-commitbin/fm-teardown.sh(4497181) under the new test suite — first forge-agnostic case fails (expected exit 0, got 1), suite exit 1; restored to f7ce2c4 and re-verified suite exit 0Manual end-to-end demo (bitbucket-teardown-demo.sh) driving the realbin/fm-teardown.shagainst Bitbucket-shaped sandboxes: squash-merged+conflicting-advance → ALLOW (exit 0) via default-branch patch-id proof; never-landed → REFUSED (exit 1, worktree preserved); landed-then-reverted → REFUSED (exit 1, worktree preserved); fetch log shows no refs/pull/* fetch on a bitbucket.org origin and the /pull-requests/7 PR URL is accepted✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.