Skip to content

fix: make local:gate pass on Windows, verified by a new Windows CI job (#2748) - #2906

Merged
cliffhall merged 5 commits into
v2/mainfrom
v2/fix/2748-windows-gate
Nov 5, 2026
Merged

cliffhall merged 5 commits into
v2/mainfrom
v2/fix/2748-windows-gate

Conversation

@cliffhall

Copy link
Copy Markdown
Member

Closes #2748

Summary

The local gate could not pass on Windows. This PR fixes or skips the failing cases, fixes the scripts' entry guard, and adds a Windows CI job so the result is checked on a real Windows runner, not just asserted from macOS.

How this was verified on Windows

The work was done on macOS, so all Windows verification comes from the new windows job in main.yml. It runs test:scripts, coverage:web and coverage:mcpdo on windows-latest. Green run on this branch: https://github.com/modelcontextprotocol/inspector/actions/runs/41986616591 (job time 12m03s).

Stage on Windows Before After
test:scripts hung until the job timeout (43 min), plus 18 failures 1104 tests: 1090 pass, 14 skipped, 0 fail
coverage:web 33 failures in 5 files 9848 tests: 9816 pass, 32 skipped; per-file thresholds pass
coverage:mcpdo 76 failures in 14 files 563 tests: 436 pass, 127 skipped; thresholds dropped on win32 only (see below)

npm run local:gate on macOS is green, so nothing regressed on POSIX. Every skip is win32-only, so POSIX runs keep every case and the coverage it carries.

Entry guard

scripts/lib/main-module.mjs adds isMainModule(). It compares import.meta.url with pathToFileURL(argv[1]).href, replacing the file://${argv[1]} guard in all 21 scripts. That guard never matched on Windows, so npm run board:add and similar commands exited 0 having printed nothing. The platform is injectable, so the sibling main-module.test.mjs pins a Windows argv[1] (and a path with a space) on every host. Credit to @laoyyu, whose comment on the issue diagnosed this and supplied the helper shape and the cases.

Fixed (not skipped)

  • win-shell-args: an empty argument was dropped by cmd.exe, so node -e "" became node -e, which exits 9. This was behind 6 gate-lease failures and is a real bug in the helper. It is now quoted as "".
  • board-snapshot / board-recover: 438 !== 384 turned out to be file modes (0o666 vs 0o600), not LF byte counts. Only the 0600 assertion is POSIX-gated; the rest of each test runs on Windows.
  • install-clients: the npm-version probe now runs under the same environment as the premise it gates. On Windows the npm.cmd shim picks its CLI from npm_config_*-steered state that the stripped env deletes, so the probe and the run could resolve different npms.
  • skill-eval: the arg-list tests pin the platform (quoting has its own suite), and the env test looks PATH up case-insensitively (Windows spells it Path).
  • verify-dep-lockstep main tests: the fixture now uses realpathSync.native. The JS realpathSync keeps 8.3 short names (RUNNER~1) while TypeScript expands them, so every installed file read as out-of-repo.
  • file-secret-store: the read-failure cases now put a directory at the secrets path (EISDIR on every platform). The old path-under-a-file setup was ENOTDIR on POSIX but ENOENT ("no file yet") on Windows.
  • mcpdo: separator- and JSON-escape-agnostic assertions in agent-help, daemon-private and mcp-coverage. mcp-coverage's teardown no longer passes one failed rmSync on to every later test.

Skipped on win32, by name, with the reason at the site

  • test:scripts (3): gate-lease's ENOENT case (with shell: true a missing command is cmd's exit 1), and the SIGTERM/SIGQUIT tree-stop cases. The latter rely on POSIX process groups; on Windows kill() left the grandchildren holding the stderr pipe, which is what hung the whole run.
  • coverage:web (30): chmod 0o555 unwritable-directory rollback cases (node-persistence 7, oauth-secret-split 4, servers-route 3), POSIX mode-bit assertions (file-secret-store 3), and in secret-store-selection (13) the isOnMountPoint Linux-container cases plus the descriptor cases whose caveat sits behind mode bits.
  • coverage:mcpdo (127): the suites that need a live daemon or a Unix socket file, plus the POSIX-only path, 0700 and exec-bit cases. The reason is stated once in clients/mcpdo/__tests__/helpers/platform.ts, and each site points to it.

mcpdo coverage thresholds on Windows

With the daemon suites skipped, the daemon modules fall below 90 on Windows. That reflects the skip, not the code. clients/mcpdo/vitest.config.ts therefore drops the thresholds on win32 only: coverage is still collected there, the Linux coverage job stays the authoritative per-file gate, and every POSIX local:gate still enforces it. Web's thresholds hold on Windows and stay enforced there.

CI job

windows is an ordinary job (no credentials, so moving major tags). Each stage runs even if the one before it failed, so every stage gets its own verdict. timeout-minutes: 45 is marked provisional until there are observed runs to size it from. It is documented in docs/quality-gate.md. No verify:* guard needed changes: workflow-gate only forbids local:* and non-Chromium engine passes, and verify:action-pins only checks credentialed jobs.

🤖 Generated with Claude Code

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The npm and container publication jobs do not depend on the new Windows job, allowing releases to proceed even when Windows checks fail.

1 open issue
What changed in this PR

This PR addresses #2748 by fixing Windows-specific failures in Inspector’s local quality gate and adding Windows CI coverage for the three affected stages.

Changes:

  • Adds portable script entry-point detection and preserves empty Windows shell arguments.
  • Adapts test fixtures and assertions for Windows, with documented skips for POSIX-only cases.
  • Adds a Windows CI job and documents platform-specific coverage enforcement.
File Description
scripts/​verify-dep-lockstep.main.test.mjs Resolves fixture paths using native realpath.
scripts/​skill-eval.test.mjs Makes argument and PATH assertions platform-aware.
scripts/​sdk-watch.mjs Uses the portable entry guard.
scripts/​release-tag.mjs Uses the portable entry guard.
scripts/​release-notes.mjs Uses the portable entry guard.
scripts/​pr-upload-screenshot.mjs Uses the portable entry guard.
scripts/​pr-review-wait.mjs Uses the portable entry guard.
scripts/​pr-review-request.mjs Uses the portable entry guard.
scripts/​pr-review-fetch.mjs Uses the portable entry guard.
scripts/​pr-link-issue.mjs Uses the portable entry guard.
scripts/​lib/​win-shell-args.test.mjs Tests preservation of empty arguments.
scripts/​lib/​win-shell-args.mjs Quotes empty Windows shell arguments.
scripts/​lib/​main-module.test.mjs Tests entry detection across platform path formats.
scripts/​lib/​main-module.mjs Adds shared URL-based entry detection.
scripts/​install-clients.test.mjs Aligns the npm probe environment with the test.
scripts/​gate-lease.test.mjs Adapts failure assertions and skips POSIX signal cases.
scripts/​dependency-refresh.mjs Uses the portable entry guard.
scripts/​dependabot-alerts.mjs Uses the portable entry guard.
scripts/​dco-check.mjs Uses the portable entry guard.
scripts/​board-sweep.mjs Uses the portable entry guard.
scripts/​board-snapshot.test.mjs Limits permission-bit assertions to POSIX.
scripts/​board-snapshot.mjs Uses the portable entry guard.
scripts/​board-recover.test.mjs Limits permission-bit assertions to POSIX.
scripts/​board-recover.mjs Uses the portable entry guard.
scripts/​board-draft-find.mjs Uses the portable entry guard.
scripts/​board-card-status.mjs Uses the portable entry guard.
scripts/​board-card-delete.mjs Uses the portable entry guard.
scripts/​board-card-add.mjs Uses the portable entry guard.
scripts/​board-audit.mjs Uses the portable entry guard.
scripts/​advisory-fork.mjs Uses the portable entry guard.
scripts/​action-pin-resolve.mjs Uses the portable entry guard.
docs/​quality-gate.md Documents Windows CI coverage, skips, and timeout.
clients/​web/​src/​test/​integration/​storage/​oauth-secret-split.test.ts Skips chmod-dependent rollback cases on Windows.
clients/​web/​src/​test/​integration/​mcp/​remote/​servers-route.test.ts Skips chmod-dependent disk-failure cases on Windows.
clients/​web/​src/​test/​integration/​auth/​node/​secret-store-selection.test.ts Skips POSIX-dependent mount and descriptor cases.
clients/​web/​src/​test/​integration/​auth/​node/​file-secret-store.test.ts Uses directory blockers and skips POSIX mode assertions.
clients/​web/​src/​test/​core/​client/​node-persistence.test.ts Skips chmod-dependent rollback cases on Windows.
clients/​mcpdo/​vitest.config.ts Disables coverage thresholds on Windows only.
clients/​mcpdo/​__tests__/​skills-budget-hint.test.ts Skips daemon-dependent tests on Windows.
clients/​mcpdo/​__tests__/​resolve-command.test.ts Skips POSIX executable-resolution cases on Windows.
clients/​mcpdo/​__tests__/​rate-limit-envelope.test.ts Skips daemon-dependent tests on Windows.
clients/​mcpdo/​__tests__/​mcp-elicitation.test.ts Skips daemon-dependent elicitation tests on Windows.
clients/​mcpdo/​__tests__/​mcp-coverage.test.ts Adjusts skips, teardown state, and escaped-path assertions.
clients/​mcpdo/​__tests__/​mcp-connection.test.ts Skips daemon-dependent connection tests on Windows.
clients/​mcpdo/​__tests__/​load.test.ts Skips the daemon-backed load suite on Windows.
clients/​mcpdo/​__tests__/​helpers/​platform.ts Centralizes the Windows skip condition and rationale.
clients/​mcpdo/​__tests__/​elicitation-client.test.ts Skips socket-dependent elicitation tests on Windows.
clients/​mcpdo/​__tests__/​directory-read.test.ts Skips daemon-dependent directory tests on Windows.
clients/​mcpdo/​__tests__/​daemon-stream.test.ts Skips socket-dependent streaming tests on Windows.
clients/​mcpdo/​__tests__/​daemon-private.test.ts Accepts Windows separators and skips daemon integration cases.
clients/​mcpdo/​__tests__/​daemon-paths.test.ts Skips Unix-path and POSIX-permission cases on Windows.
clients/​mcpdo/​__tests__/​daemon-coverage.test.ts Skips daemon-dependent suites on Windows.
clients/​mcpdo/​__tests__/​agent-help.test.ts Makes skill-path assertions separator-independent.
.github/​workflows/​main.yml Adds Windows script, web coverage, and mcpdo coverage checks.

Review effort: Balanced

Comment thread .github/workflows/main.yml Resolved
@cliffhall
cliffhall requested a balanced review from Copilot November 5, 2026 07:53
@cliffhall

Copy link
Copy Markdown
Member Author

Copilot round 1, one finding:

  • Release jobs did not depend on windows. Fixed in 2d53644: package and publish-github-container-registry now have needs: [build, coverage, windows], and docs/publishing.md is updated. Replied in the thread.

Round 2 requested.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The review records no active issues with the Windows portability changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@cliffhall

Copy link
Copy Markdown
Member Author

Copilot review loop closed: round 2 was clean (no inline comments, nothing suppressed, headline "No open issues"), and the loop stops on the first clean round. 2 rounds in total; the single round-1 finding is fixed in 2d53644.

cliffhall and others added 5 commits November 5, 2026 03:09
- scripts/lib/main-module.mjs: isMainModule() compares import.meta.url
  against pathToFileURL(argv[1]), replacing the file://${argv[1]} guard
  that never matched on Windows in 21 scripts (diagnosis and helper shape
  from the issue's commenter).
- win-shell-args: quote an empty argument instead of dropping it, so
  node -e "" survives cmd.exe.
- gate-lease tests: skip the ENOENT and POSIX process-group signal cases
  on win32 by name; match the synchronous spawn failure as a TypeError.
- board-snapshot/board-recover tests: assert 0600 only off Windows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: cliffhall <[email protected]>
test:scripts
- install-clients: probe npm under the env the premise runs it under.
- skill-eval: pin the platform where the arg list is the subject; look
  PATH up case-insensitively.
- verify-dep-lockstep main: realpathSync.native for the fixture, so 8.3
  short names agree with TypeScript's realpath.

coverage:web
- file-secret-store: a directory at the secrets path (EISDIR) instead of
  a path under a file, which is ENOENT on Windows.
- Skip on win32 by name: chmod-unwritable rollback cases, POSIX mode-bit
  assertions, and isOnMountPoint's Linux-container cases.

coverage:mcpdo
- Skip the daemon / Unix-socket suites on win32 (helpers/platform.ts),
  plus POSIX-only path, 0700 and exec-bit cases.
- Separator- and JSON-escape-agnostic assertions; stop mcp-coverage's
  teardown cascading a failed rmSync into later tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: cliffhall <[email protected]>
…the job (#2748)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: cliffhall <[email protected]>
Copilot: package and publish-github-container-registry needed only build
and coverage, so a release could publish with the Windows job red.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: cliffhall <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Issues and PRs for v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

local:gate cannot pass on Windows — pre-existing failures in test:scripts, coverage:web and coverage:mcpdo

2 participants