Skip to content

fix(pstack): resolve the temp dir before building the relative symlink - #1285

Open
lnuxe wants to merge 1 commit into
cursor:mainfrom
lnuxe:fix/statechart-tmpdir-realpath-1164
Open

lnuxe wants to merge 1 commit into
cursor:mainfrom
lnuxe:fix/statechart-tmpdir-realpath-1164

Conversation

@lnuxe

@lnuxe lnuxe commented Nov 19, 2026

Copy link
Copy Markdown

What

linkedLauncher in pstack/skills/statechart/scripts/test/cli.test.ts builds a relative symlink to the launcher inside a temp dir. On macOS os.tmpdir() is a symlink (/tmp -> /private/tmp, /var -> /private/var), so path.relative() computes the link target lexically from the symlinked path, but the kernel resolves the link's .. segments from the physical directory, which is one level deeper. The link points at a path that does not exist and the spawn fails.

Resolve the temp dir with fs.realpathSync() before building the link so both sides are physical.

Fixes #1164.

Repro (macOS)

$ 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 !== ''

Verification

tests pass fail skipped
baseline 340 269 1 70
this change 340 270 0 70
  • The 70 skipped are pre-existing (require TLC/Java not installed locally).
  • Regenerated harness/ with scripts/generate-pstack-harness-trees.mjs; --check passes.
  • node scripts/validate-plugins.mjs passes.

CI

validate-plugins.yml runs on pstack/** + harness/** and will cover this change.

linkedLauncher creates its links under os.tmpdir(), which on macOS is a
symlink (/tmp -> /private/tmp, /var -> /private/var). path.relative()
computes the link target lexically from the symlinked path, but the
kernel resolves the link's ".." segments from the physical directory,
which is one level deeper, so the spawn target does not exist and the
"launcher reached through a symlink" test fails.

Resolve the temp directory with fs.realpathSync() before building the
link so both sides are physical. Fixes cursor#1164.
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.

statechart: relative-symlink launcher test fails on macOS because /var is a symlink

1 participant