Repository navigation
test: skip symlink fixtures on hosts that cannot create symlinks - #2475
Conversation
Windows without Developer Mode or an elevated token throws EPERM from fs.symlinkSync (SeCreateSymbolicLinkPrivilege), so fixtures that plant a symlink failed before their first assertion on a normal Windows dev machine. That makes the tests depend on the machine, which ADE's test rules forbid. Add a per-app probe (apps/desktop/src/test/symlinks.ts and apps/ade-cli/src/test/symlinks.ts). On Windows it attempts a real file symlink in a temp dir; elsewhere it is true without probing. The eight proven symlink fixtures use it.skipIf, so they still run on macOS, Linux and an elevated Windows CI runner, and skip only where the OS refuses the link. No production code, assertions or copy changed. Proof (Windows 11, non-elevated, Developer Mode off; raw fs.symlinkSync EPERM errno -4048, junction OK): - Pre-fix durableFile.test.ts: 1 failed | 21 passed | 6 skipped, EPERM at durableFile.test.ts:381 (fs.symlinkSync). - Pre-fix four-file desktop batch: 4 files failed, 6 tests failed | 43 passed, all six EPERM at their symlink fixture lines. - Pre-fix ade-cli batch: 3 files failed, 9 tests failed | 22 passed: 8 symlink EPERM (proofPublish 1, skill 1, cloudLaneBackup 6) plus 1 known CRLF restore mismatch unrelated to this patch. - Post-fix durableFile.test.ts: 0 failed | 21 passed | 7 skipped. - Post-fix desktop batch: 0 failed | 43 passed | 6 skipped. - Post-fix ade-cli batch: 0 symlink EPERM failures; 22 passed | 8 skipped, with only the pre-existing CRLF restore mismatch still red. - npm --prefix apps/desktop run typecheck and npm --prefix apps/ade-cli run typecheck both pass. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 23 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
🔍 Devin Review: 4 flags
Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
| }); | ||
|
|
||
| it("a lane whose folder is missing counts as saved only by its backup", async () => { | ||
| it.skipIf(!symlinksSupported)("a lane whose folder is missing counts as saved only by its backup", async () => { |
There was a problem hiding this comment.
Ordinary checks are skipped too
On Windows without file-symlink privileges, this guard skips the missing-lane checks even though they do not need a symlink. The link comes only from makeUnpushedWork. Make that fixture's link optional and keep these checks running.
The same applies to the ordinary path checks in skill.test.ts and regular-file cleanup checks in durableFile.test.ts: split them from the symlink cases so they still run.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/ade-cli/src/services/cloudChats/cloudLaneBackup.test.ts
Line: 345
Comment:
**Ordinary checks are skipped too**
On Windows without file-symlink privileges, this guard skips the missing-lane checks even though they do not need a symlink. The link comes only from `makeUnpushedWork`. Make that fixture's link optional and keep these checks running.
The same applies to the ordinary path checks in `skill.test.ts` and regular-file cleanup checks in `durableFile.test.ts`: split them from the symlink cases so they still run.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.The Windows symlink guard sat on whole tests, so their traversal, age and path-jail assertions disappeared wherever a link could not be made. Fix the review findings on PR #2475: - skill.test.ts: read references/detail.md and the traversal, absolute path, SKILL and missing-file refusals unguarded; only the references/leak.md link and its fs.symlinkSync are guarded now. - providerContextReveal.test.ts and agentObservationCache.test.ts: these fixtures plant directory links, which work on Windows as junctions, so build them the repo's way (junction on win32, dir elsewhere) and drop the guard. The probe now covers only genuine file symlinks. - durableFile.test.ts: keep old-matching-removed, young-kept and non-matching-kept unguarded; only the symlink assertions are guarded. Co-Authored-By: Claude Code <noreply@anthropic.com>
Why
Several tests call
fs.symlinkSyncunconditionally. On a non-elevated Windows host without Developer Mode, file symlinks fail withEPERM, so those suites go red for reasons unrelated to the code they test. This is test infrastructure, not product behavior — the same class as pingdotgg/t3code#25970.What changed
durableFile,fileService,providerContextReveal,builtInBrowserCapabilities,sceneSnapshotIngest,agentObservationCacheand the related helpers.Evidence
durableFile.test.tswent from 1 failed to 21 passed / 7 skipped / 0 failed.ade-clitypechecks pass.Not checked
This is not a mechanical sweep of every unguarded symlink fixture in the repo; about 25 more exist and each needs per-file judgment (file link vs junction, which assertions actually depend on the link). Those are left for a separate pass.
🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; the remaining concern is non-blocking test coverage.Fix with agent prompt
Summary
The PR makes symlink-dependent tests portable without changing production code.
No new actionable issues were found in the latest changes.
Reviews (2) · Last reviewed commit: "test: keep non-symlink coverage on hosts..." · Reviewed by Greptile