Fix main generator pretend spec isolation#4147
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe pretend-mode Redux+Tailwind spec is updated to create a minimal ChangesPretend-mode spec precision fix
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested labels
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
+ci-run-hosted |
Hosted CI RequestedTriggered 9 workflow(s) for View progress in the Actions tab. |
Code Review: Fix main generator pretend spec isolationSummary: Clean, targeted fix for a CI regression caused by test ordering sensitivity in the shared What the fix doesThe The fix:
Assessment
Minor observation (not a blocker)The LGTM. Ready to merge. |
| <<: *default | ||
| YAML | ||
|
|
||
| allow(redux_generator).to receive(:copy_file) |
There was a problem hiding this comment.
The minimal YAML here (only source_path, no source_entry_path or other keys) is intentional and correct for this test — only the source path lookup is exercised. For reference, simulate_preinstalled_shakapacker in the support helper uses a full fixture with all keys. The difference is fine here since copy_base_files in pretend mode only needs to resolve the source path.
| expect(File).not_to receive(:read).with(File.join(destination_root, client_entry)) | ||
| expect(redux_generator).to receive(:say_status) | ||
| .with(:pretend, "Would add Tailwind stylesheet import to #{client_entry}", :yellow) | ||
|
|
There was a problem hiding this comment.
This is the key correctness fix: and_call_original lets File.read work normally for any path, while the expect(...).not_to receive(:read).with(...) below still catches accidental reads of the specific client entry. Previously the blanket not_to receive(:read) over-specified the test and conflated "shakapacker config reads" (legitimate) with "not-yet-copied client entry reads" (the actual invariant being guarded).
Code Review: Fix main generator pretend spec isolationSummary: This is a small, focused test-only fix that correctly narrows an overly broad What changedThe fix has three parts:
AnalysisCorrectness — correct fix The root cause is clear: the shared RSpec pattern — idiomatic
Minimal YAML fixture The added fixture only includes Test isolation — correctly improved Adding the explicit No production code changed — the fix is entirely in the spec file. Minor suggestions
VerdictApprove. The fix is correct, minimal, and well-explained. The production generator is untouched. No security or performance concerns. |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_009b06ef-c1c8-4aae-b207-87d43a6bc0b5) |
…trap-4138 * origin/main: Docs: point Pro license to purchase site (#4160) docs: paired ShakaPerf A/B methodology for RSC perf regressions (#4137) (#4142) Bound the RSCProvider RSC payload cache with an LRU (#3564) (#4097) Harden PR security preflight follow-ups (#4151) [codex] Trust ShakaCode team for agent inputs (#4154) Default adversarial PR review to current branch (#4155) Require hosted CI for generator PRs (#4149) Make review-fix push confirmation context-sensitive (#4152) Harden PR batch security preflight (#4148) Add bidirectional streaming for async props (pull mode) (#4048) Fix main generator pretend spec isolation (#4147) Revive Pro streaming validation coverage (#4035) Fix ci-local detector JSON parsing (#4061) ci(pro): add Rspack build leg for execjs-compatible-dummy (#4091) (#4106) Add High-Risk Mode to adversarial-pr-review (#4050) (#4115) Fix hydration error reporting for thrown values (#4120) Add batch cancellation / drain protocol to stop in-flight PR batches (#4119) [codex] Document current RSC architecture and version policy (#4103) Clarify PR-batch merge authority and ready gates (#4140) # Conflicts: # docs/oss/building-features/performance-tracks-and-profiling.md # llms-full.txt
…o-agent-guidance * origin/main: (647 commits) Consolidate analysis/ into internal/analysis/ (#4159) Docs: point Pro license to purchase site (#4160) docs: paired ShakaPerf A/B methodology for RSC perf regressions (#4137) (#4142) Bound the RSCProvider RSC payload cache with an LRU (#3564) (#4097) Harden PR security preflight follow-ups (#4151) [codex] Trust ShakaCode team for agent inputs (#4154) Default adversarial PR review to current branch (#4155) Require hosted CI for generator PRs (#4149) Make review-fix push confirmation context-sensitive (#4152) Harden PR batch security preflight (#4148) Add bidirectional streaming for async props (pull mode) (#4048) Fix main generator pretend spec isolation (#4147) Revive Pro streaming validation coverage (#4035) Fix ci-local detector JSON parsing (#4061) ci(pro): add Rspack build leg for execjs-compatible-dummy (#4091) (#4106) Add High-Risk Mode to adversarial-pr-review (#4050) (#4115) Fix hydration error reporting for thrown values (#4120) Add batch cancellation / drain protocol to stop in-flight PR batches (#4119) [codex] Document current RSC architecture and version policy (#4103) Clarify PR-batch merge authority and ready gates (#4140) ... # Conflicts: # AGENTS_USER_GUIDE.md
…ales-js * origin/main: [codex] Document flagship demo coordination (#4164) Enrich deferred-render RSC errors with the bundle diagnostic (#3475) (#4100) Consolidate analysis/ into internal/analysis/ (#4159) Docs: point Pro license to purchase site (#4160) docs: paired ShakaPerf A/B methodology for RSC perf regressions (#4137) (#4142) Bound the RSCProvider RSC payload cache with an LRU (#3564) (#4097) Harden PR security preflight follow-ups (#4151) [codex] Trust ShakaCode team for agent inputs (#4154) Default adversarial PR review to current branch (#4155) Require hosted CI for generator PRs (#4149) Make review-fix push confirmation context-sensitive (#4152) Harden PR batch security preflight (#4148) Add bidirectional streaming for async props (pull mode) (#4048) Fix main generator pretend spec isolation (#4147)
Why
The default branch is currently failing
Rspec test for gemonmainin the generator shard:rspec-package-tests (4.0, latest, generators)andrspec-package-tests (3.3, minimum, generators)spec/react_on_rails/generators/install_generator_spec.rb:3717The failure was not caused by the most recent Pro streaming PR. The same generator failure appears on the prior pushed commit and traces back to the custom Shakapacker-root generator work in #4130. A focused ordered repro showed the issue:
Before this patch, that sequence failed because earlier examples left
config/shakapacker.ymlin the shared generator destination. The pretend-mode example usedexpect(File).not_to receive(:read), which accidentally forbade the legitimate config read used to resolve Shakapacker paths. The behavior the test meant to protect is narrower: pretend mode must not read the copied Redux Tailwind client entry, because pretend mode does not create that file.What changed
config/shakapacker.ymlfixture to the pretend-mode example.File.readcalls while asserting the generated Redux client entry is not read.Validation
git diff --check-> passed.cd react_on_rails && bundle exec rspec spec/react_on_rails/generators/install_generator_spec.rb:564 spec/react_on_rails/generators/install_generator_spec.rb:590 spec/react_on_rails/generators/install_generator_spec.rb:3717-> 4 examples, 0 failures.cd react_on_rails && BUNDLE_GEMFILE=../Gemfile bundle exec rubocop spec/react_on_rails/generators/install_generator_spec.rb-> 1 file inspected, no offenses.codex review --uncommitted-> no actionable correctness issues.Process triage
Process Gap Disposition:
checklist+replay.install_generator_spec.rb:3717, but the default-branch failure required replaying that example after earlier custom-root generator examples that leaveconfig/shakapacker.ymlin the shared destination.mainbefore this patch and passed after this patch.Merge queue would reduce stale-base/concurrency merges, but it would not have caught this exact issue unless the queue runs the same generator shard before landing. The actionable process improvement is to include ordered replay when adding generator examples that share
dummy-for-generators, especially when new examples leave Shakapacker config or other shared files behind.Note
Low Risk
Test-only change to generator spec isolation; runtime install/generator behavior is unchanged.
Overview
Fixes a flaky failure in
install_generator_specfor the Redux + Tailwind--pretendexample when earlier examples leaveconfig/shakapacker.ymlin the shareddummy-for-generatorsdestination.The example now seeds its own minimal Shakapacker config, stubs
File.readwithand_call_original, and asserts only that the generatedHelloWorldApp.client.jsxpath is not read—matching the generator’s early return in pretend mode before it would read the copied client entry. No generator production code changes.Reviewed by Cursor Bugbot for commit ace8804. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit