Supersede #961 by using pack-config-diff#973
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds a semantic configuration diff workflow: new CLI wrapper Changes
Sequence DiagramsequenceDiagram
actor User
participant CLI as "bin/diff-bundler-config"
participant Local as "pack-config-diff (local)"
participant NPX as "npx / fetched package"
User->>CLI: invoke with args
CLI->>CLI: try require('pack-config-diff')
alt local module found
CLI->>Local: load module and validate export
CLI->>Local: call run(argv)
Local-->>CLI: return exit code or Promise
else module not found
CLI->>NPX: spawn npx pack-config-diff@^0.1.0 with args
NPX-->>CLI: process exit code
end
CLI-->>User: exit with validated integer code (or 2 on error)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Review: Supersede #961 by using pack-config-diffThe approach of extracting the diff engine into a dedicated package is sound, and the binstub wrapper pattern is consistent with existing tooling. A few issues worth addressing before merging: Security: Unpinned GitHub dependency (blocking) Two separate places pull from the GitHub repo without a version or commit pin:
Code quality: confusing control flow in the catch block (minor) Calling Potential silent failure when If Duplication
Verdict The core design is good. The blocking item is the unpinned npx fallback — everything else is refinements. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e022a5636e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Greptile SummaryThis PR introduces semantic bundler config diffing to Shakapacker by delegating to the extracted Key changes and findings:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Binstub as bin/diff-bundler-config
participant LocalPkg as pack-config-diff (local)
participant NPX as npx (github:shakacode/pack-config-diff)
User->>Binstub: node bin/diff-bundler-config --left=a.yaml --right=b.yaml
Binstub->>LocalPkg: require("pack-config-diff")
alt Module found locally
LocalPkg-->>Binstub: { run }
Binstub->>LocalPkg: run(argv)
LocalPkg-->>Binstub: exitCode
Binstub-->>User: process.exit(exitCode)
else MODULE_NOT_FOUND
Binstub->>NPX: spawnSync("npx", ["-y", "github:shakacode/pack-config-diff", ...argv])
NPX-->>Binstub: { status, error }
alt npx succeeded
Binstub-->>User: process.exit(status ?? 1)
else npx error
Binstub-->>User: console.error + process.exit(1)
end
else Other require error
Binstub-->>User: throw error (unhandled exception)
end
Last reviewed commit: e022a56 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
lib/install/bin/diff-bundler-config (1)
62-68: Consider handling asyncrun()return value.If
pack-config-diff'srun()function returns a Promise (now or in the future), the exit code would be a Promise object, causingprocess.exit()to exit with code 0 and potentially masking errors.♻️ Optional: Add async handling for future-proofing
-try { - const exitCode = run(process.argv.slice(2)) - process.exit(exitCode) -} catch (error) { - console.error(formatError(error)) - process.exit(1) -} +async function main() { + try { + const exitCode = await run(process.argv.slice(2)) + process.exit(exitCode) + } catch (error) { + console.error(formatError(error)) + process.exit(1) + } +} + +main()🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/install/bin/diff-bundler-config` around lines 62 - 68, The current try/catch calls run(...) synchronously and passes its return directly to process.exit, which breaks if run is async; update the wrapper to handle a Promise from run by awaiting or chaining it: call run(process.argv.slice(2)) and then await or .then() the result to obtain exitCode before calling process.exit(exitCode), and ensure errors are caught and passed to formatError(...) in the catch handler (reference symbols: run, formatError, process.exit).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@bin/diff-bundler-config`:
- Around line 1-68: The file is missing a trailing newline at EOF; update the
file so it ends with a single newline character. Open the script containing
PACK_CONFIG_DIFF_PACKAGE / runViaNpx and the final try/catch that calls run, and
ensure the last line (after process.exit(1) in the catch) is followed by a
newline so the file terminates with a trailing newline.
---
Nitpick comments:
In `@lib/install/bin/diff-bundler-config`:
- Around line 62-68: The current try/catch calls run(...) synchronously and
passes its return directly to process.exit, which breaks if run is async; update
the wrapper to handle a Promise from run by awaiting or chaining it: call
run(process.argv.slice(2)) and then await or .then() the result to obtain
exitCode before calling process.exit(exitCode), and ensure errors are caught and
passed to formatError(...) in the catch handler (reference symbols: run,
formatError, process.exit).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 27ea9903-ff70-49c0-985a-e1146e8f85bf
📒 Files selected for processing (9)
README.mdbin/diff-bundler-configdocs/config-diff.mddocs/rspack_migration_guide.mddocs/troubleshooting.mdlib/install/bin/diff-bundler-configlib/shakapacker/doctor.rblib/tasks/shakapacker/doctor.rakespec/shakapacker/doctor_spec.rb
ReviewGood idea to extract the diff engine into a separate package. The docs and Ruby-side changes are clean. A few issues need addressing before merge. Blocking
Non-blocking
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
lib/shakapacker/doctor.rb (1)
1023-1033: Status output currently treats an optional binstub as required.
bin/diff-bundler-configis optional incheck_binstub, but here it participates in the “all found” check, which can hide a full-required-binstubs success message.Proposed refactor
- binstubs = [ + required_binstubs = [ "bin/shakapacker", "bin/shakapacker-dev-server", - "bin/shakapacker-config", - "bin/diff-bundler-config" + "bin/shakapacker-config" ] + optional_binstubs = ["bin/diff-bundler-config"] - existing_binstubs = binstubs.select { |b| doctor.root_path.join(b).exist? } + existing_required = required_binstubs.select { |b| doctor.root_path.join(b).exist? } + existing_optional = optional_binstubs.select { |b| doctor.root_path.join(b).exist? } - if existing_binstubs.length == binstubs.length - puts "✓ All Shakapacker binstubs found (#{existing_binstubs.join(', ')})" - elsif existing_binstubs.any? - existing_binstubs.each do |binstub| + if existing_required.length == required_binstubs.length + puts "✓ All required Shakapacker binstubs found (#{existing_required.join(', ')})" + elsif existing_required.any? + existing_required.each do |binstub| puts "✓ #{binstub} found" end end + + existing_optional.each do |binstub| + puts "✓ #{binstub} found (optional)" + end🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/shakapacker/doctor.rb` around lines 1023 - 1033, The current success check uses the full binstubs array (variable binstubs) including the optional "bin/diff-bundler-config", causing the "all found" message to require an optional file; change the logic to separate required and optional entries (e.g. build a required_binstubs array excluding "bin/diff-bundler-config") and compute existing_required = required_binstubs.select { |b| doctor.root_path.join(b).exist? } then compare existing_required.length == required_binstubs.length and print the success message listing only existing_required; also ensure check_binstub (if present) is consistent with this required/optional split.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@lib/shakapacker/doctor.rb`:
- Around line 1023-1033: The current success check uses the full binstubs array
(variable binstubs) including the optional "bin/diff-bundler-config", causing
the "all found" message to require an optional file; change the logic to
separate required and optional entries (e.g. build a required_binstubs array
excluding "bin/diff-bundler-config") and compute existing_required =
required_binstubs.select { |b| doctor.root_path.join(b).exist? } then compare
existing_required.length == required_binstubs.length and print the success
message listing only existing_required; also ensure check_binstub (if present)
is consistent with this required/optional split.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 72ae3751-fc78-457f-bd06-4e105c024e5b
📒 Files selected for processing (5)
bin/diff-bundler-configdocs/config-diff.mdlib/install/bin/diff-bundler-configlib/shakapacker/doctor.rbspec/shakapacker/doctor_spec.rb
🚧 Files skipped from review as they are similar to previous changes (4)
- lib/install/bin/diff-bundler-config
- bin/diff-bundler-config
- spec/shakapacker/doctor_spec.rb
- docs/config-diff.md
Review: PR 973 — Add bin/diff-bundler-config wrapperSummaryThe overall approach is sound — delegating config diffing to an extracted package keeps Shakapacker focused. A few issues need attention before merging. Must Fix1. Exit code divergence between bin/diff-bundler-config and lib/install/bin/diff-bundler-config The two files are meant to be identical, but the checked-in
Using 2. The PR description says "Added Recommended: add it as an optional peer dependency with a corresponding Should Fix3. Doctor warns all existing users about an optional tool Every existing Shakapacker project without 4. CI detection is too narrow The check Minor5. Works in Node.js CommonJS (files are wrapped in an implicit function), but it is an unusual pattern that may confuse contributors. Wrapping top-level logic in an explicit |
|
Overall this is a clean approach - delegating the diff engine to an extracted package keeps Shakapacker focused, and the wrapper script is well-structured. Two issues worth fixing before merge. Bug: GEM_ROOT constant collision in binstub_sync_spec.rb generator_spec.rb already defines a top-level constant Fix: use a local variable ( Minor: implicit fallthrough after runViaNpx()
Notes (not blocking)
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is ON, but it could not run because on-demand usage is turned off. To enable Bugbot Autofix, turn on on-demand usage and set a spend limit in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit aee5989. Configure here.
Change GEM_ROOT constant to gem_root local variable to avoid collision with the GEM_ROOT constant defined in generator_spec.rb (Pathname vs String type mismatch when running the full test suite). Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Review feedback addressed (3babdee)Triaged 3 unresolved review threads. Fixed 1 item, posted rationale replies on 2 skipped items, and resolved all threads. Changes made
Skipped with rationale
|
Review: Supersede #961 with pack-config-diffThe approach of delegating the diff engine to an extracted package is the right call — it keeps Shakapacker focused and puts maintenance of the diff logic in one place. The required/optional binstub split is clean and the binstub sync spec is a smart safeguard. Three issues worth addressing (inline comments posted): 1. Missing 2. 3. Binstub sync spec excludes the case it should catch (lines 9–11) |
Remove the entire npx fallback path (~60 lines per binstub) since pack-config-diff is small and should always be installed. This eliminates the npx --separator issue, the getNpxSpec() no-op in user projects, and the CI guard complexity. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Review feedback addressed (0ce0f32)Triaged 3 new review comments. Addressed all by promoting Changes made
Review comments resolved
|
Review: Supersede #961 by using pack-config-diffOverall the approach is clean — delegating to an extracted package keeps Shakapacker focused and the wrapper script's defensive exit-code handling is a nice touch. A few issues worth addressing before merge: 1. PR description contradicts the implementation (no npx fallback)The PR description states:
But the actual 2. Supply chain / trust surface for a new 0.1.0 packageAdding a runtime dependency on a brand-new 0.1.0 package (
Recommendation: pin to an exact version ( 3.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0ce0f32fbf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Use createRequire to resolve pack-config-diff from shakapacker's own node_modules instead of the app's. This fixes the binstub under strict package managers (pnpm, Yarn PnP) where transitive dependencies of shakapacker are not resolvable from the app's bin/ directory. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Review feedback addressed (eef1c25)Triaged 6 unresolved review threads. Fixed 1 item, posted rationale replies on 5 skipped items, and resolved all threads. Changes made
Declined with rationale
|
Review SummaryOverall this is a clean approach — delegating diffing to a dedicated package keeps Shakapacker focused, and the doctor/binstub refactor (extracting
|
### Summary Updates CHANGELOG.md for the v10.0.0-rc.1 release: - Collapsed the v10.0.0-rc.0 section into v10.0.0-rc.1 - Added new entry for PR #973 (`bin/diff-bundler-config` CLI) - Updated version diff links at the bottom of the file ### Pull Request checklist - [x] ~Add/update test to cover these changes~ - [x] ~Update documentation~ - [x] Update CHANGELOG file ### Other Information After merging, run `bundle exec rake release` to publish v10.0.0-rc.1. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Documentation-only change to `CHANGELOG.md`; no runtime or build logic is modified. > > **Overview** > Updates the `CHANGELOG.md` release entry from `v10.0.0-rc.0` to `v10.0.0-rc.1` (dated April 7, 2026) and folds the prior RC notes into the new version section. > > Adds a new changelog item for PR #973 introducing `bin/diff-bundler-config` (semantic bundler config diffs via `pack-config-diff`), and updates the bottom compare links to point `Unreleased` and the RC tag at `v10.0.0-rc.1`. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit b4b93ad. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
* origin/main: (22 commits) docs: add Dependabot configuration guide (#1094) Sync address-review prompt with upstream PR #16 (#1098) Supersede #910: entry shape test with lint unblock (#919) fix: align rspack v2 peer deps and installer defaults (#1091) docs: update README and guides for Shakapacker v10 (#1092) Release 10.0.0 Update CHANGELOG.md for v10.0.0 (#1089) Release 10.0.0-rc.1 Update CHANGELOG.md for v10.0.0-rc.1 (#1087) Supersede #961 by using pack-config-diff (#973) Add final summary output to rake release (#1041) Add bin/setup to install development deps (#1039) Release 10.0.0-rc.0 Use npx release-it to avoid mise shim failures (#1040) Fix Nokogiri build failure on Ruby 3.4.6 (#1038) Update CHANGELOG.md for v10.0.0-rc.0 (#1037) Update rspack dev deps to 2.0.0-rc.0 (#1036) Fix stale and broken documentation across Shakapacker guides (#1023) Allow webpack-cli v7 in peer dependencies (#1021) refactor: simplify resolving js peer versions when installing (#1034) ... # Conflicts: # package.json
* origin/main: docs: add Dependabot configuration guide (#1094) Sync address-review prompt with upstream PR #16 (#1098) Supersede #910: entry shape test with lint unblock (#919) fix: align rspack v2 peer deps and installer defaults (#1091) docs: update README and guides for Shakapacker v10 (#1092) Release 10.0.0 Update CHANGELOG.md for v10.0.0 (#1089) Release 10.0.0-rc.1 Update CHANGELOG.md for v10.0.0-rc.1 (#1087) Supersede #961 by using pack-config-diff (#973) # Conflicts: # CHANGELOG.md # Rakefile

Summary
This PR supersedes #961 by using the extracted
pack-config-diffpackage instead of introducing an in-repoconfigDiffermodule.What changed
bin/diff-bundler-configandlib/install/bin/diff-bundler-configwrappers.pack-config-diffdependency inpackage.json.docs/config-diff.md.README.md(Debugging Configuration section)docs/troubleshooting.mddocs/rspack_migration_guide.mdbin/diff-bundler-config.Behavior notes
pack-config-diffvia shakapacker's dependency tree (usingcreateRequire) so strict package managers (pnpm, Yarn PnP) can find it.Why this supersedes #961
pack-config-diff) and are consumed here via the wrapper.Validation
bundle exec rspec spec/shakapacker/doctor_spec.rbbundle exec rspec spec/shakapacker/engine_rake_tasks_spec.rbnode bin/diff-bundler-config --helpNote
Medium Risk
Adds a new shipped CLI wrapper and a new runtime dependency (
pack-config-diff), plus updates CI/test harness to install viayalc add; risk is mainly around packaging/installation and exit-code behavior in developer/CI workflows.Overview
Introduces a new
bin/diff-bundler-config(and installer template inlib/install/bin/) that wrapspack-config-diffto provide semantic webpack/rspack configuration diffs with normalized exit codes.Updates docs to recommend
bin/diff-bundler-configinstead of rawdiff, adds a dedicateddocs/config-diff.mdguide, and adjustsshakapacker:doctorto treatdiff-bundler-configas an optional binstub (with new specs to keep shared binstubs in sync).CI and rake test tasks switch local package consumption from
yalc link/npm installtoyalc addwithyarn install, and the JS tooling config (knip) is updated to account for the new binstubs/dependency.Reviewed by Cursor Bugbot for commit eef1c25. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
New Features
Documentation
Chores / Tests
CI / Tooling