Repository navigation
console: bump msw to 3 - #39684
Merged
Merged
console: bump msw to 3#39684
Conversation
msw 3 keeps the declared body type through request.clone(), so handlers that destructure the SQL request body declare it, and HttpResponse is generic, so pending handlers resolve a plain Response. onUnhandledRequest is renamed to onUnhandledFrame. AlterClusterModal's close assertion now waits, since msw 3 responds a few ticks later.
msw 3's Node fetch interception mocks undici's sockets. After an aborted request undici opens a socket it never writes to, msw passes it through to the real network, and the next fetch reuses it and fails with "fetch failed". Patch fetch directly instead, and hold the DatabaseDetails spinner request open.
def-
approved these changes
Nov 6, 2026
leedqin
enabled auto-merge (squash)
November 10, 2026 16:16
# Conflicts: # console/package.json # console/src/platform/clusters/AlterClusterModal.test.tsx # console/yarn.lock
mswjs/interceptors#863 was closed unmerged. msw's maintainer expects nodejs/undici#5982, released in undici 8.12.3, to fix the post-abort reconnect leak once our Node bundles it.
This was referenced Nov 10, 2026
leedqin
added a commit
that referenced
this pull request
Nov 11, 2026
### Motivation `console/package.json` declares `"node": ">=20.12.2"`, but the installed dependency tree no longer runs there. Checking every installed package's `engines.node` against candidate versions: | Node | Packages whose `engines.node` rejects it | |---|---| | 20.12.2 | 60 (jsdom's CSS packages, …) | | 20.19.0 | 18 (`@mswjs/interceptors` 0.45, `@rolldown/plugin-babel`, `@testing-library/jest-dom` 7, `eslint-plugin-unicorn` 79, …) | | 22.12.0 | 25 (`@eslint/*` needs 22.13, …) | | 22.18.0 | 7 (`node-gyp` 13, `which` 7, `abbrev` 5, `nopt` 10, `lint-staged` 17, `undici` 8.12, …) | | 24.11.0 | 5 (`node-gyp` 13 and its helpers) | | 22.22.2, 24.15.0, 26.0.0 | none | msw 3 (#39684) and kysely 0.29 (#40550) both deferred this change to #39683, which is still open. ### Description `engines.node` becomes `^22.22.2 || ^24.15.0 || >=26.0.0`, the intersection of every installed package's range. Volta (26.10.0), `console/Dockerfile` and CI already run Node 26. It is the same range as #39683, so that PR merges cleanly on this line. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Supersedes #39655. Dependabot's version of this bump fails typecheck and several unit tests.
Description
msw is only used by tests. The lockfile resolves msw 3.0.4 and
@mswjs/interceptors0.45.11.onUnhandledRequestis renamed toonUnhandledFrame. msw 3 ignores the old name at runtime, so keeping it would let unhandled requests reach the real network instead of erroring.vitest.setup.tsuses the new name.Test server: msw 3 mocks Node's
fetchat the socket level (undici). When a test aborts an in-flight request, undici opens a replacement socket it never writes to. msw passes that idle socket through to the real network, and the next fetch can reuse it and fail withfetch failed. That made a few tests flaky under CI load.src/api/mocks/server.tsnow builds the server with msw'sdefineNetworkand the interceptor that patchesfetchdirectly, so mocked requests never touch undici.setupServeragain once our Node bundles undici 8.12.3. fix(fetch): intercept fetch on fetch level mswjs/interceptors#863, the interceptor-side fix, was closed unmerged, and msw's maintainer expects fix(pool): keep caller async context for queued requests nodejs/undici#5982 to fix this instead. As of v26.13.0, no Node 26 release bundles it.msw 3 requires Node 22.12 or later. CI and the Volta pin run Node 26, and #39683 updates
engines.node.Verification
Existing tests, plus five consecutive full-suite runs on Node 26 (CI's Node version) with no failures.
🤖 Generated with Claude Code