Skip to content

fix(specs): boot dummy specs without readline and drop redundant pnpm workspace#3190

Merged
justin808 merged 4 commits intomainfrom
jg/fix-run-workspace-bug
Apr 23, 2026
Merged

fix(specs): boot dummy specs without readline and drop redundant pnpm workspace#3190
justin808 merged 4 commits intomainfrom
jg/fix-run-workspace-bug

Conversation

@justin808
Copy link
Copy Markdown
Member

@justin808 justin808 commented Apr 19, 2026

Summary

Two small fixes that unblock running the spec/dummy app on common developer environments:

  • Wrap require "readline" / require "pry-byebug" in spec/dummy/spec/spec_helper.rb with a LoadError rescue so specs can boot on Ruby builds that ship without readline (e.g. lightweight mise builds). pry-byebug is now declared require: false in Gemfile.development_dependencies so Bundler doesn't autoload it before the rescue runs.
  • Delete react_on_rails/spec/dummy/pnpm-workspace.yaml. The root pnpm-workspace.yaml already lists react_on_rails/spec/dummy, and the nested file broke pnpm workspace resolution when commands were run from the dummy directory.

Pull Request checklist

  • [ ] Add/update test to cover these changes (dev-environment-only fixes; no runtime behavior changes)
  • [ ] Update documentation
  • [ ] Update CHANGELOG file (no user-facing change)

Other Information

None.


Note

Low Risk
Low risk: changes are limited to dev/test bootstrapping (conditional requires and Bundler require: false) plus removing a redundant pnpm-workspace.yaml; no runtime application logic is affected.

Overview
Specs for both react_on_rails and react_on_rails_pro now boot cleanly on Ruby builds without readline by conditionally requiring readline/pry-byebug in spec_helper.rb (and warning only if pry-byebug itself is missing).

Bundler is updated to not auto-require pry-byebug (require: false) so the conditional loading can take effect, and the redundant nested react_on_rails/spec/dummy/pnpm-workspace.yaml is removed to avoid pnpm workspace resolution issues when running from the dummy app directory.

Reviewed by Cursor Bugbot for commit 25092f1. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • Chores
    • Prevented a development/test debugging tool from auto-loading at boot to reduce unnecessary initialization.
    • Removed an unused workspace configuration for the dummy project.
    • Made test startup more resilient by conditionally loading optional debugging tooling and emitting targeted warnings only when those dependencies fail to load.

…kspace file

- Wrap `require "readline"` / `require "pry-byebug"` in spec_helper.rb with a
  LoadError rescue so specs can boot on Ruby builds without readline (e.g.
  lightweight mise builds). Marked `pry-byebug` as `require: false` so Bundler
  doesn't autoload it before the rescue runs.
- Delete `react_on_rails/spec/dummy/pnpm-workspace.yaml`. The root
  `pnpm-workspace.yaml` already lists `react_on_rails/spec/dummy`, and the
  nested file breaks `pnpm` workspace resolution when run from the dummy dir.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 611cc8b4-bc54-423a-ad9e-8dc88fff57f5

📥 Commits

Reviewing files that changed from the base of the PR and between 4bc4b93 and 25092f1.

📒 Files selected for processing (4)
  • react_on_rails/spec/dummy/spec/spec_helper.rb
  • react_on_rails/spec/react_on_rails/spec_helper.rb
  • react_on_rails_pro/spec/dummy/spec/spec_helper.rb
  • react_on_rails_pro/spec/react_on_rails_pro/spec_helper.rb
🚧 Files skipped from review as they are similar to previous changes (1)
  • react_on_rails_pro/spec/dummy/spec/spec_helper.rb

Walkthrough

Development/test setup: pry-byebug gems set to require: false; spec helpers now conditionally require readline and pry-byebug with guarded LoadError handling; spec/dummy/pnpm-workspace.yaml removed.

Changes

Cohort / File(s) Summary
Gem Dependencies
react_on_rails/Gemfile.development_dependencies, react_on_rails_pro/Gemfile.development_dependencies
Changed gem "pry-byebug" to gem "pry-byebug", require: false (manual loading delegated to spec helpers).
Workspace Configuration
react_on_rails/spec/dummy/pnpm-workspace.yaml
Deleted workspace file; dummy app no longer declared as a pnpm workspace package.
Spec Helpers (dummy apps)
react_on_rails/spec/dummy/spec/spec_helper.rb, react_on_rails_pro/spec/dummy/spec/spec_helper.rb
Replaced unconditional require "pry-byebug" with guarded logic: try require "readline" then require "pry-byebug"; rescue LoadError and warn or skip as appropriate.
Spec Helpers (core libs)
react_on_rails/spec/react_on_rails/spec_helper.rb, react_on_rails_pro/spec/react_on_rails_pro/spec_helper.rb
Spec helpers now attempt readline first and conditionally require "pry-byebug", rescuing LoadError from pry-byebug and emitting a warning while skipping when readline is absent.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I nibble gems that won't auto-bind,
I peek for readline, then pry if I find.
Workspaces gone, a quieter trail,
Specs boot on — I twitch my tail.

🚥 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 changes: fixing spec boots without readline support and removing a redundant pnpm workspace file.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jg/fix-run-workspace-bug

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 and usage tips.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 19, 2026

Greptile Summary

This PR makes spec bootstrapping resilient on readline-less Ruby builds (e.g. lightweight mise) by wrapping readline/pry* requires in rescue LoadError blocks across three spec helpers, marking pry-byebug as require: false in both Gemfiles, and removing the redundant nested pnpm-workspace.yaml that was conflicting with the repo-root workspace definition. The readline-aware warn logic (emit warning only when the failure is not due to a missing readline) correctly addresses the prior review concern about silent failures.

Confidence Score: 5/5

Safe to merge — all changes are confined to dev/test bootstrapping with no runtime app logic affected.

All six changed files touch only development/test tooling (spec helpers, dev Gemfile groups, a pnpm workspace config). The readline-aware warn logic is correctly implemented, the require: false additions are consistent across both gems, and prior review concerns have been addressed. No P0 or P1 findings remain.

No files require special attention.

Important Files Changed

Filename Overview
react_on_rails/Gemfile.development_dependencies Marks pry-byebug as require: false so Bundler doesn't autoload it, allowing the rescue block in spec_helper to control when it's loaded.
react_on_rails/spec/dummy/pnpm-workspace.yaml Deleted redundant nested pnpm-workspace.yaml; the repo root already lists this directory, and the duplicate was breaking pnpm workspace resolution.
react_on_rails/spec/dummy/spec/spec_helper.rb Wraps readline/pry-byebug requires in a rescue LoadError block; silences warnings only when readline itself is missing, warns for other failures.
react_on_rails/spec/react_on_rails/spec_helper.rb Same rescue pattern applied to pry, pry-byebug, and pry-doc — all grouped under one begin/rescue block with the readline-aware warn logic.
react_on_rails_pro/Gemfile.development_dependencies Adds require: false to the pro gem's pry-byebug entry (github source), consistent with the main gem's change.
react_on_rails_pro/spec/dummy/spec/spec_helper.rb Mirrors the same rescue LoadError guard added to the main dummy spec_helper for readline-less environments.

Sequence Diagram

sequenceDiagram
    participant Bundler
    participant spec_helper
    participant readline
    participant pry_byebug

    Note over Bundler: Gemfile loads
    Bundler->>pry_byebug: skip autoload (require: false)

    Note over spec_helper: RSpec boot
    spec_helper->>readline: require "readline"
    alt readline present
        readline-->>spec_helper: OK
        spec_helper->>pry_byebug: require "pry-byebug"
        pry_byebug-->>spec_helper: OK (debugger available)
    else LoadError (readline missing)
        readline-->>spec_helper: LoadError
        spec_helper->>spec_helper: rescue LoadError => e
        alt e.message includes "readline"
            spec_helper->>spec_helper: silent skip (expected on lightweight builds)
        else other LoadError
            spec_helper->>spec_helper: warn "[spec_helper] Skipping pry-byebug (#{e.message})"
        end
    end
Loading

Reviews (2): Last reviewed commit: "fix: extend readline rescue to sibling s..." | Re-trigger Greptile

Comment thread react_on_rails/spec/dummy/spec/spec_helper.rb
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 19, 2026

Code Review

Overview

Two focused dev-environment fixes: optional readline/pry-byebug loading in specs, and removal of a redundant nested pnpm workspace file. Both are low-risk and correct in principle.


Issues

1. Incomplete fix — other spec helpers still have bare require "pry-byebug"

The LoadError rescue was applied to react_on_rails/spec/dummy/spec/spec_helper.rb, but two sibling files are still unguarded and will crash on readline-less Ruby builds:

  • react_on_rails_pro/spec/dummy/spec/spec_helper.rb (line 21) — bare require "pry-byebug"
  • react_on_rails/spec/react_on_rails/spec_helper.rb (lines 10-12) — bare require "pry", require "pry-byebug", require "pry-doc"

These should get the same begin/rescue LoadError treatment, otherwise the fix is environment-dependent.

2. react_on_rails_pro/Gemfile.development_dependencies still auto-requires pry-byebug

react_on_rails/Gemfile.development_dependencies correctly adds require: false, but the Pro equivalent (react_on_rails_pro/Gemfile.development_dependencies:48) still has:

gem 'pry-byebug', github: 'shakacode/pry-byebug'

without require: false. Since Bundler auto-requires it at boot, the rescue block in spec_helper.rb fires too late — Bundler tries to load the gem before RSpec even starts. Both the Gemfile change and the rescue block are needed together for the fix to be robust.

3. Gemfile.lock DEPENDENCIES section is stale

After adding require: false, Bundler encodes that as pry-byebug! in the DEPENDENCIES section of the lock file. react_on_rails/Gemfile.lock and react_on_rails/spec/dummy/Gemfile.lock both currently show pry-byebug (no !). Running bundle install in those directories would update them — worth including to keep the lock files accurate.


What looks good

  • The begin/rescue LoadError pattern is the correct Ruby idiom for optional debug tooling.
  • Adding require: false to the Gemfile is the right companion change so Bundler doesn't auto-load it before the rescue can run.
  • Deleting react_on_rails/spec/dummy/pnpm-workspace.yaml is clean — the root workspace already lists this path, and a nested workspace file overrides rather than inherits, which is exactly the bug described.

Suggested follow-up (can be in this PR or a quick follow-on)

Apply the same pattern to the two unguarded spec helpers and the Pro Gemfile entry.

Comment thread react_on_rails/spec/dummy/spec/spec_helper.rb Outdated
Comment thread react_on_rails/Gemfile.development_dependencies
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
react_on_rails/spec/dummy/spec/spec_helper.rb (1)

21-26: LGTM — optional: broaden the comment.

The rescue block also suppresses a missing pry-byebug, not just readline. Consider updating the comment to reflect both cases so future readers aren't surprised if the gem itself is absent.

✏️ Optional wording tweak
 rescue LoadError
-  # Some Ruby builds (for example lightweight mise builds) ship without readline.
+  # Some Ruby builds (for example lightweight mise builds) ship without readline,
+  # and pry-byebug may not be installed in all environments.
 end
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@react_on_rails/spec/dummy/spec/spec_helper.rb` around lines 21 - 26, The
rescue block after the require calls currently only mentions readline; update
the comment to reflect that it also suppresses LoadError for pry-byebug (i.e.,
the require "readline" and require "pry-byebug" lines), so change the comment
text in the rescue block to mention both readline and pry-byebug being possibly
absent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@react_on_rails/spec/dummy/spec/spec_helper.rb`:
- Around line 21-26: The rescue block after the require calls currently only
mentions readline; update the comment to reflect that it also suppresses
LoadError for pry-byebug (i.e., the require "readline" and require "pry-byebug"
lines), so change the comment text in the rescue block to mention both readline
and pry-byebug being possibly absent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d9204c10-bc88-4563-b45e-45665ef6f204

📥 Commits

Reviewing files that changed from the base of the PR and between b4b229f and 65525fe.

📒 Files selected for processing (3)
  • react_on_rails/Gemfile.development_dependencies
  • react_on_rails/spec/dummy/pnpm-workspace.yaml
  • react_on_rails/spec/dummy/spec/spec_helper.rb
💤 Files with no reviewable changes (1)
  • react_on_rails/spec/dummy/pnpm-workspace.yaml

Applies review feedback from PR #3190:

- Narrow the rescue in react_on_rails/spec/dummy/spec/spec_helper.rb so
  non-readline LoadErrors surface a warning instead of being silently
  swallowed (per Greptile P2 suggestion).
- Wrap pry-byebug in the same begin/rescue block in
  react_on_rails_pro/spec/dummy/spec/spec_helper.rb and pry/pry-byebug/
  pry-doc in react_on_rails/spec/react_on_rails/spec_helper.rb so all
  spec helpers boot on readline-less Ruby builds.
- Add require: false to pry-byebug in
  react_on_rails_pro/Gemfile.development_dependencies so Bundler does
  not auto-require it before the spec_helper rescue can run.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@justin808
Copy link
Copy Markdown
Member Author

@claude[bot] — responding to the Code Review comment above:

Issues #1 and #2 (sibling spec helpers and Pro Gemfile require: false): both fixed in e64ea44. Replies posted on the inline threads from @greptile-apps and you.

Issue #3 (stale Gemfile.lock DEPENDENCIES section): this claim is incorrect. The ! suffix in the Bundler lock file's DEPENDENCIES section indicates a non-rubygems source (path/git), not a require: false option. require: false is Gemfile-only metadata and Bundler does not encode it in the lock file. Running bundle install in react_on_rails/ or react_on_rails/spec/dummy/ after this change produces no lock-file diff — verified locally. The current lock entries (pry-byebug (3.10.1) under GEMS and pry-byebug under DEPENDENCIES) are correct.

@justin808
Copy link
Copy Markdown
Member Author

Review Response Summary

Addressed all three actionable review comments in e64ea44.

Changes

File Change
react_on_rails/spec/dummy/spec/spec_helper.rb Narrowed rescue LoadError to warn on non-readline failures (per @greptile-apps P2 suggestion)
react_on_rails/spec/react_on_rails/spec_helper.rb Wrapped pry / pry-byebug / pry-doc requires in the same begin/rescue pattern
react_on_rails_pro/spec/dummy/spec/spec_helper.rb Wrapped pry-byebug require in the same begin/rescue pattern
react_on_rails_pro/Gemfile.development_dependencies Added require: false to pry-byebug so Bundler doesn't auto-require at boot

Verification

  • bundle exec rubocop on the four changed files → no new offenses (15 pre-existing style nits unchanged).
  • bundle exec rspec --dry-run on each of the three affected spec trees — all spec helpers boot cleanly (288, 1448, and 139 examples resolved).

Threads resolved

Declined

  • Code Review item Add linting and CI scripts #3 ("stale Gemfile.lock DEPENDENCIES section"): factually incorrect — require: false is not encoded in the lock file (! indicates a non-rubygems source, not a require option). Verified locally: no lock-file diff after the change. Rationale posted above.

Not replied to

  • CodeRabbit walkthrough and Greptile summary issue comments — auto-generated summaries with no actionable items.

I (Claude Code) made these changes on behalf of @justin808.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 23, 2026

You're right, I was wrong about that. The ! suffix in the DEPENDENCIES section of a Bundler lockfile denotes a non-rubygems source (path or git), and require: false is purely Gemfile DSL metadata — Bundler intentionally does not encode it in the lockfile. The existing lock entries are correct as-is.

Thanks for verifying locally and for the clear explanation.

Tip: You can give me more context with .greptile/rules so I get this right next time.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 23, 2026

Two clean, targeted fixes. The pnpm-workspace.yaml deletion is unambiguously correct - the root workspace already lists react_on_rails/spec/dummy. The LoadError guards are sensible; see inline comments for minor observations.

Comment thread react_on_rails/spec/dummy/spec/spec_helper.rb Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
react_on_rails/spec/react_on_rails/spec_helper.rb (1)

10-18: Rescue scope coalesces all pry-family requires — acceptable, with a minor caveat.

If require "pry" fails with an unrelated message (e.g., "cannot load such file -- pry"), the warning fires and pry-byebug/pry-doc are skipped — intended. But if any of those requires fail with a message that happens to contain the substring "readline" (e.g., pry transitively failing on a readline sub-require), the skip is silent for all three. That's the desired behavior for readline-less builds, so this is fine as-is — just flagging the string-match heuristic in case the error-message format shifts across Ruby/pry versions.

Optionally, you could DRY this block across the three spec helpers into a shared helper (e.g., spec/support/optional_pry.rb), but given these files live in separate gem trees, keeping the duplication local is a reasonable tradeoff.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@react_on_rails/spec/react_on_rails/spec_helper.rb` around lines 10 - 18, The
rescue block around the three requires (require "readline", require "pry",
require "pry-byebug", require "pry-doc") uses a single rescue (rescue LoadError
=> e) and a substring check on e.message to decide whether to warn, which can
silently skip unrelated pry failures if their messages include "readline"; to
fix, wrap each require in its own begin/rescue or at minimum capture the
exception per require and only suppress when the specific require raised a
LoadError containing "readline" (i.e., change the block around require
"readline" to its own begin/rescue and leave pry/pry-byebug/pry-doc with their
own rescues), keeping the warn "[spec_helper] Skipping pry (#{e.message})" logic
on the appropriate exception, or optionally factor this logic into a shared
helper (e.g., spec/support/optional_pry.rb) and call it from spec_helper.rb.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@react_on_rails/spec/react_on_rails/spec_helper.rb`:
- Around line 10-18: The rescue block around the three requires (require
"readline", require "pry", require "pry-byebug", require "pry-doc") uses a
single rescue (rescue LoadError => e) and a substring check on e.message to
decide whether to warn, which can silently skip unrelated pry failures if their
messages include "readline"; to fix, wrap each require in its own begin/rescue
or at minimum capture the exception per require and only suppress when the
specific require raised a LoadError containing "readline" (i.e., change the
block around require "readline" to its own begin/rescue and leave
pry/pry-byebug/pry-doc with their own rescues), keeping the warn "[spec_helper]
Skipping pry (#{e.message})" logic on the appropriate exception, or optionally
factor this logic into a shared helper (e.g., spec/support/optional_pry.rb) and
call it from spec_helper.rb.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b6889a2c-ff6a-47b6-9b55-de635a0c183f

📥 Commits

Reviewing files that changed from the base of the PR and between 65525fe and e64ea44.

📒 Files selected for processing (4)
  • react_on_rails/spec/dummy/spec/spec_helper.rb
  • react_on_rails/spec/react_on_rails/spec_helper.rb
  • react_on_rails_pro/Gemfile.development_dependencies
  • react_on_rails_pro/spec/dummy/spec/spec_helper.rb

Comment thread react_on_rails/spec/react_on_rails/spec_helper.rb Outdated
Comment thread react_on_rails_pro/spec/dummy/spec/spec_helper.rb
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Autofix Details

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Missing rescue for pry-byebug in pro spec_helper
    • Wrapped the pro non-dummy spec helper’s pry-byebug load in a readline-aware begin/rescue LoadError block to prevent boot crashes on readline-less Ruby builds.

Create PR

Or push these changes by commenting:

@cursor push 2a49b8dd7e
Preview (2a49b8dd7e)
diff --git a/react_on_rails_pro/spec/react_on_rails_pro/spec_helper.rb b/react_on_rails_pro/spec/react_on_rails_pro/spec_helper.rb
--- a/react_on_rails_pro/spec/react_on_rails_pro/spec_helper.rb
+++ b/react_on_rails_pro/spec/react_on_rails_pro/spec_helper.rb
@@ -8,7 +8,13 @@
 # let's us use Rails's generator testing helpers but with RSpec syntax
 require "generator_spec"
 require "amazing_print"
-require "pry-byebug"
+begin
+  require "readline"
+  require "pry-byebug"
+rescue LoadError => e
+  # Some Ruby builds (for example lightweight mise builds) ship without readline.
+  warn "[spec_helper] Skipping pry-byebug (#{e.message})" unless e.message.include?("readline")
+end
 
 require "action_controller"
 require "minitest"

You can send follow-ups to the cloud agent here.

Comment thread react_on_rails_pro/Gemfile.development_dependencies
…omments

Apply the readline-aware rescue pattern to react_on_rails_pro/spec/react_on_rails_pro/spec_helper.rb
(was the one remaining spec helper still using a bare `require "pry-byebug"`),
clarify the rescue comment across all four helpers to explain both the silent
readline skip and the warn-for-other-LoadErrors behavior, align the pry warn
message in the core-lib helper to mention all three pry gems, and add the
missing blank line between the rescue block and `require "webmock"` in the Pro
dummy helper.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@justin808
Copy link
Copy Markdown
Member Author

Review Response Summary (round 2)

Addressed all four remaining review items in 4bc4b93.

Changes

File Change Reviewer
react_on_rails_pro/spec/react_on_rails_pro/spec_helper.rb Wrapped require "pry-byebug" in the same readline-aware begin/rescue LoadError block used by the three sibling helpers @cursor[bot] (must-fix)
react_on_rails/spec/dummy/spec/spec_helper.rb Restructured rescue comment to explain both paths (silent readline skip vs. warn for other LoadErrors) @claude[bot]
react_on_rails/spec/react_on_rails/spec_helper.rb Warn message now names all three gems (pry/pry-byebug/pry-doc) @claude[bot]
react_on_rails_pro/spec/dummy/spec/spec_helper.rb Added blank line between end of rescue block and require "webmock" @claude[bot]

Comment clarification applied consistently to all four spec helpers for parity.

Verification

  • bundle exec rubocop on the four changed files — no offenses.
  • cd react_on_rails_pro && bundle exec rspec spec/react_on_rails_pro/ --dry-run — 308 examples resolve cleanly, confirming the Pro non-dummy spec helper now boots on readline-less builds.
  • lefthook pre-commit hooks (autofix + rubocop + trailing-newlines) all passed.

Threads resolved

Not acted on

  • CodeRabbit walkthrough and Greptile summary issue comments — auto-generated summaries with no actionable items.
  • CodeRabbit review 4158880684 nitpick on the rescue-scope substring-match heuristic — reviewer explicitly flagged it as "fine as-is" (the substring match is an intentional heuristic and tolerable across Ruby/pry version shifts).
  • Cursor Bugbot review 4158885686 autofix preview — the underlying bug was the same as #discussion_r3127739360 and has been fixed manually in this commit (no need to accept the autofix PR).

I (Claude Code) made these changes on behalf of @justin808.

Comment thread react_on_rails/spec/dummy/spec/spec_helper.rb
Comment thread react_on_rails/spec/react_on_rails/spec_helper.rb Outdated
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 23, 2026

Review

Good fixes overall — both changes address real pain points for developers on readline-less Ruby builds. The pnpm workspace deletion is clean and correct (root pnpm-workspace.yaml already covers react_on_rails/spec/dummy).

Two issues worth addressing before merge:

1. Fragile string-matching in the LoadError rescue (all four spec_helpers)

The current pattern:

rescue LoadError => e
  warn "..." unless e.message.include?("readline")

has a silent-failure risk: if pry-byebug's byebug native extension fails because readline headers are missing (a compile-time problem, not a missing .rb file), the error message may still contain the word "readline" and get swallowed silently. A developer would get no warning that their debugger isn't loaded.

A two-step probe avoids string matching entirely (see inline comment on spec/dummy/spec/spec_helper.rb).

2. pry and pry-doc included in rescue block but not require: false in Gemfile

In react_on_rails/spec/react_on_rails/spec_helper.rb, the rescue block guards pry, pry-byebug, and pry-doc together, but only pry-byebug is marked require: false in the Gemfile. Bundler will auto-require pry and pry-doc before this file runs, so the begin/rescue block cannot protect against failures from those two gems. The simplest fix is to drop pry and pry-doc from the rescue block — neither depends on readline at load time, so they don't need guarding. (See inline comment.)

Minor: inconsistency across the four files

Three of the four spec helpers protect only pry-byebug; react_on_rails/spec/react_on_rails/spec_helper.rb additionally guards pry and pry-doc. Aligning them would reduce future confusion.


The require: false Gemfile changes and the pnpm fix are solid — the rescue logic just needs a small tightening.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Grouped rescue needlessly skips pry and pry-doc
    • Moved pry and pry-doc outside the readline-guarded rescue block so only pry-byebug is skipped when readline is unavailable.

Create PR

Or push these changes by commenting:

@cursor push 1519991ed8
Preview (1519991ed8)
diff --git a/react_on_rails/spec/react_on_rails/spec_helper.rb b/react_on_rails/spec/react_on_rails/spec_helper.rb
--- a/react_on_rails/spec/react_on_rails/spec_helper.rb
+++ b/react_on_rails/spec/react_on_rails/spec_helper.rb
@@ -7,15 +7,15 @@
 # let's us use Rails's generator testing helpers but with RSpec syntax
 require "generator_spec"
 require "amazing_print"
+require "pry"
+require "pry-doc"
 begin
   require "readline"
-  require "pry"
   require "pry-byebug"
-  require "pry-doc"
 rescue LoadError => e
   # readline is absent on some lightweight Ruby builds (e.g. mise) — silently skip.
   # For any *other* LoadError, surface it so developers notice.
-  warn "[spec_helper] Skipping pry/pry-byebug/pry-doc (#{e.message})" unless e.message.include?("readline")
+  warn "[spec_helper] Skipping pry-byebug (#{e.message})" unless e.message.include?("readline")
 end
 
 require "rspec/retry"

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit 4bc4b93. Configure here.

Comment thread react_on_rails/spec/react_on_rails/spec_helper.rb
…-doc

Replace the single `rescue LoadError` + message-matching trick with a
two-step rescue: an outer rescue for `readline` (silent skip) and an
inner rescue for `pry-byebug` (warn on any other LoadError). Avoids
false-positives where a non-readline pry-byebug failure would have been
silently swallowed just because its message happened to mention
readline.

In `react_on_rails/spec/react_on_rails/spec_helper.rb`, also move
`require "pry"` and `require "pry-doc"` outside the rescue — neither
depends on readline (pry uses reline as a fallback), so grouping them
with pry-byebug made the spec helper silently skip pry entirely on
lightweight Ruby builds.

Addresses PR #3190 review feedback from @claude[bot].

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@justin808
Copy link
Copy Markdown
Member Author

Review follow-up summary (25092f1)

Addressed the three remaining unresolved review comments on this PR:

1. Fragile e.message.include?("readline") matching (@claude[bot], #discussion_r3127935221)
Replaced the single rescue + message-matching trick with a nested two-step rescue:

begin
  require "readline"
rescue LoadError
  # readline absent on this Ruby build (e.g. mise) — pry-byebug won't work, skip silently.
else
  begin
    require "pry-byebug"
  rescue LoadError => e
    warn "[spec_helper] Skipping pry-byebug: #{e.message}"
  end
end

Non-readline pry-byebug failures are no longer silently swallowed just because the error message happens to mention readline.

2. Unnecessarily guarded pry and pry-doc (@claude[bot], #discussion_r3127935504)
In react_on_rails/spec/react_on_rails/spec_helper.rb, moved require "pry" and require "pry-doc" outside the rescue block. Neither depends on readline (pry falls back to reline; pry-doc is docs-only), so they're now unconditionally required. Only readline + pry-byebug remain guarded.

3. Same as #2 (@cursor[bot], #discussion_r3127942808) — duplicate of #2, addressed by the same change.

Verification

  • bundle exec rubocop on the four modified spec helpers: clean.
  • bundle exec rspec --dry-run for each of the four spec suites:
    • react_on_rails/spec/react_on_rails/ → 1448 examples, 0 failures
    • react_on_rails/spec/dummy/spec/ → 288 examples, 0 failures
    • react_on_rails_pro/spec/react_on_rails_pro/ → 308 examples, 0 failures
    • react_on_rails_pro/spec/dummy/spec/ → 139 examples, 0 failures

All three threads are now resolved.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 23, 2026

Code Review

Two targeted developer-experience fixes:

  1. Guards readline/pry-byebug loading in all four spec helpers so specs boot on readline-less Ruby builds.
  2. Deletes the redundant spec/dummy/pnpm-workspace.yaml -- the root-level file already covers that path.

Both fixes are correct and low-risk.

Strengths

  • Correct require: false placement in Gemfile. Without this, Bundler auto-requires pry-byebug before the spec helper rescue block runs -- this is the critical companion to the spec helper guards.
  • Intentional silent vs. warn distinction: silently skipping when readline is absent (system constraint) vs. warning when pry-byebug itself fails to load (more unexpected). Well-commented.
  • Consistent: the guard is applied identically across all four spec helpers (both packages, dummy + core).
  • pnpm fix is clean: root pnpm-workspace.yaml already lists react_on_rails/spec/dummy, so the nested file was strictly redundant.

Minor observations

  1. The nested begin/rescue block is copy-pasted verbatim 4 times. If the guard logic ever changes it needs updating in 4 places. A shared support file within each package would help, though cross-package sharing is harder. Acceptable for dev tooling.

  2. react_on_rails_pro/Gemfile.development_dependencies now has both a preceding line comment and a trailing inline comment on the pry-byebug gem declaration. The new preceding comment covers the intent; the original trailing comment is now redundant.

  3. In react_on_rails/spec/react_on_rails/spec_helper.rb, pry and pry-doc are still required unconditionally above the guard block. The comment (pry falls back to reline) correctly explains why this is safe -- no change needed.

Verdict: Approve. Both fixes are correct and address real DX pain. The minor duplication is acceptable for dev-only tooling. Ready to merge.

gem 'pry', '>= 0.14.1' # Console with powerful introspection capabilities
# Need to use master of pry-byebug to use latest pry version
gem 'pry-byebug', github: 'shakacode/pry-byebug' # Integrates pry with byebug
# Loaded manually in spec_helper.rb so specs can boot on readline-less Ruby builds.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pry-byebug declaration now carries both a preceding line comment and the original trailing inline comment. The new preceding comment fully covers the intent — the trailing # Integrates pry with byebug is now redundant.

Suggested change
# Loaded manually in spec_helper.rb so specs can boot on readline-less Ruby builds.
gem 'pry-byebug', github: 'shakacode/pry-byebug', require: false

@justin808 justin808 merged commit b1f443f into main Apr 23, 2026
46 checks passed
@justin808 justin808 deleted the jg/fix-run-workspace-bug branch April 23, 2026 04:14
justin808 added a commit that referenced this pull request Apr 23, 2026
…ging' into jg/3122-rolling-deploy-adapter

* origin/jg/3122-unify-renderer-cache-staging: (39 commits)
  fix(specs): boot dummy specs without readline and drop redundant pnpm workspace (#3190)
  docs: add RSC migration success stories page (#1985) (#3162)
  Fix Bencher reporting permanently broken on pushes to main (#3148)
  docs: add example migrations guide (#3126)
  docs: remove defunct guavapass.com reference (#3199)
  chore: remove redundant --rsc-pro install generator flag (#3105)
  ci: warn (don't fail) on Bencher main regression (#3168)
  test: enable RSpec --profile to surface slowest package tests (#3176)
  fix(node-renderer): expose performance in VM context when supportModules (#3158)
  docs: remove stale immediate_hydration references (#3139) (#3159)
  docs: restore absolute URL for node-renderer testing example (#3179)
  Bump Rspack dependencies to v2 (^2.0.0-0) (#3084)
  chore: remove obsolete webpack <5.106.0 pin (#3175)
  Move Node Renderer entry point to renderer/ directory (#3165)
  docs: address RSC pitfalls review follow-ups (#3155) (#3156)
  docs: remove fabricated DevConsole reference, link verified RSC tools (#2527) (#3163)
  Scaffold CI workflow and build scripts for first-run consistency (#3097)
  Add OPTIONAL triage tier and fix recommendations to /address-review (#3161)
  chore: sync Gemfile.lock with term-ansicolor 1.11.3 (#3164)
  Simplify the docs sidebar and Pro landing pages (#3119)
  ...
justin808 added a commit that referenced this pull request Apr 23, 2026
* origin/main:
  fix(specs): boot dummy specs without readline and drop redundant pnpm workspace (#3190)
  docs: add RSC migration success stories page (#1985) (#3162)
  Fix Bencher reporting permanently broken on pushes to main (#3148)
  docs: add example migrations guide (#3126)
  docs: remove defunct guavapass.com reference (#3199)
  chore: remove redundant --rsc-pro install generator flag (#3105)
  ci: warn (don't fail) on Bencher main regression (#3168)
  test: enable RSpec --profile to surface slowest package tests (#3176)
  fix(node-renderer): expose performance in VM context when supportModules (#3158)
  docs: remove stale immediate_hydration references (#3139) (#3159)
  docs: restore absolute URL for node-renderer testing example (#3179)
  Bump Rspack dependencies to v2 (^2.0.0-0) (#3084)
  chore: remove obsolete webpack <5.106.0 pin (#3175)
  Move Node Renderer entry point to renderer/ directory (#3165)
  docs: address RSC pitfalls review follow-ups (#3155) (#3156)

# Conflicts:
#	CHANGELOG.md
justin808 added a commit that referenced this pull request May 4, 2026
…rn/npm-security-dd6aeadc3f

* origin/main: (34 commits)
  fix(pro-dummy): make manual node-renderer validation reliable (#3200)
  [codex] Add Markdown Prettier CI check (#3242)
  Add /stress-test Claude Code command for adversarial QA (#3207)
  Document examples catalog and naming plan (#3191)
  test(dummy): enable StrictMode in OSS and Pro dummies (#3206)
  ci: exclude bot-blocking URLs from lychee link check (#3214)
  Remove stale Coveralls integration (#3204)
  docs: normalize external GitHub repo slugs in links and generators (#3198)
  docs: add Example Migrations page (#3125) (#3197)
  docs: warn about react_component helper collision with react-rails (#3143) (#3160)
  docs: legacy Webpacker and migration-fit guidance (#3138) (#3157)
  fix(specs): boot dummy specs without readline and drop redundant pnpm workspace (#3190)
  docs: add RSC migration success stories page (#1985) (#3162)
  Fix Bencher reporting permanently broken on pushes to main (#3148)
  docs: add example migrations guide (#3126)
  docs: remove defunct guavapass.com reference (#3199)
  chore: remove redundant --rsc-pro install generator flag (#3105)
  ci: warn (don't fail) on Bencher main regression (#3168)
  test: enable RSpec --profile to surface slowest package tests (#3176)
  fix(node-renderer): expose performance in VM context when supportModules (#3158)
  ...
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