Fix treehouse teardown path and slot rebind safety - #5
Conversation
|
FAIL Independent review — PR 5Reviewed head Findings1. Critical — the “fresh” rebind check is still a TOCTOU check; a slot rebound immediately afterward is modified and returnedEvidence: I injected a deterministic rebind at the first command after the second The new task's hook was deleted, its branch was detached, and Treehouse return was invoked even though the owner marker identified the new task. The colocated rebound test does not cover this interval: it installs the competing metadata before teardown ( This violates contract scenario 3. Rechecking is not a proof of ownership. The destructive operation needs an atomic Treehouse compare-and-return keyed by lease ID/generation, or an ownership lock covering every worktree mutation and return. Merely adding another pre-mutation check would only move the race. 2. High — any other syntactically valid metadata record is treated as a live claimant, bypassing the landed-work refusalEvidence: Adversarial fixture: task There was no Treat a competing metadata record as rebound evidence only after current endpoint/generation verification. Ambiguity must refuse; it must not retire either task's records. 3. High — an already-returned or no-longer-managed missing worktree is declared “landed-work ... passed” without running any landed-work testEvidence: the landed-work check is conditional on Adversarial fixture: I created a genuine unpushed commit, externally removed its worktree while preserving the task branch ref in the project repository, then ran teardown. Result: No landed-work check ran. This contradicts contract scenario 2's requirement that record retirement occur only when the landed-work test passes and the worktree is gone/clean. If the path is gone and landing cannot be proven from retained refs/metadata, teardown should refuse instead of claiming the gate passed. 4. High — a failed JSON status read is treated as legacy support when
|
|
FAIL PR 5 re-review — fix round
|
|
FAIL PR 5 round-three re-review —
|
|
PASS PR 5 round-four re-review —
|
|
PASS PR 5 light fixture review —
|
| File | Class | Classification |
|---|---|---|
tests/lib.sh |
DATA | Adds fm_fake_treehouse_legacy, an explicit fixture declaring that JSON status is unsupported while legacy status help is available. This narrows the former all-commands-exit-0 double rather than widening behavior. |
tests/fm-backend.test.sh |
DATA | Replaces two ambiguous Treehouse exit-0 doubles and makes one custom double explicitly advertise legacy status capability. |
tests/fm-busy-adapter-wiring.test.sh |
DATA | Replaces the generic Treehouse double with the explicit legacy fixture. |
tests/fm-decision-hold-lifecycle.test.sh |
DATA | Replaces two generic Treehouse doubles with the explicit legacy fixture. |
tests/fm-gate-refuse.test.sh |
DATA | Replaces/overlays two generic Treehouse doubles with explicit legacy capability data. |
tests/fm-gotmp.test.sh |
DATA + RULE | DATA: supplies newly required sourced libraries and executable stubs, adds the fake bin to PATH, and preserves failure output. RULE: adds --force to three teardown calls; justification below. |
tests/fm-grok-harness.test.sh |
DATA | Replaces the generic Treehouse double with explicit legacy capability data. |
tests/fm-kimi-harness.test.sh |
DATA | Replaces the generic Treehouse double with explicit legacy capability data. |
tests/fm-muse-harness.test.sh |
DATA | Replaces the generic Treehouse double with explicit legacy capability data. |
tests/fm-pr-check-security.test.sh |
DATA | Adds the explicit legacy Treehouse fixture to the isolated fake-bin world. |
tests/fm-public-followup.test.sh |
DATA | Updates Treehouse doubles; builds an inspectable landed Git branch/remote fixture for the missing-worktree teardown path; captures teardown diagnostics without changing exact pass/fail assertions. |
tests/fm-remote-secondmate-parent-binding.test.sh |
DATA | Overlays the generic Treehouse executable with explicit legacy capability data. |
tests/fm-secondmate-harness.test.sh |
DATA | Adds explicit legacy Treehouse data to one fixture and extends a lease-capable custom double with explicit legacy status responses. |
tests/fm-shared-captain-inheritance.test.sh |
DATA | Replaces the generic Treehouse bootstrap double with explicit legacy capability data. |
tests/fm-spawn-dispatch-profile.test.sh |
DATA | Replaces the generic Treehouse double with explicit legacy capability data. |
tests/fm-spawn-pool-base-freshen.test.sh |
DATA | Replaces the generic Treehouse double with explicit legacy capability data. |
tests/fm-tangle-guard.test.sh |
DATA | Replaces two generic Treehouse doubles with explicit legacy capability data. |
tests/fm-teardown-endpoint-safety.test.sh |
DATA | Makes the custom Treehouse runtime double capability-explicit; changes wait plumbing to capture the exit code under set -e while retaining the exact expect_code 0 rule. |
tests/fm-trace-context-spawn.test.sh |
DATA | Replaces the generic Treehouse double with explicit legacy capability data. |
RULE justification
tests/fm-gotmp.test.sh:146, :225, and :238 add --force to three teardown invocations. This is justified because the suite explicitly tests only whether tasktmp= is removed, absent, or already missing; its hermetic metadata intentionally points at nonexistent worktree/project paths. The newer landed-work safety gate correctly refuses those artificial paths before reaching task-temp cleanup unless the fixture opts out. --force isolates the stated GOTMP behavior without changing its exact assertions, removing a case, weakening a matcher, or altering production code. Landed-work refusal remains owned by the dedicated teardown tests whose earlier results stand.
Checks
- Full diff read and classified: 19 test files; no production files.
git diff --check f7726bd..abaa2b5: passed with no output.- No suite was rerun, consistent with the requested light diff-only review.
Recommendation
Accept abaa2b5 as a CI fixture correction.
|
PASS PR 5 light fixture review —
|
| Evidence | Class | Assessment |
|---|---|---|
tests/fm-backend-zellij.test.sh:854 |
DATA | Adds fm_fake_treehouse_legacy "$fb" to the missing-worktree Zellij scout teardown fixture. It supplies explicit capability values—JSON status unsupported, legacy status help available—in place of accidental reliance on the real machine-wide Treehouse behavior. |
tests/fm-backend-zellij.test.sh:901 |
DATA | Adds the same explicit Treehouse capability fixture to forced secondmate teardown with a Zellij child. It changes only fixture data; the forced-cleanup assertion and Zellij endpoint checks are unchanged. |
The edits do not touch the watcher-race test, alter its timing, widen a matcher, suppress a failure, or skip a case. They only make the two teardown worlds hermetic against the Treehouse capability detection introduced earlier in PR 5.
Checks
- Diff reviewed in full: one test file, two inserted fixture lines, no deletions and no production edits.
git diff --check abaa2b5..f703ed4: passed with no output.- No suite was rerun, consistent with the requested light diff-only review.
Recommendation
Accept f703ed4 as a fixture-data correction.
Summary
Covered scenarios
Validation
no-mistakes bypassed: headless-claude outage, independent review substituted