Skip to content

console: bump msw to 3 - #39684

Merged
leedqin merged 4 commits into
MaterializeInc:mainfrom
leedqin:console-msw-3
Nov 10, 2026
Merged

leedqin merged 4 commits into
MaterializeInc:mainfrom
leedqin:console-msw-3

Conversation

@leedqin

@leedqin leedqin commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

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/interceptors 0.45.11.

  • onUnhandledRequest is renamed to onUnhandledFrame. msw 3 ignores the old name at runtime, so keeping it would let unhandled requests reach the real network instead of erroring. vitest.setup.ts uses the new name.

  • Test server: msw 3 mocks Node's fetch at 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 with fetch failed. That made a few tests flaky under CI load.

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

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.
@leedqin
leedqin marked this pull request as ready for review October 8, 2026 20:21
@leedqin
leedqin requested a review from a team as a code owner October 8, 2026 20:21
@leedqin
leedqin requested a review from jdonelson October 8, 2026 20:21
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.
@leedqin
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.
@leedqin
leedqin merged commit e2cb0d2 into MaterializeInc:main Nov 10, 2026
83 checks passed
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)
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.

2 participants