* fix: prevent parallel worktree path resolution from escaping to home directory When .gsd is a symlink into ~/.gsd/projects/<hash> (the default layout), parallel workers resolve their cwd through the symlink. findWorktreeSegment() then matches /.gsd/ at the user-level ~/.gsd boundary instead of the project .gsd, causing resolveProjectRoot() to return ~ as the project root. This corrupts ~/.gsd, creates ~/.git, and crashes pi. Fix (3 layers): 1. Pass GSD_PROJECT_ROOT env var from coordinator to workers — the coordinator already knows the real basePath unambiguously. 2. In resolveProjectRoot(), detect when the candidate root's .gsd matches the user-level ~/.gsd and fall back to reading the worktree's .git file (gitdir: pointer) to recover the real project root. 3. Existing validateDirectory() already blocks ~ — but the bug bypassed it because the worktree path itself was 'safe'. Also fixes the existing test that asserted the buggy behavior as correct. Closes gsd-build/gsd-2#1676 * fix worktree root resolution for deep symlink paths --------- Co-authored-by: Vojtěch Šplíchal <splichal@gmail.com>
9 lines
213 B
Docker
9 lines
213 B
Docker
FROM node:24-bookworm
|
|
|
|
WORKDIR /test
|
|
|
|
COPY repro.mjs /test/repro.mjs
|
|
COPY verify-fix.mjs /test/verify-fix.mjs
|
|
COPY verify-integration.mjs /test/verify-integration.mjs
|
|
|
|
CMD ["node", "/test/verify-integration.mjs"]
|