From 12b159c1097f6e3440b495d88bc3c4b4e58b9cbf Mon Sep 17 00:00:00 2001 From: laoyyu Date: Thu, 29 Oct 2026 18:32:35 +0800 Subject: [PATCH 1/2] fix(codemod): use a junction for the symlink cycle test on Windows 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 #3117 --- packages/codemod/test/v1-to-v2/packageJsonUpdater.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/codemod/test/v1-to-v2/packageJsonUpdater.test.ts b/packages/codemod/test/v1-to-v2/packageJsonUpdater.test.ts index 75bd4877d0..de6882a09a 100644 --- a/packages/codemod/test/v1-to-v2/packageJsonUpdater.test.ts +++ b/packages/codemod/test/v1-to-v2/packageJsonUpdater.test.ts @@ -232,7 +232,9 @@ describe('run() manifest integration', () => { "import { Client } from '@modelcontextprotocol/sdk/client/index.js';\nexport { Client };\n" ); // A cycle: src/loop -> the project root. - symlinkSync(dir, path.join(dir, 'src', 'loop'), 'dir'); + // Creating a 'dir' symlink on Windows requires admin rights or + // Developer Mode; a junction does not and still forms the cycle. + symlinkSync(dir, path.join(dir, 'src', 'loop'), process.platform === 'win32' ? 'junction' : 'dir'); const result = run(v1ToV2Migration, { targetDir: dir, dryRun: false }); From 76c6846a3c0e1270d4a517d805ac0a4e4fbfdcdc Mon Sep 17 00:00:00 2001 From: laoyyu Date: Tue, 3 Nov 2026 17:39:55 +0800 Subject: [PATCH 2/2] test(codemod): note the provenance of the 64-entry mutation count --- packages/codemod/test/v1-to-v2/packageJsonUpdater.test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/codemod/test/v1-to-v2/packageJsonUpdater.test.ts b/packages/codemod/test/v1-to-v2/packageJsonUpdater.test.ts index de6882a09a..6f45c7c9b6 100644 --- a/packages/codemod/test/v1-to-v2/packageJsonUpdater.test.ts +++ b/packages/codemod/test/v1-to-v2/packageJsonUpdater.test.ts @@ -239,6 +239,9 @@ describe('run() manifest integration', () => { const result = run(v1ToV2Migration, { targetDir: dir, dryRun: false }); // The symlinked re-entry must not be followed: exactly one source file seen. + // (If the guard ever regressed, a manual mutation run on Windows would report 64 + // entries here — 63 resolvable reparse-point levels plus the one that fails — and + // a second nested junction would halve the count to 32.) expect(result.fileResults.map(fr => fr.filePath)).toHaveLength(1); expect(result.packageJsonChanges?.[0]?.applied).toBe(true); expect(result.packageJsonChanges?.[0]?.removed).toEqual(['@modelcontextprotocol/sdk']);