Commit 763520d
Make RSC Rspack doctor lazyCompilation warning honest about its limitation (#4249)
## Summary
Fixes #4243. Follow-up to #4227 and #4234.
The `react_on_rails:doctor:rsc` lazyCompilation check only recognizes
the generated literal pattern:
```js
clientWebpackConfig.lazyCompilation = false;
```
When an app disables lazyCompilation an **equivalent** way, the check
still emitted a warning whose wording **asserted** the config was wrong:
```
config/rspack/development.js does not appear to disable lazyCompilation while the dev server is running.
```
That is a false positive for advanced users whose effective dev-server
config is correct (e.g. object form, `Object.assign`, a helper, a
ternary, or disabling it in a different config file — see the matrix in
#4243).
## What this changes
This is the **wording fix** the issue explicitly lists as an acceptable
resolution ("make the warning wording explicit that it only failed to
find the generated literal config pattern"). The not-found branch now:
- states doctor **could not confirm** lazyCompilation is disabled
(instead of asserting it is *enabled*);
- explains it only detects the generated literal assignment, so
equivalent configs read as *unconfirmed*, not *broken*;
- tells users with equivalent configs they can ignore the warning after
confirming their effective config.
The high-confidence literal-pattern **success** path is unchanged, and
the genuine "no disable control at all" case still gets the same
actionable warning + fix snippet. No detector logic or severity change —
only honest wording, so there are no new false *positives* (claiming
"disabled" when it isn't).
Internally, the warning emission moved into a small private helper to
keep `check_rsc_rspack_lazy_compilation` within the `Metrics/AbcSize`
budget after the added guidance line.
## Why not detect the effective config?
The issue's other option — evaluate the real final Rspack config (e.g.
via `pack-config-diff`) — is heavyweight (spawns Node, evaluates
arbitrary user config), adds a dependency to a static diagnostic, and is
fragile across toolchains. For a P3 doctor-polish issue that is
over-scoped; this PR removes the user-facing harm (the misleading
assertion) at near-zero risk. Accurate effective-config evaluation
remains the documented future path if maintainers want deeper detection
later.
## Testing
- `cd react_on_rails && bundle exec rspec
spec/lib/react_on_rails/doctor_spec.rb -e
"check_rsc_rspack_lazy_compilation"` — 8 examples, 0 failures (7
pre-existing assertions on the warning/info substrings still pass,
confirming no behavior regression; 1 new regression test).
- `cd react_on_rails && bundle exec rspec
spec/lib/react_on_rails/doctor_rake_task_spec.rb` — 12 examples, 0
failures.
- `bundle exec rubocop react_on_rails/lib/react_on_rails/doctor.rb
react_on_rails/spec/lib/react_on_rails/doctor_spec.rb` — no offenses.
- `codex review --base origin/main` — no findings.
The new test uses the `Object.assign(clientWebpackConfig, {
lazyCompilation: false })` variant from the issue and asserts the
warning no longer says "does not appear to disable" and now says "could
not confirm lazyCompilation is disabled".
## Labels
`Labels: ready-for-hosted-ci` — `script/ci-changes-detector` sets
`run_generators=true` for this `lib/react_on_rails/doctor.rb` change, so
`required-pr-gate` requires hosted CI. Optimized selection (not
`force-full`) is sufficient: this is a localized diagnostic-wording
change, not a CI-detector/runtime/broad-generator change.
## Decision Log
- **Non-blocking — scope:** Issue offers (1) evaluate the effective
Rspack config or (2) honest wording. Chose (2). **Why:** (1) is
heavyweight (spawns Node, evaluates arbitrary user config, adds a
dependency to a static diagnostic, fragile across toolchains) and
over-scoped for a P3; (2) removes the user-facing harm at near-zero
risk. **Review later:** accurate effective-config detection if
maintainers want deeper coverage.
- **Non-blocking — detection breadth:** Did not broaden the static regex
to claim "success" on more variants. **Why:** it would resolve ~1 of 7
variants while adding false-*positive* risk (object form can be partial,
e.g. `{ entries: true }`), the exact risk #4234 avoided. Honest wording
covers all undetectable variants uniformly.
- **Non-blocking — hosted CI:** Requested optimized hosted CI via
`+ci-run-hosted` after local validation. **Why:** generator gate
requires it; documented flow.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Fixed the RSC Rspack doctor to avoid false failure when
`lazyCompilation` is disabled via semantically equivalent (non-literal)
configuration patterns.
* Improved messaging to clearly indicate when the setting can’t be
confirmed statically, with guidance on how to verify it in the
dev-server setup.
* **Tests**
* Added spec coverage for an equivalent `lazyCompilation: false`
configuration pattern to ensure the correct warning and guidance are
shown.
* **Documentation**
* Updated the changelog with the latest doctor behavior note.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 77e1b02 commit 763520d
3 files changed
Lines changed: 59 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
51 | 63 | | |
52 | 64 | | |
53 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3641 | 3641 | | |
3642 | 3642 | | |
3643 | 3643 | | |
3644 | | - | |
3645 | | - | |
3646 | | - | |
3647 | | - | |
3648 | | - | |
3649 | | - | |
3650 | | - | |
3651 | | - | |
3652 | | - | |
3653 | | - | |
| 3644 | + | |
3654 | 3645 | | |
3655 | 3646 | | |
3656 | 3647 | | |
3657 | 3648 | | |
3658 | 3649 | | |
| 3650 | + | |
| 3651 | + | |
| 3652 | + | |
| 3653 | + | |
| 3654 | + | |
| 3655 | + | |
| 3656 | + | |
| 3657 | + | |
| 3658 | + | |
| 3659 | + | |
| 3660 | + | |
| 3661 | + | |
| 3662 | + | |
| 3663 | + | |
| 3664 | + | |
| 3665 | + | |
| 3666 | + | |
| 3667 | + | |
| 3668 | + | |
| 3669 | + | |
| 3670 | + | |
| 3671 | + | |
| 3672 | + | |
3659 | 3673 | | |
3660 | 3674 | | |
3661 | 3675 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5397 | 5397 | | |
5398 | 5398 | | |
5399 | 5399 | | |
| 5400 | + | |
| 5401 | + | |
| 5402 | + | |
| 5403 | + | |
| 5404 | + | |
| 5405 | + | |
| 5406 | + | |
| 5407 | + | |
| 5408 | + | |
| 5409 | + | |
| 5410 | + | |
| 5411 | + | |
| 5412 | + | |
| 5413 | + | |
| 5414 | + | |
| 5415 | + | |
| 5416 | + | |
| 5417 | + | |
| 5418 | + | |
| 5419 | + | |
| 5420 | + | |
| 5421 | + | |
| 5422 | + | |
5400 | 5423 | | |
5401 | 5424 | | |
5402 | 5425 | | |
| |||
0 commit comments