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

未关闭 适合新手
#1,164 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
macos, node.js, typescript
领域
cli, testing

调研方向

失败的用例是 pstack/skills/statechart/scripts/test/cli.test.ts 中名为 'the launcher reached through an absolute and a relative symlink' 的测试,位于第 135 行附近。阅读在 os.tmpdir() 下创建链接的 linkedLauncher 辅助函数,以及构建相对目标的 path.relative 调用。在 macOS 上使用 --test-name-pattern 过滤器运行该测试。当在构建相对链接之前用 realpath 解析临时目录,并且该测试在 macOS 和 Linux 上都通过时,即为完成。

由索引模型根据 Issue 内容生成。

描述

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-")).

主要语言
TypeScript
星标
14.9k
派生
1.5k
平均合并
3 小时 23 分钟
30 天内合并 PR
143

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

cursor/plugins 的其他 Issue

查看 cursor/plugins 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。