Skip to content

test: use junctions or skips for the remaining symlink fixtures - #2480

Merged
arul28 merged 2 commits into
mainfrom
test/symlink-fixture-sweep
Nov 24, 2026
Merged

arul28 merged 2 commits into
mainfrom
test/symlink-fixture-sweep

Conversation

@arul28

@arul28 arul28 commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Why

On a non-elevated Windows host without Developer Mode, fs.symlinkSync to a file throws EPERM; directory links work when created as junctions. PR #2475 fixed the first eight fixtures; the rest still failed before their first assertion. This is test infrastructure only — no product behavior changes.

What changed

  • Added createTestDirectoryLink(target, link) to both test helpers: a junction on Windows and a directory symlink elsewhere. It chooses by path.sep, not process.platform, because one suite spies process.platform to darwin.
  • Directory-link fixtures now use it in: disk-full incident, automation planner/service, capture helper, ADE CLI service, Pi session leases, iOS device hub/simulator, project icon resolver, agent skill runtime, legacy skill cleanup, storage insights.
  • File-link fixtures guard with it.skipIf(!symlinksSupported): chat transcript links, registry chat-image/artifact links, computer-use artifact store, cursor skill shim, sync artifact link, remote MCP proof links.
  • Where a test also asserted behavior that needs no link, those assertions were split into an unguarded test: registry, computer-use, capture helper, remote MCP, and syncHostService (it skips only the file-link request and still runs the rest).
  • compileCachePrune now runs its junction fixture on Windows instead of skipping the whole platform.
  • captureHelper uses a local probe because it mocks node:fs, so the shared probe would report false everywhere.

No assertion was deleted or weakened.

Evidence

  • On this host (Windows 11, non-elevated, Developer Mode off), the 18 affected desktop files: 881 passed, 48 failed, 11 skipped, zero EPERM. The 48 are unrelated Windows environment expectations (CRLF, POSIX-only kill/mkfifo/chmod, POSIX path roots), listed below.
  • The six CLI files: 75 passed, 1 failed, 21 skipped, zero EPERM; the failure is the known CRLF cloudLaneBackup case.
  • Desktop and ade-cli typechecks pass.

Not checked

The unrelated Windows failures were left alone: CRLF assertions, POSIX process-group kills, POSIX-only mkfifo/chmod, and tests that mock process.platform to Darwin while running on Windows. They predate this change and are out of scope for a symlink sweep.

🤖 Generated with Claude Code

ADE   Open in ADE  ·  test/symlink-fixture-sweep branch  ·  PR #2480


Devin Review

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; the remaining junction-coverage gap is non-blocking.

Fix All in Claude CodeFindings

  1. P2 Windows junction coverage stays skipped ▶
Fix with agent prompt
### Issue 1
apps/ade-cli/src/services/runtime/compileCachePrune.test.ts:undefined-42
`symlinksSupported` probes file symlinks, but this test now creates a directory junction through `createTestDirectoryLink`. On Windows without Developer Mode or elevated privileges, the probe returns false even though the junction can be created. The directory safety check therefore remains skipped on those hosts. Remove the file-symlink guard from this fixture.

```suggestion
  it("never follows or removes a symlink out of the root", async () => {
```

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

This PR makes link-based test fixtures work on more Windows hosts without changing product code.

  • Link fixtures now use host-compatible setups across desktop and CLI tests.

Reviews (3) · Last reviewed commit: "test: keep the capture-jail test's origi..." · Reviewed by Greptile

@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 40 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 a951e34 and 07f8950.

Files selected for processing: 22

  • apps/ade-cli/src/services/remoteMcp/remoteMcpTools.test.ts
  • apps/ade-cli/src/services/runtime/compileCachePrune.test.ts
  • apps/ade-cli/src/test/symlinks.ts
  • apps/desktop/src/main/services/__tests__/diskFullIncident.integration.test.ts
  • apps/desktop/src/main/services/adeActions/registry.test.ts
  • apps/desktop/src/main/services/automations/automationPlannerService.test.ts
  • apps/desktop/src/main/services/automations/automationService.test.ts
  • apps/desktop/src/main/services/capture/captureHelper.test.ts
  • apps/desktop/src/main/services/chat/agentChatServiceHistory.test.ts
  • apps/desktop/src/main/services/chat/agentChatServiceLifecycle.test.ts
  • apps/desktop/src/main/services/chat/piSession.test.ts
  • apps/desktop/src/main/services/cli/adeCliService.test.ts
  • apps/desktop/src/main/services/computerUse/computerUseArtifactBrokerService.test.ts
  • apps/desktop/src/main/services/ios/iosDeviceHub.test.ts
  • apps/desktop/src/main/services/ios/iosSimulatorService.test.ts
  • apps/desktop/src/main/services/projects/projectIconResolver.test.ts
  • apps/desktop/src/main/services/skills/agentSkillRuntimeService.test.ts
  • apps/desktop/src/main/services/skills/cursorAgentSkillShim.test.ts
  • apps/desktop/src/main/services/skills/legacySkillCleanupService.test.ts
  • apps/desktop/src/main/services/storage/storageInsightsService.test.ts
  • apps/desktop/src/main/services/sync/syncHostService.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: 6 flags

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

Devin Review


// The two recent siblings keep the stale-looking link inside the removable range, so only the symlink check protects it.
it.skipIf(process.platform === "win32")("never follows or removes a symlink out of the root", async () => {
it.skipIf(!symlinksSupported)("never follows or removes a symlink out of the root", 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 Windows junction coverage stays skipped

symlinksSupported probes file symlinks, but this test now creates a directory junction through createTestDirectoryLink. On Windows without Developer Mode or elevated privileges, the probe returns false even though the junction can be created. The directory safety check therefore remains skipped on those hosts. Remove the file-symlink guard from this fixture.

Suggested change
it.skipIf(!symlinksSupported)("never follows or removes a symlink out of the root", async () => {
it("never follows or removes a symlink out of the root", async () => {
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/ade-cli/src/services/runtime/compileCachePrune.test.ts
Line: 42

Comment:
**Windows junction coverage stays skipped**

`symlinksSupported` probes file symlinks, but this test now creates a directory junction through `createTestDirectoryLink`. On Windows without Developer Mode or elevated privileges, the probe returns false even though the junction can be created. The directory safety check therefore remains skipped on those hosts. Remove the file-symlink guard from this fixture.

```suggestion
  it("never follows or removes a symlink out of the root", async () => {
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 87a74cc. Configure here.

platform: process.platform,
chordCooldownMs: 0,
});
helper.updateSettings({ enabled: true });

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.

Capture helper tests fail on Linux due to platform

High Severity

deliverCaptured passes platform: process.platform to CaptureHelper, which causes CaptureHelper.start() to bail out on Linux because isCaptureGestureSupported("linux") returns false. Both tests calling deliverCaptured then never spawn the mocked helper or receive stdout events, causing their assertions on onFailure and onShot to fail on Linux hosts.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 87a74cc. Configure here.

fs.writeFileSync(path.join(outside, "keep.txt"), "keep");
fs.utimesSync(path.join(outside, "keep.txt"), old, old);
fs.symlinkSync(outside, path.join(root, OLD), "dir");
createTestDirectoryLink(outside, path.join(root, OLD));

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.

Junction test still skipped when file symlinks unsupported

Medium Severity

compileCachePrune.test.ts switches its fixture to createTestDirectoryLink (a Windows junction) but guards the test with it.skipIf(!symlinksSupported). Because symlinksSupported probes file symlink creation, the test is still skipped on non-elevated Windows hosts without Developer Mode, contrary to the intent of running the junction fixture on Windows.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 87a74cc. Configure here.

@arul28
arul28 force-pushed the test/symlink-fixture-sweep branch from 87a74cc to d986f85 Compare November 24, 2026 00:00
arul28 and others added 2 commits November 23, 2026 19:21
Follow-up to #2475 for the Windows sweep. `createTestDirectoryLink` builds a
directory link as a junction on Windows (no privilege needed) and a normal
directory symlink elsewhere; its link type comes from `path.sep` because some
tests simulate another OS by spying on `process.platform`. Every
directory-link fixture now uses it.

File symlinks still cannot be created on a non-elevated Windows host, so those
fixtures stay real on capable hosts and are guarded with
`it.skipIf(!symlinksSupported)`. Where the test also asserted things that need
no link, the non-link assertions were split into an unguarded test (or kept
before the guard) so they still run here. EPERM catch-and-continue in
registry and remoteMcpTools became explicit skips.

Fixtures fixed:
- diskFullIncident: symlink farm (file and directory links)
- adeActions/registry: chat-image link; artifact-store escape
- automationPlannerService / automationService: cwd escape links
- captureHelper: capture-directory file link; late-capture linked directory
- adeCliService: packaged agent-skills link
- computerUseArtifactBrokerService: artifact-store file link; symlinked import
- agentChatServiceHistory / agentChatServiceLifecycle: transcript links
- piSession: authorized-store escape link
- iosDeviceHub / iosSimulatorService: build-root links
- projectIconResolver: linked icon directory
- agentSkillRuntimeService: catalog alias and mirror-parent links
- cursorAgentSkillShim: nested skill link
- legacySkillCleanupService: recorded symbolic link
- storageInsightsService: cleanup link and linked parent
- syncHostService: artifact-store file link
- ade-cli compileCachePrune: junction link, capability skip instead of a win32 skip
- ade-cli remoteMcpTools: proof-folder links

Co-Authored-By: Claude Code <noreply@anthropic.com>
The refactor sent the capture test through a fresh helper with
`platform: process.platform`, which changed the delivery path on Linux CI and
stopped `onShot`/`onFailure` from firing. Restore the original test body and
guard only the file-symlink case; the late-capture directory link still uses a
junction on Windows.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@arul28
arul28 force-pushed the test/symlink-fixture-sweep branch from d986f85 to 07f8950 Compare November 24, 2026 00:21
@arul28
arul28 merged commit b0311da into main Nov 24, 2026
23 checks passed
@arul28
arul28 deleted the test/symlink-fixture-sweep branch November 24, 2026 00:22
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