statechart: relative-symlink launcher test fails on macOS because /var is a symlink
On macOS, the launcher reached through an absolute and a relative symlink writes the committed chart on this Node in pstack/skills/statechart/scripts/test/cli.test.ts fails. The test before it, which reaches the launcher by its own path, passes.
$ node --disable-warning=ExperimentalWarning --test --test-name-pattern="launcher reached" test/cli.test.ts
✔ the launcher reached by its own path writes the committed chart on this Node
✖ the launcher reached through an absolute and a relative symlink writes the committed chart on this Node
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
undefined !== ''
at cli.test.ts:135:12
Node v26.13.0, macOS. The scripts are copied verbatim from ae5650f.
Cause. linkedLauncher creates its links under os.tmpdir(), which is /var/folders/... on macOS. /var is a symlink to /private/var. path.relative(second, launcher) computes the relative target lexically from /var/folders/.../b. The kernel resolves the link's .. segments from the physical directory, /private/var/folders/.../b, which is one level deeper, so the relative link points at a path that doesn't exist and the spawn fails.
Possible fix. Resolve the temp directory before building the relative link, for example fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), "statechart-links-")).
@christofferbergj the open PR #997 from @VDrozd-Cyclis makes the change you suggest. linkedLauncher now resolves the temp folder with fs.realpathSync(fs.mkdtempSync(...)) before building the relative link, in both pstack/ and the generated harness/pstack/claude-code/ copy.
I checked it on macOS with Node v25.9.0 by running --test-name-pattern="launcher reached" test/cli.test.ts:
- current
main(2776ddd): the relative-symlink test fails, 1 pass and 1 fail; - the #997 head: both tests pass.
It still merges cleanly into main.
Fixed in #1285: resolve the temp dir with fs.realpathSync() before building the relative link, so both sides are physical. Verified on macOS: the failing test goes red → green (baseline 269 pass/1 fail → 270 pass/0 fail; the 70 skipped are pre-existing).