Skip to content

fix: honor client reconnect, overlay and URL configuration - #5724

Closed
OskarEichler wants to merge 3 commits into
webpack:mainfrom
OskarEichler:codex/honor-client-configuration
Closed

OskarEichler wants to merge 3 commits into
webpack:mainfrom
OskarEichler:codex/honor-client-configuration

Conversation

@OskarEichler

@OskarEichler OskarEichler commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Apply reconnect limits before the first successful connection, including zero/false.
  • Send only matching errors and warnings to the overlay when a predicate filters a mixed batch.
  • Preserve embedded equals signs, plus/space semantics, encoded query keys, and current-script credentials.
  • Recognize linear/circular progress modes and declare the already-supported public progress and Trusted Types options.

The existing API-origin test now asserts that reconnect: false produces no retry and its snapshot reflects the intended behavior. Focused regressions also cover the initial zero-retry path, mixed overlay predicates, query parsing, and credential encoding.

Compatibility

No package, engine, peer, or public API removals. Disabled reconnects now remain disabled on initial failure; filtered messages stay hidden; socket credentials produce correctly encoded URLs.

Verification

  • Package build passes
  • Client index tests: 14 passed
  • Socket helper tests: 4 passed
  • Socket URL tests: 47 passed
  • Focused API-origin browser test passes with local Chrome
  • Full lint suite passes: ESLint, Prettier, TypeScript (server/client), and spelling
  • Changeset validation and git diff --check pass

Type: fix

Summary by CodeRabbit

  • New Features
    • Added linear and circular progress indicator options.
    • Added support for configuring a Trusted Types policy for the client overlay.
  • Bug Fixes
    • Improved reconnection-limit handling, including disabling retries when set to zero.
    • Preserved and correctly decoded credentials in socket URLs.
    • Improved query-parameter parsing, including malformed and valueless parameters.
    • Ensured overlay notifications display only messages approved by configured filters.
  • Documentation
    • Updated client configuration types and inline documentation for the new options.

@changeset-bot

changeset-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 160523d

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 Patch

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

@OskarEichler
OskarEichler marked this pull request as ready for review August 30, 2026 09:58
@OskarEichler

Copy link
Copy Markdown
Contributor Author

Resolved the draft blocker and added focused regressions for the touched behavior. The API-origin test now asserts that reconnect: false does not retry, and its snapshot no longer expects the incorrect reconnect log. I also added coverage for initial zero-retry handling, mixed overlay filters, encoded query keys/plus/equals semantics, and current-script credentials. Build, all focused tests, the browser E2E case, and the full lint/type/format/spelling suite pass. I’ve marked the PR ready for review.

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9a10d457-9e97-47ea-8cb0-bb7b59c63148

📥 Commits

Reviewing files that changed from the base of the PR and between c89f3b1 and 160523d.

📒 Files selected for processing (3)
  • client-src/index.js
  • test/client/index.test.js
  • test/e2e/api.test.js
🚧 Files skipped from review as they are similar to previous changes (3)
  • test/client/index.test.js
  • client-src/index.js
  • test/e2e/api.test.js

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


Walkthrough

The client now accepts "linear" and "circular" progress modes. It parses encoded query keys, values, and credentials more consistently. Overlay handlers forward filtered warnings and errors. Socket initialization applies reconnect limits before connection callbacks run. Type declarations and tests cover the updated configuration, URL handling, overlay filtering, and reconnect behavior.

Merge Risk: ⚪ Minimal · up to 16052

This PR corrects reconnect limits, overlay filtering, URL parsing and credential encoding, and supported progress configuration behavior; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: fixes to client reconnect, overlay, and URL configuration handling.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 8 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

client-src/index.js

ESLint failed to execute (timeout).

test/client/index.test.js

ESLint skipped: the matched ESLint configuration already failed (timeout).

test/e2e/api.test.js

ESLint skipped: the matched ESLint configuration already failed (timeout).


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: Pro Plus

Run ID: 6e254f9d-5356-4b96-821a-17d5f6514584

📥 Commits

Reviewing files that changed from the base of the PR and between f804962 and c89f3b1.

📒 Files selected for processing (10)
  • .changeset/honor-client-configuration.md
  • client-src/index.js
  • client-src/socket.js
  • lib/Server.js
  • test/client/index.test.js
  • test/client/socket-helper.test.js
  • test/client/utils/createSocketURL.test.js
  • test/e2e/__snapshots__/api.test.js.snap.webpack5
  • test/e2e/api.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 client-src/index.js Outdated
Comment thread test/e2e/api.test.js
alexander-akait added a commit that referenced this pull request Sep 18, 2026
* fix: client, overlay, progress and server lifecycle defects

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>

* fix: address review on the hono example and changeset bump

- 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>

* test: cover the client fixes in a real browser

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>

* test: stop the heartbeat case racing its own compilation

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>

---------

Co-authored-by: Oskar Eichler <62393985+OskarEichler@users.noreply.github.com>
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