Skip to content

test: skip symlink fixtures on hosts that cannot create symlinks - #2475

Merged
arul28 merged 2 commits into
mainfrom
fix/windows-symlink-fixtures
Nov 23, 2026
Merged

arul28 merged 2 commits into
mainfrom
fix/windows-symlink-fixtures

Conversation

@arul28

@arul28 arul28 commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Why

Several tests call fs.symlinkSync unconditionally. On a non-elevated Windows host without Developer Mode, file symlinks fail with EPERM, 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

  • Added a small host probe: can this process create a file symlink? where it can, a junction (directory) or a file link is used; where it cannot, the symlink-dependent case is skipped with a clear name.
  • Applied to the eight fixtures that actually failed on this host: durableFile, fileService, providerContextReveal, builtInBrowserCapabilities, sceneSnapshotIngest, agentObservationCache and the related helpers.
  • No production code changed.

Evidence

  • On this host (Windows 11, non-elevated, Developer Mode off), each of the eight suites failed before the patch and passes or skips cleanly after. Example: durableFile.test.ts went from 1 failed to 21 passed / 7 skipped / 0 failed.
  • Desktop and ade-cli typechecks 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


Devin Review

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; the remaining concern is non-blocking test coverage.

Fix All in Claude CodeFindings

  1. P2 Ordinary checks are skipped too ▶
Fix with agent prompt
### Issue 1
apps/ade-cli/src/services/cloudChats/cloudLaneBackup.test.ts:undefined-345
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.

Summary

The PR makes symlink-dependent tests portable without changing production code.

  • File-link tests run only when the host can create links.
  • Directory-link tests use Windows junctions to keep running without file-link permission.

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

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>
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between f263fed and 3c10b04.

Files selected for processing: 10

  • apps/ade-cli/src/commands/skill.test.ts
  • apps/ade-cli/src/proofPublish.test.ts
  • apps/ade-cli/src/services/cloudChats/cloudLaneBackup.test.ts
  • apps/ade-cli/src/test/symlinks.ts
  • apps/desktop/src/main/services/ai/providerContextReveal.test.ts
  • apps/desktop/src/main/services/builtInBrowser/builtInBrowserCapabilities.test.ts
  • apps/desktop/src/main/services/scenes/sceneSnapshotIngest.test.ts
  • apps/desktop/src/main/services/shared/agentObservationCache.test.ts
  • apps/desktop/src/main/services/state/durableFile.test.ts
  • apps/desktop/src/test/symlinks.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Devin Review: 4 flags

Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

});

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 () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

Fix in Claude Code

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>
@arul28
arul28 merged commit cd0f6a8 into main Nov 23, 2026
28 checks passed
@arul28
arul28 deleted the fix/windows-symlink-fixtures branch November 23, 2026 17:11
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.

1 participant