Repository navigation
Conversation
Creating a directory symlink on Windows requires Administrator privileges or Developer Mode, so the cycle setup in this integration test fails with EPERM for contributors who have neither. A junction needs no elevation, and lstat() still reports it as a symbolic link, so the cycle itself is unchanged. Refs modelcontextprotocol#3117
|
@modelcontextprotocol/client
@modelcontextprotocol/codemod
@modelcontextprotocol/core
@modelcontextprotocol/server
@modelcontextprotocol/server-legacy
@modelcontextprotocol/express
@modelcontextprotocol/fastify
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
|
Read the diff. I couldn't run it here (no Node in my scratch environment), so this is from the Node docs and the test source. The change looks right. Per the One thing to check is the cycle itself. A junction target must be an absolute directory (Node resolves it for you). |
|
Thanks — both are answerable from the code, and you are right to ask rather than take the PR body at face value. On the cycle guard (your last question): it is neither Did the Windows run reach the assertion? Yes. That test has no platform skip, and if fast-glob had followed the junction the walk would not terminate — it would hang rather than pass. It passes as one of 645 in Absolute target: On the ternary: agreed it is cosmetic, since One clarification for anyone reading later: the pre-change Windows failure is EPERM during setup, not a failed assertion — so "reverting makes it fail" alone does not prove coverage. The hang argument above is the actual evidence that the Windows run exercises the guard. |
|
Thanks, that settles it. One follow-up on that: if the guard ever regressed, this test would hang until the runner kills it rather than fail on |
|
Verified rather than guessed, and the answer is the worse of your two options. Neither config sets a timeout: One mitigating detail. The Worth being explicit: this gap predates the PR and is orthogonal to it — the change does not introduce or worsen it. Before the change the test did not even reach the assertion on Windows (it failed in setup with EPERM), so this PR is strictly an improvement in coverage on that platform. Fixing the bound itself would mean either |
|
That settles it, thanks for tracing both walkers: a sync walk can't be interrupted by a vitest timer, so the only real bound is the job limit, and I agree it is orthogonal to this PR. Of the two paths, I'd put the fast-glob one first for a follow-up since |
|
Windows data point on the "it would hang" question, since I reported #3117 and tested the same change locally (Windows 11, Developer Mode off, Node 24.11.1). I ran the mutation: So on Windows a regression in the fast-glob guard shows up as a normal assertion failure, and the mutation proves the test exercises the guard. Before the change it never got past the EPERM. |
|
Thanks, this is the more useful result: the mutation fails on |
@arhancanli this question got me curious, so I wrote a small script to test it. Short answer: it changes. With a second junction pointing at the first, it drops to 32. The script works outside the codemod: it builds the cycle and runs
So it's the reparse point count, not path length: 63 per path. Levels 0–63 are exactly the 64 files the mutation found, and |
|
63 per path, and two reparse points per level giving 31 (levels 0 to 31 would be 32 files, so the drop from 64 to 32 fits) is a clean result; the long-name control rules out path length, which was the other obvious suspect. Thanks for running it. Practical consequence for the test: if it asserts |
|
On the count reaching 64: worth separating where that number can be seen. The mutation ( So yes, I think the assertion is worth one line saying where 64 comes from — 63 resolved levels plus the one that fails, which is why a second junction halves it — and it costs nothing behaviorally. I have not added it to this branch yet: if you would rather see it here than in a follow-up, say so and I will push it as a separate commit; otherwise I will leave this PR as the Windows fix it is and take it up when that test is next touched. On the second question, I cannot answer for windows-latest from here beyond that reasoning — the only Windows box I have is the one in the thread. |
|
Pushed as 76c6846 — a short comment above the |
Motivation and Context
packages/codemod/test/v1-to-v2/packageJsonUpdater.test.tscreates a directory cycle withsymlinkSync(dir, path.join(dir, 'src', 'loop'), 'dir').On Windows, creating a
dirsymlink requires Administrator privileges or Developer Mode, so the test fails during setup withEPERM: operation not permitted, symlinkfor contributors who have neither. Ajunctionneeds no elevation, andlstat().isSymbolicLink()still returnstruefor it, so the cycle — and the test's intent — is preserved.This addresses the symlink case of #3117 only. The CRLF case is handled separately in #3120; the POSIX signal case is untouched.
How Has This Been Tested?
Windows 11, Node 22, Developer Mode off:
symlinkSync(..., 'dir')→EPERM: operation not permitted, symlinksymlinkSync(..., 'junction')→ succeeds,lstatSync(link).isSymbolicLink() === trueIn
packages/codemod:pnpm test→ 645 passedsymlink cyclecase fail, confirming the test exercises this pathpnpm run typecheckandeslintpass; prettier content check passes for this file (the repo-wide CRLF formatting noise from [v2] Test suite fails on Windows: 3 independent causes (CRLF checkout, symlink EPERM, POSIX signals) #3117 is unrelated to this change)Types of changes