Skip to content

fix(bin): let a stale record on a reassigned slot retire records-only (port of upstream #6213) - #45

Merged
arjmad merged 3 commits into
mainfrom
fm/cln-fm-teardown
Oct 2, 2026
Merged

arjmad merged 3 commits into
mainfrom
fm/cln-fm-teardown

Conversation

@arjmad

@arjmad arjmad commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

bin/fm-teardown.sh ran 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_record now 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_down and its docs/architecture.md note.

A second commit adds test_secondmate_force_teardown_skips_reassigned_child_slot to tests/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 main and passes here.

Checks

Run under bash 5.3, ShellCheck 0.11.0, and actionlint 1.7.12:

  • bin/fm-lint.sh - pass
  • bin/fm-doc-audience-check.sh - pass
  • bin/fm-test-run.sh tests/fm-teardown-endpoint-safety.test.sh tests/fm-secondmate-safety.test.sh tests/fm-teardown.test.sh - 3/3 pass

closes-fp: 53f4631538105fed

karotkriss and others added 2 commits October 1, 2026 17:35
… (#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
arjmad force-pushed the fm/cln-fm-teardown branch from 07ebb1c to 2ad8ae7 Compare October 1, 2026 21:43
@arjmad arjmad changed the title fix(bin): read the slot-owner claim before the teardown record scan fix(bin): let a stale record on a reassigned slot retire records-only (port of upstream #6213) Oct 1, 2026
@arjmad
arjmad merged commit 257210e into main Oct 2, 2026
24 checks passed
@arjmad
arjmad deleted the fm/cln-fm-teardown branch October 2, 2026 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants