Repository navigation
fix: resolve tmpdir symlink in describeInstallLocation fixture (macOS flake) - #2086
Conversation
ee2eda4 to
7356853
Compare
… flake) On macOS tmpdir() is /var/folders/..., a system symlink to /private/var/folders/..., so the fixture dir the test passes as installDir is itself a symlink hop. describeInstallLocation's realpath then legitimately reports it (real=...), and the plain case's doesNotMatch(/real=/) assertion fails deterministically. Realpath the fixture dir so the plain case stays plain on every platform; the link case below already compared via realpathSync. Fixes ranxianglei#2068
755d745 to
a54536e
Compare
|
ework review |
PR review — #2086 (test-only macOS flake fix for #2068)① 是什么问题: ② 什么原因导致:测试环境依赖了「tmpdir 路径已完全解析」这个在 Linux CI 上成立、macOS 上不成立的隐含假设(§7.2 环境运气类,同 #360)。生产代码行为没有错—— ③ 怎么修复:一行测试改动—— ④ 是否有回归问题:无。纯 test-only diff(+5/-1,单文件)。已清点同文件其余 6 个用例:全部用字面路径做相等/包含断言(
CI(head a54536e):14 项 check run 全绿(test ubuntu 22/24、windows 22/24、hermetic registry e2e、build-artifact、version-guard 等)。注意 CI 无 macOS runner——此 flake 只在本地 macOS 显现,但修复方向正确,不影响 Linux/Windows 行为。 ⑤ 是否破坏缓存:不涉及(无缓存/重试/游标/去重键相关)。 ⑥ 是否改了设计方向:不涉及。 ⑦ 是否引入新配置:不涉及。
|
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.20-master.ef59298 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Fixes #2068
What
tests/update-install-dir.test.ts:131(describeInstallLocation: names target, symlink real, and running module) failed deterministically on macOS.Root cause
The fixture is created under
mkdtempSync(path.join(tmpdir(), ...)). On macOStmpdir()is/var/folders/..., which is itself a system symlink to/private/var/folders/.... The implementation (src/update.tsdescribeInstallLocation) legitimately runsrealpathSync(installDir)and reports the difference asreal=...— so the test's plain case ("no symlink hop") actually contained a symlink hop (the OS one), andassert.doesNotMatch(plain, /real=/)failed. Verified pre-existing on clean master (3a7308a) in a separate worktree without this change: 7 tests, 6 pass, 1 fail.Fix (test-only, 1 line + comment)
Resolve the fixture dir with
realpathSyncbefore use, so the plain case stays plain on every platform. The link case below already compared viarealpathSync(link), so it is unaffected. Implementation unchanged — reportingreal=for a genuine symlink hop is the intended behavior of that log line.Pre-flight (on this branch, macOS host)
npm run typecheck— cleannpm test— 4056 tests, 4034 pass, 0 fail, 22 skipped (the previously failing test now passes; full suite green)npm run build— successConfig surface: none (test-only change).