Skip to content

fix: refuse ship teardown when Git index flags can hide edits - #7193

Open
dar1us8 wants to merge 2 commits into
kunchenguid:mainfrom
dar1us8:fm/treehouse-upgrade-isolated-tests
Open

dar1us8 wants to merge 2 commits into
kunchenguid:mainfrom
dar1us8:fm/treehouse-upgrade-isolated-tests

Conversation

@dar1us8

@dar1us8 dar1us8 commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • Refuse ordinary ship cleanup for assume-unchanged or skip-worktree entries, or failed index inspection; report flagged paths without changing flags or files.
  • Add isolated regression fixtures covering repeated refusal, preservation, unmasked edits, and index-read failures, with a focused test mode.
  • Document hidden-index safety checks and retain existing force and scout exceptions.

Risk Assessment

✅ Low: The narrow guard refuses ordinary ship cleanup before destructive actions, preserves hidden-index flags and ownership, and adds behavioral regression coverage without changing production tools.

Testing

Focused regressions passed and reproduced the pre-fix failure. Seven live cleanup scenarios preserved files, index flags, ownership, task records, and the disposable worker. CLI transcripts and persisted-state evidence were captured; setup issues were corrected and fixtures removed. This validates the narrow cleanup correction, not a production tool upgrade.

  • Live validation: ✅ go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Cleanup refuses assume-unchanged hidden edits without changing files or ownership ✅ pass live Live cleanup transcript: assume-unchanged hidden edits, attempts 1–2
Cleanup refuses skip-worktree hidden edits without releasing ownership ✅ pass live Live cleanup transcript: skip-worktree hidden edits, attempts 1–2
Combined flags and unusual filenames cannot evade cleanup protection ✅ pass live Live cleanup transcript: combined hidden flags, attempts 1–2
A clean assume-unchanged entry still blocks cleanup ✅ pass live Live cleanup transcript: clean assume-unchanged entry
A clean skip-worktree entry still blocks cleanup ✅ pass live Live cleanup transcript: clean skip-worktree entry
Visible tracked edits retain the existing dirty-worktree refusal ✅ pass live Live cleanup transcript: ordinary visible edits
An unreadable index fails closed before destructive cleanup ✅ pass live Live cleanup transcript: unreadable corrupt index
Evidence: Live cleanup transcript and preservation evidence

Source: Live cleanup transcript and preservation evidence

$ ['~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/bin/fm-lab-home.sh', 'create', '~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip']
~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip
exit=0

$ ['tasks-axi', 'add', 'task-x1', 'hidden-index preservation', '--kind', 'ship', '--file', '~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/data/backlog.md']
ok: added task-x1 (ship) -> Queued
task:
  id: task-x1
  title: hidden-index preservation
  state: queued
  blocked: no
  blocked_by: none
  held: no
  hold_reason: "-"
  hold_kind: "-"
  hold_until: "-"
  kind: ship
  repo: "-"
  priority: "-"
  created: 2026-10-12
  closed: "-"
  deps: none
  links: none
  body: ""
help[2]:
  - Run `tasks-axi start task-x1 --file=~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/data/backlog.md` to move it to in flight
  - Run `tasks-axi block task-x1 --by <other> --file=~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/data/backlog.md` to record a dependency
exit=0

$ ['tasks-axi', 'start', 'task-x1', '--file', '~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/data/backlog.md']
ok: start task-x1 -> In flight
help[1]:
  - Run `tasks-axi done task-x1 --pr <url> --file=~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/data/backlog.md` when it ships
exit=0

$ ['git', 'init', '-q', '-b', 'main', '~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/seed']
exit=0

$ ['git', '-C', '~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/seed', 'add', '.']
exit=0

$ ['git', '-C', '~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/seed', 'commit', '-qm', 'baseline']
exit=0

$ ['git', 'clone', '-q', '--bare', '~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/seed', '~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/origin.git']
exit=0

$ ['git', 'clone', '-q', '~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/origin.git', '~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/projects/project']
exit=0

$ ['treehouse', 'get', '--lease', '--lease-holder', 'task-x1', '--json', '--no-fetch']
{"path":"~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project","lease_id":"a6a4a72d3b9cd2f57571f9f7828423b2","lease_holder":"task-x1","leased_at":"2026-10-12T20:51:36.932287-04:00"}
🌳 Setting up worktree...
🌳 Leased worktree at ~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project. Run 'treehouse return ~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project' to release it.
exit=0

Real Treehouse lease: {"path": "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project", "lease_id": "a6a4a72d3b9cd2f57571f9f7828423b2", "lease_holder": "task-x1", "leased_at": "2026-10-12T20:51:36.932287-04:00"}

$ ['git', '-C', '~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project', 'switch', '-c', 'fm/task-x1']
Switched to a new branch 'fm/task-x1'
exit=0

$ ['git', '-C', '~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project', 'rev-parse', '--path-format=absolute', '--git-path', 'index']
~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/projects/project/.git/worktrees/project/index
exit=0

$ ['git', '-C', '~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project', 'rev-parse', 'HEAD']
9de03e20432870a5ac272d762509e650088fbded
exit=0

$ ['git', '-C', '~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project', 'update-index', '--no-assume-unchanged', '--', 'hidden proof.txt', 'hidden\nname.txt', '-dash.txt', 'tab\tname.txt']
exit=0

$ ['git', '-C', '~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project', 'update-index', '--no-skip-worktree', '--', 'hidden proof.txt', 'hidden\nname.txt', '-dash.txt', 'tab\tname.txt']
exit=0

$ ['git', '-C', '~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project', 'update-index', '--assume-unchanged', '--', 'hidden proof.txt', 'hidden\nname.txt', '-dash.txt', 'tab\tname.txt']
exit=0

$ ['git', '-C', '~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project', 'status', '--porcelain']
exit=0

$ ['git', '-C', '~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project', 'ls-files', '-v']
h -dash.txt
h "hidden\nname.txt"
h hidden proof.txt
h "tab\tname.txt"
exit=0

Before cleanup persistent SHA-256: {
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/state/task-x1.meta": "f05d8a8e84eb811f092797de1355ec5e16505c23e11c69c3fd8847a7e0560a8c",
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/state/task-x1.status": "b1ab1c8f28ddb3a9693e38b42a5b140e4306eadd20c707c75be1fe63d327b8e3",
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/data/backlog.md": "23cd0f42a7e03ca8e0e5868dc8e672afea37bb9c4c794cd5eb7146bdc06dbd17",
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/p

... [61911 bytes truncated] ...

B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project', 'status', '--porcelain']
exit=0

$ ['git', '-C', '~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project', 'ls-files', '-v']
H -dash.txt
H "hidden\nname.txt"
H hidden proof.txt
H "tab\tname.txt"
exit=0

Before cleanup persistent SHA-256: {
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/state/task-x1.meta": "f05d8a8e84eb811f092797de1355ec5e16505c23e11c69c3fd8847a7e0560a8c",
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/state/task-x1.status": "b1ab1c8f28ddb3a9693e38b42a5b140e4306eadd20c707c75be1fe63d327b8e3",
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/data/backlog.md": "23cd0f42a7e03ca8e0e5868dc8e672afea37bb9c4c794cd5eb7146bdc06dbd17",
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/.fm-slot-owner": "6c9aaff48734d2f3ae4ce933c437663afa5c6c3d638b66c54f6c068fe8aab91d",
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/treehouse-state.json": "5319f1a621324847ad0429e085b0e14766be81e179fa736f3bf777bc33f7751d",
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/projects/project/.git/worktrees/project/index": "ea4f36a519017be76d77835ef1403bdd0f1257f4559b04ffe5da47cb32294b29",
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project/hidden proof.txt": "4b654bd1437066b13498661f3ca14774daf1066d072036beffaf06f0c014250e",
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project/hidden\nname.txt": "4b654bd1437066b13498661f3ca14774daf1066d072036beffaf06f0c014250e",
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project/-dash.txt": "4b654bd1437066b13498661f3ca14774daf1066d072036beffaf06f0c014250e",
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project/tab\tname.txt": "4b654bd1437066b13498661f3ca14774daf1066d072036beffaf06f0c014250e"
}

$ ['~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/bin/fm-teardown.sh', 'task-x1']
fm-gate-refuse: gate agent lifecycle permitted only against lab home ~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip
WARNING: watcher still down (same stale episode; last beat: 12s ago, grace 300s) - full banner already printed this episode.
REFUSED: cannot inspect worktree ~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project for assume-unchanged or skip-worktree entries.
Preserve the work and restore index inspection before retrying cleanup.
exit=1

$ ['git', '-C', '~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project', 'rev-parse', 'HEAD']
9de03e20432870a5ac272d762509e650088fbded
exit=0

After cleanup persistent SHA-256: {
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/state/task-x1.meta": "f05d8a8e84eb811f092797de1355ec5e16505c23e11c69c3fd8847a7e0560a8c",
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/state/task-x1.status": "b1ab1c8f28ddb3a9693e38b42a5b140e4306eadd20c707c75be1fe63d327b8e3",
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/data/backlog.md": "23cd0f42a7e03ca8e0e5868dc8e672afea37bb9c4c794cd5eb7146bdc06dbd17",
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/.fm-slot-owner": "6c9aaff48734d2f3ae4ce933c437663afa5c6c3d638b66c54f6c068fe8aab91d",
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/treehouse-state.json": "5319f1a621324847ad0429e085b0e14766be81e179fa736f3bf777bc33f7751d",
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/projects/project/.git/worktrees/project/index": "ea4f36a519017be76d77835ef1403bdd0f1257f4559b04ffe5da47cb32294b29",
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project/hidden proof.txt": "4b654bd1437066b13498661f3ca14774daf1066d072036beffaf06f0c014250e",
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project/hidden\nname.txt": "4b654bd1437066b13498661f3ca14774daf1066d072036beffaf06f0c014250e",
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project/-dash.txt": "4b654bd1437066b13498661f3ca14774daf1066d072036beffaf06f0c014250e",
  "~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project/tab\tname.txt": "4b654bd1437066b13498661f3ca14774daf1066d072036beffaf06f0c014250e"
}

unreadable corrupt index attempt 1: files, index bytes, HEAD, lease, claim, task/status/backlog unchanged; resident process 52642 alive

$ ['treehouse', 'status', '--json']
[{"name":"1","path":"~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/pool/.treehouse/project-09c6d7/1/project","status":"leased","flavor":"git","lease_id":"a6a4a72d3b9cd2f57571f9f7828423b2","lease_holder":"task-x1","leased_at":"2026-10-12T20:51:36.932287-04:00","processes":[{"pid":52642,"name":"sleep"}]}]
A new version of treehouse is available: v2.3.0 → v3.1.2
Run "treehouse update" to update

exit=0

$ ['tasks-axi', 'show', 'task-x1', '--file', '~/firstmate/data/factum-v2-validation/nm-home-1.84.0/worktrees/ed75b620a487/01M4SBM3B8AMZFQ4WNCXEVBYEC/.test-hidden-tmp/fm-lab.fmcz9rip/data/backlog.md']
task:
  id: task-x1
  title: hidden-index preservation
  state: in_flight
  blocked: no
  blocked_by: none
  held: no
  hold_reason: "-"
  hold_kind: "-"
  hold_until: "-"
  kind: ship
  repo: "-"
  priority: "-"
  created: 2026-10-12
  closed: "-"
  deps: none
  links: none
  body: ""
exit=0
Evidence: Pre-fix regression reproduction

Source: Pre-fix regression reproduction

not ok - assume-unchanged/1: hidden tracked entries must refuse cleanup: expected exit 1, got 0

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Cleanup refuses assume-unchanged hidden edits without changing files or ownership ✅ pass live Live cleanup transcript: assume-unchanged hidden edits, attempts 1–2
Cleanup refuses skip-worktree hidden edits without releasing ownership ✅ pass live Live cleanup transcript: skip-worktree hidden edits, attempts 1–2
Combined flags and unusual filenames cannot evade cleanup protection ✅ pass live Live cleanup transcript: combined hidden flags, attempts 1–2
A clean assume-unchanged entry still blocks cleanup ✅ pass live Live cleanup transcript: clean assume-unchanged entry
A clean skip-worktree entry still blocks cleanup ✅ pass live Live cleanup transcript: clean skip-worktree entry
Visible tracked edits retain the existing dirty-worktree refusal ✅ pass live Live cleanup transcript: ordinary visible edits
An unreadable index fails closed before destructive cleanup ✅ pass live Live cleanup transcript: unreadable corrupt index
  • TMPDIR="$PWD/.test-hidden-tmp" FM_TEARDOWN_HIDDEN_INDEX_ONLY=1 bash tests/fm-teardown.test.sh
  • Ran the same focused regression against a disposable copy containing the base commit's teardown script; it failed as expected because hidden-index cleanup returned exit 0.
  • python3 .test-hidden-tmp/drive.py: exercised real bin/fm-teardown.sh task-x1 calls against a marked lab home, real Git worktree, Treehouse lease, backlog, and disposable resident process.
  • treehouse get --lease --lease-holder task-x1 --json --no-fetch, treehouse status --json, and tasks-axi show task-x1 --file &lt;lab&gt;/data/backlog.md
  • Compared persistent SHA-256 hashes and HEAD before and after refusals; confirmed the resident process survived.
  • treehouse --version remained v2.3.0; removed disposable fixtures and verified no worktree changes remained.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate:

Thank you @dar1us8 — this is a careful, well-evidenced guard. I reviewed tip 451b3466 against main 6407052f. The no-mistakes attestation matches the tip, live validation is go 7/7, and the diff is shell + tests + docs only (no workflow, network, or secret surface). I approved fork CI for this head (runs 38329591335, 38329591367).

One question before this can move: sparse checkout. git sparse-checkout sets the skip-worktree bit on every out-of-cone path, and git worktree add copies the sparse settings into new worktrees, so git ls-files -v shows S for all of those entries. I checked this locally: a sparse repo and a worktree added from it both list S b/y for the excluded path. With this tip, it looks like every ship teardown in a sparse-checkout project would refuse (and print every excluded path), even when the work has fully landed and nothing is hidden. Could you take a look? One option is to exempt entries that sparse checkout manages, or to refuse only when a flagged entry's working file is actually present and differs. Either way, a regression case for a sparse worktree would pin it.

Contract-class (mine): new-default for now. The hidden-edit refusal itself fits the existing "dirty worktrees refuse / inconclusive refuses" promise. But refusing clean flagged entries, including sparse-checkout ones, is a new refusal on a default teardown path that succeeds today. If the refusal narrows to entries that can actually hide edits, I'd expect this to read as restore.

VISION.md per rule: One captain, one interface: aligns (clear refusal text, nothing hidden). Authority explicit: aligns (no flags or files touched; --force stays the captain's explicit discard). Scripts own the mechanics: aligns (deterministic NUL-safe index scan). Restart is a non-event: aligns (records, lease, and owner claim are preserved). Delegation with a spine: aligns ("unlanded work is never torn down"), though the sparse case is still open. Fleet outlives vendor: aligns (plain Git). Scope: aligns.

Heads-up, not on you: main is currently red on the Pi shards (@earendil-works/pi-codemode export mismatch upstream), so Pi-only failures on this PR's CI aren't caused by your change.

Status: waiting on you for the sparse-checkout question. Thanks again!

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