Skip to content

fix(spawn): compare physical paths in treehouse wait loop for symlinked projects#273

Open
wuyuwenj wants to merge 6 commits into
kunchenguid:mainfrom
wuyuwenj:fm/fix-spawn-symlink-3f
Open

fix(spawn): compare physical paths in treehouse wait loop for symlinked projects#273
wuyuwenj wants to merge 6 commits into
kunchenguid:mainfrom
wuyuwenj:fm/fix-spawn-symlink-3f

Conversation

@wuyuwenj

@wuyuwenj wuyuwenj commented Jul 5, 2026

Copy link
Copy Markdown

What Changed

  • bin/fm-spawn.sh's treehouse wait loop now resolves the project path physically (pwd -P) and keeps polling until the pane's path differs from both the logical and physical forms. Previously, when a project lived under a symlinked prefix (e.g. macOS's /tmp -> /private/tmp), the backend-reported physical cwd differed from the logical PROJ_ABS on the very first poll, breaking the loop before treehouse get moved the pane, capturing the primary checkout as the worktree, and false-refusing the spawn at the isolation guard.
  • Added tests/fm-spawn-symlink-wait.test.sh as a regression test for the symlinked-project wait behavior (the pipeline's test stage runs it green with the rest of the suite).
  • Updated docs/herdr-backend.md to mark the previously documented symlink-fragility gap as resolved, and added the new test (plus the pre-existing fm-gotmp test, an auto-fix from the pipeline's document stage) to CONTRIBUTING.md's test list.

Risk Assessment

✅ Low: A one-line, backend-agnostic tightening of an existing comparison, guarded downstream by the existing worktree-isolation validator and covered by a new regression test that reproduces the original symlink failure.

Testing

Completed 1 recorded test check.

Pipeline

Updates from git push no-mistakes

⏭️ **intent** - skipped

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 info
  • ℹ️ bin/fm-spawn.sh:796 - PROJ_PHYS=$(cd "$PROJ_ABS" && pwd -P) runs under set -e; if the cd ever failed the script would exit silently with no error message. PROJ_ABS was just resolved via a successful cd earlier in the same run, so this is practically unreachable — noted only for completeness.
✅ **Test** - passed

✅ No issues found.

  • command -v tmux >/dev/null || { echo "tmux is required for e2e tests" >&2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo "== $t =="; bash "$t" || rc=1; done; exit "$rc"
🔧 **Document** - 1 issue found → auto-fixed ✅
  • ℹ️ CONTRIBUTING.md:73 - Pre-existing gap unrelated to this change: tests/fm-gotmp.test.sh is missing from CONTRIBUTING.md's enumerated test list (it exists at the base commit, so it was not introduced by this diff); left untouched as out of scope.

🔧 Fix: add fm-gotmp test to CONTRIBUTING test list
✅ Re-checked - no issues remain.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

wuyuwenj added 6 commits July 4, 2026 16:52
…ed projects

The wait loop after 'treehouse get' polled the pane's PHYSICAL cwd but
compared it against the logically-resolved PROJ_ABS. Through a symlinked
projects/<name> the two differ from the first poll, so the loop broke
before treehouse created the worktree, captured the project checkout as
WT, and the isolation guard refused the launch. Keep waiting while the
pane matches either the logical or physical project path.

Regression test drives fm-spawn through a symlinked project dir with a
stateful fake tmux whose first polls report the project's physical cwd.
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.

1 participant