fix(bin): let a stale record on a reassigned slot retire records-only (port of upstream #6213) - #45
Merged
Merged
Conversation
… (#6213) * fix(bin): let a stale record on a reassigned slot retire records-only When a pool slot's owner claim names another task, the stale record's teardown touches nothing under the slot, so the exclusive-slot record scan no longer refuses it. Full teardowns of a slot this task still claims, or one with no claim, keep the refusal. Fixes #6184 * no-mistakes(document): Note claim-over-record precedence for reassigned teardown slots (cherry picked from commit 65c75b0dab02f2bd6c293cf21a20f712dfac16bd)
…te teardown The descendant preflight of a forced secondmate teardown runs the same slot guards as a task's own teardown. Pin that a child's stale record on a slot claimed by another recorded task is retired records-only, leaving the slot, its claim, and the other task's record untouched.
arjmad
force-pushed
the
fm/cln-fm-teardown
branch
from
October 1, 2026 21:43
07ebb1c to
2ad8ae7
Compare
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
bin/fm-teardown.shran the record-exclusivity scan before the slot-owner claim check.When a Treehouse pool slot had been reassigned to another task that also has a record, the scan refused the stale record's teardown on every attempt ("not even with --force"), so the reassignment path that retires the stale record with every slot step skipped was never reached.
Upstream already fixed this in kunchenguid/firstmate#6213 (65c75b0d), so this PR ports that commit unchanged (
git cherry-pick -x) rather than carrying a divergent fix that would conflict on the next upstream sync.require_exclusive_worktree_slot_recordnow returns early when the slot's owner claim names another task; a slot this task still claims, or one with no claim, keeps the refusal.The port brings upstream's regression test
test_stale_record_on_claimed_slot_retires_then_claimant_tears_downand itsdocs/architecture.mdnote.A second commit adds
test_secondmate_force_teardown_skips_reassigned_child_slottotests/fm-secondmate-safety.test.sh, covering the same case on the descendant preflight of a forced secondmate teardown: the child's stale record is retired, and the slot, its claim, and the other task's record are left untouched.That test fails on
mainand passes here.Checks
Run under bash 5.3, ShellCheck 0.11.0, and actionlint 1.7.12:
bin/fm-lint.sh- passbin/fm-doc-audience-check.sh- passbin/fm-test-run.sh tests/fm-teardown-endpoint-safety.test.sh tests/fm-secondmate-safety.test.sh tests/fm-teardown.test.sh- 3/3 passcloses-fp: 53f4631538105fed