Skip to content

fix: client, overlay, progress and server lifecycle defects - #5739

Merged
alexander-akait merged 4 commits into
mainfrom
claude/webpack-dev-server-pr-consolidation-t0k72z
Sep 18, 2026
Merged

alexander-akait merged 4 commits into
mainfrom
claude/webpack-dev-server-pr-consolidation-t0k72z

Conversation

@alexander-akait

@alexander-akait alexander-akait commented Sep 18, 2026

Copy link
Copy Markdown
Member

Summary

Consolidates the parts of @OskarEichler's open PRs that fix a real defect into one branch, co-authored with him.

Closes #5724
Closes #5725
Closes #5726
Closes #5727
Closes #5728
Closes #5729
Closes #5730
Closes #5732

The client-side defects are the ones worth naming, because each is now pinned by a browser test that fails on main: the linear progress bar rendered at 0px (its rules were keyed on #bar, which no template emits); client.progress: "linear" | "circular" was dropped by the resource-query parser, so the client reported Progress disabled; the indicator stayed faded out on every rebuild after the first; Escape stopped dismissing the overlay after one fix-then-break cycle, because invalid sends a DISMISS on every rebuild and that tore down the key handler for good; the overlay could not reopen under an enforced trusted-types policy name; and client.overlay.warnings/.errors filters decided only whether to open the overlay, not what it rendered.

Server-side: start() threw from an event handler instead of rejecting on an occupied port or IPC path, the bonjour protocol log was mis-parenthesised, findIp crashed on interfaces with a null cidr and handed listen() a bracketed IPv6 literal, and four examples/ configs no longer load or validate.

#5731 (glob watch rewrite) is not included — it rescans with globSync on every add event and still carries unresolved review findings on absolute-glob watch roots and ignored negation, so it is better judged on its own.

What kind of change does this PR introduce?

fix

Did you add tests for your changes?

Yes. Six new puppeteer cases in test/e2e/progress.test.js and test/e2e/overlay.test.js, each confirmed to fail against main's client and pass against this one. New test/client/overlay-lifecycle.test.js and test/server/find-ip.test.js; extended test/client/index.test.js, test/client/socket-helper.test.js, test/client/utils/createSocketURL.test.js, test/e2e/api.test.js, test/e2e/built-in-routes.test.js, test/e2e/host.test.js and the api/overlay snapshots.

Does this PR introduce a breaking change?

No.

If relevant, what needs to be documented once your changes are merged or what have you already documented?

webpack-dev-server/lib/servers/BaseServer.js is now a public export, so the webSocketServer.type docs can reference it directly. examples/app/hono and examples/proxy READMEs are updated in this PR.

Use of AI

Claude Code was used to review @OskarEichler's nine open PRs against the current sources, decide which changes fix a real defect, merge the accepted ones onto current main, write the browser coverage, and run the verification below. Every included change was checked against the code it touches, and the start()/listen() hunks were reworked by hand so cleanup failures cannot mask the startup error and a late server error is logged rather than crashing the process.

Verified locally: full lint (tsc, tsc client, eslint, prettier, cspell) clean; build:types reproduces the committed types/; test/client + test/server pass apart from two pre-existing IPv6 EAFNOSUPPORT failures that also fail on main. Each of the six new browser cases was run against a client built from main and from this branch, so the failure it catches is recorded rather than assumed. The overlay, progress, api, api-plugin, client, client-reconnect, built-in-routes, web-socket-*, bonjour, on-listening, port, ipc, setup-exit-signals, static-directory, watch-files, server, multi-compiler, allowed-hosts, app, compress, cross-origin-request, entry, headers, history-api-fallback, hot-and-live-reload, lazy-compilation, logging, mime-types, module-federation, options-middleware, range-header, setup-middlewares, static-public-path, stats and target e2e suites were run; their only failures reproduce identically on main (the sandbox has no IPv6 and no routable network address). All 50 examples/**/webpack.config.* load and validate against the schema (4 fail on main), and examples/default, app/hono, app/connect, api/middleware, setup-middlewares and watch-static were smoke-tested serving / and /.assets/*; the hono example's CORP behaviour was compared against the built-in middleware directly.


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Progress indicators now support linear and circular styles, with improved accessibility and reduced-motion support.
    • Added configurable Trusted Types policy naming for error overlays.
    • Exposed the BaseServer entry point for custom WebSocket server integrations.
  • Bug Fixes

    • Improved overlay filtering, focus handling, dismissal, and editor links.
    • Fixed socket credentials, reconnect limits, malformed queries, local IP detection, and startup cleanup.
    • Improved WebSocket lifecycle and proxy error handling.
  • Documentation

    • Updated examples for current middleware, app, proxy, server, and configuration APIs.

Consolidates the actionable fixes from #5724, #5725, #5726, #5727, #5728,
#5729, #5730 and #5732.

Client:

- honor `client.progress: "linear" | "circular"`; the resource query only
  recognized `"true"`, so both visual modes were silently disabled
- parse the resource query with full `key=value` semantics (encoded keys,
  `+` as space, `=` inside values, malformed escapes ignored)
- decode credentials taken from the current script tag so `formatURL` does
  not encode them twice
- apply `client.overlay.warnings` / `.errors` filter functions to what the
  overlay renders, not only to the decision to render
- apply the reconnect limit before the first connection attempt, so
  `client.reconnect: false` no longer retries when the socket never opens

Overlay:

- reuse the Trusted Types policy instead of re-creating it per open, which
  throws under a `trusted-types` CSP
- keep only the newest queued render so messages are not duplicated when
  two batches arrive before the iframe loads
- re-register the Escape handler on open; it was removed on first dismiss
  and never restored
- encode the `open-editor` file name, render openable entries as buttons,
  and restore focus on dismiss

Progress:

- style the linear bar through `#progress`; the rules targeted `#bar`,
  which no template emits
- clear the `disappear` class and the pending hide timer when a new build
  starts, so the indicator reappears
- skip redundant `attributeChangedCallback` work and expose progressbar
  ARIA state and reduced-motion styles

Server:

- reject from `start()` on an occupied port or IPC path instead of
  throwing from an event handler, and release what setup allocated
- fix `bonjour` protocol reporting (`||` bound tighter than the ternary)
- only install the WebSocket `upgrade` listener in no-server mode, and
  remove it on close
- skip incomplete interfaces and CIDRs in `findIp`, and hand the listening
  socket an unbracketed IPv6 address
- wait for pending startup before shutting down in plugin mode
- build the asset report from `toJson` with only the fields it prints,
  construct the `serve-index` middleware once, and serialize each
  broadcast once instead of per client
- export `BaseServer` and type `webSocketServer.type` as its constructor

Examples:

- repair `api/plugin` (CommonJS in an ESM package), `ipc` (`http-proxy`),
  `proxy` and `general/proxy-simple` (options removed in v5)
- serve the shared layout assets through `express.static`, which also works
  for the `hono` example, and read each README relative to its own directory
- restore host and cross-origin checks in the `hono` example, whose
  `setupMiddlewares` replaces the built-in stack

Co-authored-by: Oskar Eichler <62393985+OskarEichler@users.noreply.github.com>
@changeset-bot

changeset-bot Bot commented Sep 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9191d4a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
webpack-dev-server Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: d78529bb-357f-42db-aa3d-49ba42d54040

📥 Commits

Reviewing files that changed from the base of the PR and between 6a1ae76 and 3a27cbb.

📒 Files selected for processing (3)
  • .changeset/fix-client-and-server-defects.md
  • examples/app/hono/README.md
  • examples/app/hono/webpack.config.js
🚧 Files skipped from review as they are similar to previous changes (3)
  • examples/app/hono/webpack.config.js
  • .changeset/fix-client-and-server-defects.md
  • examples/app/hono/README.md

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


Walkthrough

This patch updates client progress, overlay, query parsing, socket credentials, and reconnect behavior. It updates server startup cleanup, networking, asset reporting, WebSocket handling, and plugin lifecycle behavior. It exposes BaseServer and expands related type declarations. Examples now use current middleware and server configuration patterns. Tests and snapshots cover the changed client, server, host, proxy, and overlay behavior.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 3a27c

No concrete merge-blocking risk remains in the supplied review evidence.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 26 files. (2 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR implements the coding objectives in all directly linked issues. [#5724] moves reconnect-limit handling before the first connection, filters mixed overlay messages, preserves socket query and cr…
Out of Scope Changes check ✅ Passed The changes remain within the linked issue scope. Client, overlay, progress, server, network, performance, export, example, documentation, test, snapshot, and changeset updates directly support [#5724
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main defect fixes across client behavior, overlay handling, progress indicators, and server lifecycle management. It is concise and specific.
Full details: Docstring Coverage

Explanation

Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 26 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 82a922f5-a745-4746-a23e-4df03d507e52

📥 Commits

Reviewing files that changed from the base of the PR and between 0368f7c and 6a1ae76.

📒 Files selected for processing (40)
  • .changeset/fix-client-and-server-defects.md
  • client-src/index.js
  • client-src/overlay.js
  • client-src/progress.js
  • client-src/socket.js
  • examples/.assets/layout.html
  • examples/.assets/style.css
  • examples/api/middleware/README.md
  • examples/api/middleware/webpack.config.js
  • examples/api/plugin/README.md
  • examples/api/plugin/webpack.config.js
  • examples/app/connect/README.md
  • examples/app/hono/README.md
  • examples/app/hono/webpack.config.js
  • examples/compression/false/README.md
  • examples/default-cjs/webpack.config.cjs
  • examples/dev-middleware/webpack.config.js
  • examples/general/proxy-simple/webpack.config.js
  • examples/general/universal-config/client.js
  • examples/headers/array/README.md
  • examples/ipc/webpack.config.js
  • examples/proxy/README.md
  • examples/proxy/webpack.config.js
  • examples/server/http2/README.md
  • examples/util.js
  • lib/Server.js
  • lib/servers/WebsocketServer.js
  • package.json
  • scripts/finalize-cjs-build.mjs
  • test/client/index.test.js
  • test/client/overlay-lifecycle.test.js
  • test/client/socket-helper.test.js
  • test/client/utils/createSocketURL.test.js
  • test/e2e/__snapshots__/api.test.js.snap.webpack5
  • test/e2e/__snapshots__/overlay.test.js.snap.webpack5
  • test/e2e/api.test.js
  • test/e2e/built-in-routes.test.js
  • test/e2e/host.test.js
  • test/server/find-ip.test.js
  • types/lib/Server.d.ts
💤 Files with no reviewable changes (1)
  • test/e2e/snapshots/api.test.js.snap.webpack5

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Comment thread .changeset/fix-client-and-server-defects.md Outdated
Comment thread examples/app/hono/webpack.config.js
alexander-akait and others added 3 commits September 18, 2026 12:27
- the example's cross-origin middleware must return early for a valid
  host, matching the built-in one; it was tagging every response with
  `Cross-Origin-Resource-Policy: same-origin`
- bump `minor`: exporting `BaseServer` adds public API

Co-authored-by: Oskar Eichler <62393985+OskarEichler@users.noreply.github.com>
Six puppeteer cases, each verified to fail against main's client:

- linear progress renders a 4px green bar (main: 0px — the rules were
  keyed on `#bar`, which no template emits) and reports itself enabled
  in the startup banner (main: "Progress disabled")
- circular progress renders the ring and its ARIA state
- the indicator comes back on a later rebuild instead of staying faded
- Escape dismisses a second overlay: `invalid` fires a DISMISS on every
  rebuild, so on main the first fix-then-break cycle tore down the key
  handler for the rest of the session
- the overlay reopens under an enforced `trusted-types` policy name,
  where asking for the same name twice is a TypeError
- a warning filter decides what the overlay renders, not just whether
  it opens

Co-authored-by: Oskar Eichler <62393985+OskarEichler@users.noreply.github.com>
The 100ms sweep terminates a client that has not ponged yet, and a
compilation can block the event loop for longer than that, so a healthy
client was dropped before the `ok` stats message reached it. Seen on the
macOS Node 24 shard; the same file was stabilized for neighbouring races
in #5733. Wait for the build to settle before connecting.

Co-authored-by: Oskar Eichler <62393985+OskarEichler@users.noreply.github.com>
@alexander-akait
alexander-akait merged commit f478882 into main Sep 18, 2026
53 checks passed
@alexander-akait
alexander-akait deleted the claude/webpack-dev-server-pr-consolidation-t0k72z branch September 18, 2026 13:15
@codecov

codecov Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.50820% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.29%. Comparing base (2317bf9) to head (9191d4a).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
client-src/progress.js 0.00% 40 Missing ⚠️
client-src/index.js 82.50% 7 Missing ⚠️
lib/Server.js 96.62% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5739      +/-   ##
==========================================
+ Coverage   89.38%   90.29%   +0.90%     
==========================================
  Files          13       13              
  Lines        6169     6241      +72     
==========================================
+ Hits         5514     5635     +121     
+ Misses        655      606      -49     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant