Skip to content

fix(client): read autoConnect off the query like every other boolean - #2456

Merged
alexander-akait merged 1 commit into
mainfrom
fix/autoconnect-query-parsing
Oct 3, 2026
Merged

alexander-akait merged 1 commit into
mainfrom
fix/autoconnect-query-parsing

Conversation

@alexander-akait

@alexander-akait alexander-akait commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

What

autoConnect was the one boolean on the client's query read with === "true". Every other one is read with !== "false".

options.autoConnect = overrides.autoConnect === "true";   // before
options.autoConnect = overrides.autoConnect !== "false";  // after
query before after
?autoConnect=1 off on
?autoConnect=false off off
?hot=1 on on

The default is already on, so turning it off is the only thing anyone writes this option for — which makes the odd reading a trap rather than a stricter policy: a value it did not recognise silently disconnected the client.

Why the existing test could not catch it

There was already a ?autoConnect=false case, and both readings treat that identically. The difference lives entirely in the values neither recognises, so the bug sat behind passing coverage.

Two tests now, one per half. I checked the first against the old reading before trusting it — reverted the parser, rebuilt the client, and it failed on the =1 case while the =false case kept passing. Without that it would be decoration.

Severity, stated plainly

autoConnect arrived after 8.3.0, so it is unreleased: nobody has hit this in a published version. A patch to unreleased code rather than a fix for anyone in the field.

Verified

  • npm run lint — clean (eslint, prettier, cspell, tsc, client types, schema-check)
  • unit — 7135 passed, 21 suites
  • e2e — 169 passed, 14 suites

Worth knowing for anyone reviewing a client change: client/ is a build output compiled from client-src/ by babel client-src -d client, and the browser tests bundle client/. pretest only lints, so a direct jest test/e2e after editing client-src runs the previous client until npm run build:client.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UjuMAuk9o6UazjHzcAQCTA


Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • The autoConnect query parameter now disables auto-connection only when set to false. Values such as 1 enable it.
    • Added browser tests covering connection behavior and update rendering for these query values.

It tested `=== "true"` where the rest of them test `!== "false"`, so a
value it did not recognise turned the client off:

    ?autoConnect=1   -> was off, is now left on
    ?hmr=1           -> left on, as it always was
    ?autoConnect=false -> off, unchanged

The default is already on, so turning it off is the only thing anyone
writes this option for — which makes the odd reading a trap rather than a
stricter policy.

The existing coverage could not catch it: it only used `autoConnect=false`,
which both readings treat the same way. Two tests now, one for each half,
and the first was checked against the old reading to be sure it fails
there.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UjuMAuk9o6UazjHzcAQCTA
@changeset-bot

changeset-bot Bot commented Oct 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a763e12

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

@coderabbitai

coderabbitai Bot commented Oct 2, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: ce747ae3-6cbc-4207-b3a4-8ed1e15d76d8

📥 Commits

Reviewing files that changed from the base of the PR and between ad64775 and a763e12.

📒 Files selected for processing (3)
  • .changeset/autoconnect-query-parsing.md
  • client-src/index.js
  • test/e2e/client.test.js

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


Walkthrough

The client now treats only the exact autoConnect=false query value as disabling auto-connection. End-to-end tests cover a value of 1, which allows a client to connect and render an update, and a value of false, which prevents a connection. A patch changeset records the change.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to a763e

No actionable merge-blocking risk remains: the default behavior is preserved, and the query cases are covered.

Architecture Summary

Architecture risk: 🔵 Low · up to a763e

The change affects 2 systems.

Changed systems: client-src, test

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — client-src (service) was modified; 1 changed file maps to changed impact.
  • observed — test (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in client-src/index.js: autoConnect now remains enabled for any supplied value except "false"; previously, it was enabled only when the value was exactly "true".
  • observed — Modified behavior in test/e2e/client.test.js: Adds a test that an unrecognized autoConnect value (1) leaves the client connected and able to apply an update from v1 to v2.
  • observed — Modified behavior in test/e2e/client.test.js: Adds a test that autoConnect=false prevents a connection while the initial app remains rendered.
  • observed — Modified behavior in .changeset/autoconnect-query-parsing.md: Adds a patch changeset for webpack-dev-middleware and a note describing the autoConnect query-parsing discrepancy and its effect for ?autoConnect=1.
🚥 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 accurately summarizes the main change: updating client query parsing so autoConnect follows the handling used by other boolean options.
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 2 files. (1 skipped: 1 …
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 docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@codecov

codecov Bot commented Oct 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.27%. Comparing base (ad64775) to head (a763e12).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2456   +/-   ##
=======================================
  Coverage   96.27%   96.27%           
=======================================
  Files          22       22           
  Lines        2445     2445           
=======================================
  Hits         2354     2354           
  Misses         91       91           

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

@alexander-akait
alexander-akait merged commit d0bc1fc into main Oct 3, 2026
24 checks passed
@alexander-akait
alexander-akait deleted the fix/autoconnect-query-parsing branch October 3, 2026 10:06
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