Skip to content

[codex] Reduce packaged gem files - #1110

Merged
justin808 merged 4 commits into
mainfrom
codex/reduce-gem-package-files
May 11, 2026
Merged

[codex] Reduce packaged gem files#1110
justin808 merged 4 commits into
mainfrom
codex/reduce-gem-package-files

Conversation

@justin808

@justin808 justin808 commented Apr 30, 2026

Copy link
Copy Markdown
Member

Summary

  • Replace the broad git ls-files gem file list with an explicit runtime/install allowlist.
  • Stop publishing repo-only docs, tests, JavaScript package source, CI/tooling files, and test_files metadata in the Ruby gem.
  • Add gemspec coverage for excluded source groups and required installer assets.

Package impact

  • Before: 294 files, 486K generated gem
  • After: 75 files, 123,904 bytes generated gem (~121K)

Fixes #987

Validation

  • bundle exec rspec spec/shakapacker/gemspec_spec.rb
  • bundle exec rubocop shakapacker.gemspec spec/shakapacker/gemspec_spec.rb
  • git diff --check
  • gem build shakapacker.gemspec
  • ruby -rrubygems/package -e 'path = Dir["shakapacker-*.gem"].first; files = Gem::Package.new(path).spec.files; puts "size=#{File.size(path)}"; puts "file_count=#{files.length}"'

Note

Medium Risk
Medium risk because it changes what ships in the published gem; missing required runtime/installer assets would only surface at install/runtime for consumers.

Overview
Switches gem packaging from a broad git ls-files + exclusions to an explicit allowlist (CHANGELOG.md, MIT-LICENSE, README.md, gemspec, lib, sig), and clears s.test_files metadata.

Expands gemspec specs to assert repo-only directories/files (e.g. package/, docs/, test/, node_modules/, spec/, Gemfile.lock) are excluded while required installer assets for shakapacker:install and .rbs signatures remain included.

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

@coderabbitai

coderabbitai Bot commented Apr 30, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@justin808 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 24 minutes and 27 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6e527e48-785d-48ab-827a-e4d9ba322ec7

📥 Commits

Reviewing files that changed from the base of the PR and between e310de5 and ce32605.

📒 Files selected for processing (2)
  • shakapacker.gemspec
  • spec/shakapacker/gemspec_spec.rb
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/reduce-gem-package-files

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.

@claude

claude Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Code Review

Overall: Clean, well-motivated change. Moving from a regex-exclusion filter to an explicit allowlist is easier to reason about, and the size reduction (294 → 75 files, ~486K → ~121K) is significant with no functional regression.


Correctness

Behavioral change in sig/ inclusion

The old gemspec appended Dir.glob("sig/**/*.rbs") — this picks up files regardless of git tracking status. The new git ls-files sig only includes files that have been git added. A developer who creates a new .rbs file and forgets to stage it will see it silently omitted from the published gem. The new RBS test guards against regressions in CI, but it's worth a note in CONTRIBUTING.md (or a comment in the gemspec) for future contributors.

s.test_files = []

test_files is deprecated since RubyGems 2.x and has no effect on modern installs. Explicitly setting it to [] is harmless and makes the intent clear (it replaces the old git ls-files -- test/* evaluation), but it could also simply be removed. Either way is fine.


Test Coverage

The new specs are well-structured and cover the key install assets. One minor gap: lib/install/application.js (the JS entrypoint copied by shakapacker:install) is not listed in the explicit install-assets test, though it is implicitly covered by the "includes lib directory" check.


Side Effects Worth Noting

The new allowlist incidentally drops several root-level files the old regex filter left in:

  • Dropped and correctly so: CLAUDE.md, .rubocop.yml, conductor.json, eslint.config.js, jest.config.js, tsconfig.json, root package.json, Gemfile, Rakefile — dev/tooling files that have no place in a published gem. This is a net improvement.
  • Dropped but debatable: CONTRIBUTING.md — commonly bundled in gems for discoverability. Not a blocker, just worth an intentional decision either way.

Verdict: Looks good to approve once the draft is lifted. The size reduction is meaningful, the tests are solid, and the approach is simpler than what it replaces.

Comment thread shakapacker.gemspec
} + Dir.glob("sig/**/*.rbs")

s.test_files = `git ls-files -- test/*`.split("\n")
s.files = `git ls-files -z CHANGELOG.md MIT-LICENSE README.md shakapacker.gemspec lib sig`.split("\x0")

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.

Note for future contributors: git ls-files sig only includes tracked files. The old approach used Dir.glob("sig/**/*.rbs") which worked even for untracked files. If you add a new .rbs signature file, make sure to git add it before building the gem, otherwise it will be silently excluded from the published package.

Comment thread spec/shakapacker/gemspec_spec.rb Outdated
"lib/install/config/shakapacker.yml",
"lib/install/bin/shakapacker",
"lib/install/bin/shakapacker-dev-server"
)

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.

Consider adding "lib/install/application.js" to this list — it's the default JS entrypoint copied by shakapacker:install and isn't currently covered by the explicit spot-check (though it is implicitly covered by the "includes lib directory" test above).

@claude

claude Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

Code Review

Summary

This PR switches gem packaging from an exclusion-list approach (git ls-files with rejected patterns) to an explicit allowlist — a clear improvement in intentionality and auditability. The 75% size reduction (486K → 121K) is a meaningful win for gem consumers.


Positives

  • Allowlist > exclusion list for packaging. With the old approach, any new file added to the repo was silently included unless someone remembered to extend the exclusion regex. Now new files are excluded by default, which is the right default for a published gem.
  • Fixing test_files to [] is correct. The attribute has been deprecated since RubyGems 3.0 and was previously populated with test files that end-users never needed.
  • sig/ handling is cleaner. The old gemspec bolted on Dir.glob("sig/**/*.rbs") as a separate expression. The new approach folds sig into the single git ls-files call consistently.
  • Spec coverage for install assets (lib/install/template.rb, application.js, etc.) is the most important addition — these are the highest-risk omissions that could break shakapacker:install in production.

Issues

Structural: test_files test is inside the wrong describe block

The new it "does not package test files through test_files metadata" test asserts on gemspec.test_files but lives inside describe "s.files". It should be in its own describe "s.test_files" block for clarity and RSpec organization consistency.

Minor: git availability at gem-build time

The git ls-files shell-out is the same pattern used before, so this is not a regression — but building the gem in a git-less environment (some Docker build layers, certain CI setups) will silently produce an empty file list. A future improvement could guard with File.exist?(".git") or fall back to explicit Dir.glob paths. Not a blocker for this PR.

Minor: install asset coverage in spec is incomplete

The spec asserts six specific install files exist but misses a few others that shakapacker:install could need (e.g., lib/install/binstubs.rb, lib/install/bin/diff-bundler-config, lib/install/bin/shakapacker-watch). Since the allowlist already covers the entire lib/ directory these will always be present, but the spec would be more informative if it covered all binstubs installed to the app's bin/.


Risk Assessment

The PR's own risk note is accurate: the main hazard is a runtime/installer file being unintentionally excluded in a future refactor. The allowlist + explicit spec coverage for critical install assets is a good mitigation. The risk is low — the allowlist is simple and the spec is clear.

Verdict: Approve after the describe block reorganization for the test_files test.

Comment thread spec/shakapacker/gemspec_spec.rb Outdated
expect(rbs_files).not_to be_empty
end

it "does not package test files through test_files metadata" do

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.

This test asserts on gemspec.test_files but is nested inside describe "s.files". Move it into its own sibling block for accurate organization:

Suggested change
it "does not package test files through test_files metadata" do
describe "s.test_files" do
it "is empty" do
expect(gemspec.test_files).to be_empty
end
end

(The closing end for describe "s.files" should come just before this new block.)

@claude

claude Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

Code Review

Overview

This PR replaces a blocklist-based git ls-files approach with an explicit allowlist, shrinking the published gem from ~294 files / 486K to 75 files / 121K (~75% reduction). The approach is cleaner and more intentional than the old regex-reject filter.

Positive

  • The allowlist is easier to reason about and audit than the old blocklist regex.
  • New specs asserting that install assets (lib/install/template.rb, etc.) are present are a good safety net against accidentally shrinking the gem too far.
  • Clearing s.test_files is correct; it is deprecated in RubyGems >= 2.0 and the explicit [] avoids a potential deprecation warning.

Issues / Suggestions

Missing CHANGELOG entry – Per the project guidelines, gem-size reductions are a user-visible improvement and belong in the [Unreleased] section of CHANGELOG.md. A one-liner under ### Changed (e.g. "Reduced packaged gem size from ~486K to ~121K by switching to an explicit file allowlist") with a PR link would be appropriate.

bin/ directory is now silently excluded – The root bin/ (shakapacker-config, diff-bundler-config, etc.) was included in the old gem because the blocklist regex didn't filter it out. With the allowlist it's gone. Since the gemspec has no s.executables defined, this is intentional and correct, but worth a brief note in the PR description or commit message to document the deliberate exclusion. All the install-relevant scripts that users care about are still present under lib/install/bin/ and will be copied by shakapacker:install, so there is no functional regression here.

Pre-existing "excludes" specs are now trivially true – The excludes spec directory and excludes node_modules tests can no longer fail — those paths were simply never added to the allowlist. They're harmless regression guards, but worth knowing they test a structural property of the allowlist rather than an active filter.

Rspack config templates not explicitly testedlib/install/config/rspack/rspack.config.{js,ts} are included via the lib glob but aren't checked in the "includes install assets" spec. Low risk since the broader lib/ test covers them, but adding them alongside the webpack configs would make the spec more complete and symmetric.

Verdict

Good, focused change. The two concrete items to address before merging are the CHANGELOG entry and optionally expanding the install-assets spec to cover the rspack config templates.

Comment thread spec/shakapacker/gemspec_spec.rb Outdated

describe "s.test_files" do
it "is empty" do
expect(gemspec.test_files).to be_empty

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.

test_files is deprecated since RubyGems 2.0 and always returns [] in modern environments, so this spec cannot fail in practice. It's a harmless sanity-check, but consider whether it's worth carrying the maintenance weight. If kept, a brief comment explaining why it's explicitly set to [] (to silence the deprecation warning from the previous git ls-files -- test/* assignment) would help future readers.

Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
@justin808
justin808 marked this pull request as ready for review May 11, 2026 02:21
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@justin808
justin808 merged commit effe049 into main May 11, 2026
29 of 54 checks passed
@justin808
justin808 deleted the codex/reduce-gem-package-files branch May 11, 2026 02:21

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 is ON, but it could not run because the branch was deleted or merged before autofix could start.

Reviewed by Cursor Bugbot for commit ce32605. Configure here.

"lib/install/config/shakapacker.yml",
"lib/install/bin/shakapacker",
"lib/install/bin/shakapacker-dev-server"
"lib/install/bin/shakapacker",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing comma causes silent string concatenation in test

High Severity

A missing comma after "lib/install/bin/shakapacker-dev-server" on line 47 causes Ruby to implicitly concatenate it with the next string literal "lib/install/bin/shakapacker", producing the nonsensical path "lib/install/bin/shakapacker-dev-serverlib/install/bin/shakapacker". This appears to be a copy-paste error — lines 46–47 duplicate lines 48–49. Additionally, the include( opened on line 41 is never closed with ), which is a syntax error.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ce32605. Configure here.

@greptile-apps

greptile-apps Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR replaces the broad git ls-files file selection in shakapacker.gemspec with an explicit allowlist (CHANGELOG.md, MIT-LICENSE, README.md, shakapacker.gemspec, lib/, sig/), shrinking the published gem from ~294 files to ~75. New RSpec examples verify the allowlist and exclusions.

  • shakapacker.gemspec: Clean, minimal change — the explicit allowlist correctly captures all runtime and install assets tracked under lib/ and sig/, and test_files is cleared to an empty array.
  • spec/shakapacker/gemspec_spec.rb: The new "includes install assets" example has two compounding syntax errors (missing comma causing implicit string concatenation, and an unclosed include( parenthesis) that prevent the entire spec file from loading — the key validation step from the PR description will fail with a SyntaxError.

Confidence Score: 2/5

The gemspec change is correct, but the spec file guarding it cannot be loaded due to a syntax error, leaving the new allowlist unvalidated.

The spec file introduced to validate the new allowlist has an unclosed parenthesis and a missing comma that cause a SyntaxError at parse time. Every test in the file is unreachable until fixed, so the stated validation command exits with a load error rather than confirming the gem contents are correct.

spec/shakapacker/gemspec_spec.rb — the 'includes install assets' example block needs both a comma and a closing parenthesis before it can run.

Important Files Changed

Filename Overview
spec/shakapacker/gemspec_spec.rb Adds new inclusion/exclusion specs but has a critical syntax error: missing ) closing include( and a missing comma that triggers implicit string concatenation, making the entire spec file fail to load.
shakapacker.gemspec Replaces broad git ls-files exclusion filter with an explicit allowlist (CHANGELOG.md MIT-LICENSE README.md shakapacker.gemspec lib sig); clears test_files. Logic is correct and sound.

Reviews (1): Last reviewed commit: "Update spec/shakapacker/gemspec_spec.rb" | Re-trigger Greptile

Comment on lines +40 to +54
it "includes install assets needed by shakapacker:install" do
expect(gemspec.files).to include(
"lib/install/template.rb",
"lib/install/application.js",
"lib/install/package.json",
"lib/install/config/shakapacker.yml",
"lib/install/bin/shakapacker",
"lib/install/bin/shakapacker-dev-server"
"lib/install/bin/shakapacker",
"lib/install/bin/shakapacker-dev-server",
"lib/install/config/rspack/rspack.config.js",
"lib/install/config/rspack/rspack.config.ts",
"lib/install/config/webpack/webpack.config.js",
"lib/install/config/webpack/webpack.config.ts"
end

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.

P0 Two syntax bugs make this entire example unparseable at runtime. First, the missing comma after "lib/install/bin/shakapacker-dev-server" on line 47 causes Ruby's implicit adjacent-literal concatenation, turning that line and the next into a single fabricated path "lib/install/bin/shakapacker-dev-serverlib/install/bin/shakapacker" that will never match a real file. Second, the opening include( on line 41 is never closed with ) before end, so Ruby raises SyntaxError: unexpected keyword_end, expecting ')' and the entire spec file fails to load. Together these defeat the stated validation step bundle exec rspec spec/shakapacker/gemspec_spec.rb.

Suggested change
it "includes install assets needed by shakapacker:install" do
expect(gemspec.files).to include(
"lib/install/template.rb",
"lib/install/application.js",
"lib/install/package.json",
"lib/install/config/shakapacker.yml",
"lib/install/bin/shakapacker",
"lib/install/bin/shakapacker-dev-server"
"lib/install/bin/shakapacker",
"lib/install/bin/shakapacker-dev-server",
"lib/install/config/rspack/rspack.config.js",
"lib/install/config/rspack/rspack.config.ts",
"lib/install/config/webpack/webpack.config.js",
"lib/install/config/webpack/webpack.config.ts"
end
it "includes install assets needed by shakapacker:install" do
expect(gemspec.files).to include(
"lib/install/template.rb",
"lib/install/application.js",
"lib/install/package.json",
"lib/install/config/shakapacker.yml",
"lib/install/bin/shakapacker",
"lib/install/bin/shakapacker-dev-server",
"lib/install/config/rspack/rspack.config.js",
"lib/install/config/rspack/rspack.config.ts",
"lib/install/config/webpack/webpack.config.js",
"lib/install/config/webpack/webpack.config.ts"
)
end

Comment on lines +47 to +49
"lib/install/bin/shakapacker-dev-server"
"lib/install/bin/shakapacker",
"lib/install/bin/shakapacker-dev-server",

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.

Bug: missing comma causes implicit string concatenation + duplicate entries

Line 47 is missing a trailing comma, so Ruby silently concatenates the two adjacent string literals into one string:

"lib/install/bin/shakapacker-dev-server" "lib/install/bin/shakapacker"
# => "lib/install/bin/shakapacker-dev-serverlib/install/bin/shakapacker"

That concatenated path doesn't exist, so the assertion is checking for a nonexistent file. Lines 48 and 49 also duplicate the two entries that should have appeared here.

Suggested change
"lib/install/bin/shakapacker-dev-server"
"lib/install/bin/shakapacker",
"lib/install/bin/shakapacker-dev-server",
"lib/install/bin/shakapacker",
"lib/install/bin/shakapacker-dev-server",

Comment on lines +53 to +54
"lib/install/config/webpack/webpack.config.ts"
end

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.

Bug: missing closing ) — syntax error

The include( call opened on line 41 is never closed before end. This is a SyntaxError that prevents the entire spec file from loading, so none of the tests in this file will run.

Suggested change
"lib/install/config/webpack/webpack.config.ts"
end
"lib/install/config/webpack/webpack.config.ts"
)
end

@claude

claude Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

Review: [codex] Reduce packaged gem files

Overview

Great improvement — dropping from 294 → 75 files and 486 K → ~121 K is a meaningful reduction. The explicit allowlist in the gemspec is simpler and safer than the old exclusion-based approach with git ls-files + a regex deny-list.


gemspec change ✅

s.files = `git ls-files -z CHANGELOG.md MIT-LICENSE README.md shakapacker.gemspec lib sig`.split("\x00")

Clean and correct. git ls-files with explicit path arguments only emits tracked files, and silently returns nothing for a path that doesn't exist yet (e.g. sig/ on a fresh checkout), so this is safe. The lib/ subtree covers all install assets; sig/ covers the RBS signatures. No runtime assets appear to have been accidentally dropped.

Clearing s.test_files = [] is also correct — this field has been deprecated since RubyGems 2.x and had no practical effect, but an explicit empty array is better than pointing at non-packaged files.


spec file — two bugs that need a follow-up fix ⚠️

1. Syntax error: missing closing ) (line 54)

The include( call opened on line 41 has no matching ). Ruby raises a SyntaxError at load time, so none of the tests in this file run at all. See inline comment.

2. Missing comma → implicit string concatenation (lines 47–49)

The missing comma between lines 47 and 48 causes Ruby to silently concatenate two adjacent string literals into one:

"lib/install/bin/shakapacker-dev-server"   # no comma!
"lib/install/bin/shakapacker",
# becomes: "lib/install/bin/shakapacker-dev-serverlib/install/bin/shakapacker"

That concatenated path does not exist, so the assertion is checking for a phantom file. The real shakapacker and shakapacker-dev-server entries on lines 45–46 are also duplicated on lines 48–49. See inline comment.

These two bugs together mean the new "includes install assets" test has never actually run. A small follow-up PR to fix the spec is recommended.

@claude

claude Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

Code Review: Reduce packaged gem files

Overview

This PR replaces the broad git ls-files + exclusion pattern with an explicit allowlist in shakapacker.gemspec, resulting in a significant gem size reduction (~486K → ~121K, 294 → 75 files). The gemspec change itself is clean and correct. However, the new spec file introduced in this PR has critical bugs that need a follow-up fix.


gemspec change ✅

The change from:

s.files = `git ls-files -z`.split("\x0").reject { |f|
  f.match(%r{^(test|spec|features|tmp|node_modules|packages|coverage|Gemfile.lock|rakelib)($|/)}) ||
    f.end_with?(".gem")
} + Dir.glob("sig/**/*.rbs")

to:

s.files = `git ls-files -z CHANGELOG.md MIT-LICENSE README.md shakapacker.gemspec lib sig`.split("\x0")

is correct and simpler. All sig/ files are git-tracked, so Dir.glob("sig/**/*.rbs") is no longer needed. The explicit allowlist is safer and easier to reason about.

Minor note: s.test_files = [] works correctly, but test_files has been deprecated since RubyGems 2.5. The line can be removed entirely in a follow-up.


gemspec_spec.rb — Critical Bugs ❌

The new "includes install assets needed by shakapacker:install" example (lines 40–54) has two bugs that survive into the merged code:

1. Missing comma → implicit string concatenation (line 47)

"lib/install/bin/shakapacker-dev-server"   # ← no comma
"lib/install/bin/shakapacker",             # ← adjacent string literal

In Ruby, adjacent string literals without a separator are silently concatenated at parse time, producing the single bogus string "lib/install/bin/shakapacker-dev-servershakapacker". The test is actually asserting the presence of a file that does not exist, so the coverage it appears to provide is phantom coverage.

2. Missing closing ) for include( (line 54)

expect(gemspec.files).to include(
  ...
  "lib/install/config/webpack/webpack.config.ts"
end  # ← closes the `it` block but `include(` is never closed

The include( opened on line 41 is never terminated with ). This is a Ruby syntax error. The entire it block will fail at parse time, meaning none of the listed install assets are actually verified.

These two bugs together mean the install-asset coverage added by this PR provides no real protection — the test either doesn't parse or tests for a nonexistent path.

3. Duplicate entries (lines 45–46 and 48–49)

"lib/install/bin/shakapacker" and "lib/install/bin/shakapacker-dev-server" appear twice.


CI

The Linting check returned FAILURE for this PR. The PR was merged with a known failing check, which likely flagged the rubocop issue in the spec file.


Recommended follow-up

A minimal fix in a follow-up PR:

it "includes install assets needed by shakapacker:install" do
  expect(gemspec.files).to include(
    "lib/install/template.rb",
    "lib/install/application.js",
    "lib/install/package.json",
    "lib/install/config/shakapacker.yml",
    "lib/install/bin/shakapacker",
    "lib/install/bin/shakapacker-dev-server",
    "lib/install/config/rspack/rspack.config.js",
    "lib/install/config/rspack/rspack.config.ts",
    "lib/install/config/webpack/webpack.config.js",
    "lib/install/config/webpack/webpack.config.ts"
  )
end

Comment on lines +40 to +54
it "includes install assets needed by shakapacker:install" do
expect(gemspec.files).to include(
"lib/install/template.rb",
"lib/install/application.js",
"lib/install/package.json",
"lib/install/config/shakapacker.yml",
"lib/install/bin/shakapacker",
"lib/install/bin/shakapacker-dev-server"
"lib/install/bin/shakapacker",
"lib/install/bin/shakapacker-dev-server",
"lib/install/config/rspack/rspack.config.js",
"lib/install/config/rspack/rspack.config.ts",
"lib/install/config/webpack/webpack.config.js",
"lib/install/config/webpack/webpack.config.ts"
end

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.

This it block has two bugs that make it provide no real coverage:

Bug 1 — Missing closing ) for include( (line 54)
The include( opened on line 41 is never closed with ). Ruby sees the end on line 54 and raises a SyntaxError — the block never runs.

Bug 2 — Missing comma causes implicit string concatenation (line 47)

"lib/install/bin/shakapacker-dev-server"   # ← no trailing comma
"lib/install/bin/shakapacker",

Ruby silently concatenates adjacent string literals at parse time, producing "lib/install/bin/shakapacker-dev-servershakapacker". The test would be asserting the existence of a path that never exists.

Bug 3 — Duplicate entries
"lib/install/bin/shakapacker" and "lib/install/bin/shakapacker-dev-server" each appear twice.

Suggested change
it "includes install assets needed by shakapacker:install" do
expect(gemspec.files).to include(
"lib/install/template.rb",
"lib/install/application.js",
"lib/install/package.json",
"lib/install/config/shakapacker.yml",
"lib/install/bin/shakapacker",
"lib/install/bin/shakapacker-dev-server"
"lib/install/bin/shakapacker",
"lib/install/bin/shakapacker-dev-server",
"lib/install/config/rspack/rspack.config.js",
"lib/install/config/rspack/rspack.config.ts",
"lib/install/config/webpack/webpack.config.js",
"lib/install/config/webpack/webpack.config.ts"
end
it "includes install assets needed by shakapacker:install" do
expect(gemspec.files).to include(
"lib/install/template.rb",
"lib/install/application.js",
"lib/install/package.json",
"lib/install/config/shakapacker.yml",
"lib/install/bin/shakapacker",
"lib/install/bin/shakapacker-dev-server",
"lib/install/config/rspack/rspack.config.js",
"lib/install/config/rspack/rspack.config.ts",
"lib/install/config/webpack/webpack.config.js",
"lib/install/config/webpack/webpack.config.ts"
)
end

justin808 added a commit that referenced this pull request May 12, 2026
## Summary

PR #1110 (merged earlier today) introduced a syntax error in
`spec/shakapacker/gemspec_spec.rb`. The new "includes install assets
needed by shakapacker:install" test duplicated two bin entries (with the
first one missing its trailing comma) and omitted the closing `)` for
`include(`. The file no longer parses as Ruby.

This breaks CI on every open PR against main:

- **Linting** (`bundle exec rubocop`): `Lint/Syntax: unexpected token
tSTRING`
- **Testing** (`bundle exec rspec spec/shakapacker/*_spec.rb`): "1 error
occurred outside of examples" — rspec aborts before running any test

## Fix

Removed the duplicated bin lines and added the missing closing paren.

\`\`\`diff
         "lib/install/bin/shakapacker",
-        "lib/install/bin/shakapacker-dev-server"
-        "lib/install/bin/shakapacker",
         "lib/install/bin/shakapacker-dev-server",
         "lib/install/config/rspack/rspack.config.js",
         ...
         "lib/install/config/webpack/webpack.config.ts"
+      )
     end
\`\`\`

## Test plan

- [x] \`bundle exec rubocop\` passes (140 files, no offenses)
- [x] \`bundle exec rspec spec/shakapacker/gemspec_spec.rb\` passes (9
examples, 0 failures)
- [ ] CI green

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: test-only change that fixes a Ruby syntax error which was
preventing lint/spec runs, without impacting runtime code paths.
> 
> **Overview**
> Fixes a syntax error in `spec/shakapacker/gemspec_spec.rb` that was
breaking parsing/CI by removing duplicated `bin` entries in the
`include(...)` list and restoring the missing closing `)` for the
expectation.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
16f02ed. 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.7 (1M context) <noreply@anthropic.com>
justin808 added a commit that referenced this pull request May 21, 2026
## Summary

Stamp the `v10.1.0-rc.0` version header (dated May 20, 2026) on the
existing Unreleased entries and add two missing post-`v10.0.0`
user-visible changes.

### New entries added
- `Changed`: **Slimmed the published gem from ~486K (294 files) to ~121K
(75 files)** — [PR
#1110](#1110)
- `Fixed`: **Detected single-dot (`./...`) local-path declarations in
`NodePackageVersion#find_version`** — [PR
#1106](#1106) (follow-up to
#1086)

### Stamp
- Renamed the existing Unreleased section to `## [v10.1.0-rc.0] - May
20, 2026` and inserted a fresh empty `## [Unreleased]` above it.
- Updated the version diff links at the bottom (`[Unreleased]` now
compares from `v10.1.0-rc.0`; new `[v10.1.0-rc.0]` link compares from
`v10.0.0`).

### Skipped (not user-visible)
- #1118 (prettier formatting), #1109 / #1108 / #1094 / #1092 (docs
only), #1117 (CI bump), #1113 (setup-script internal), #1111 (release
task internal), #1114 (test fix), #1098 (internal prompt sync), #919
(test/lint).

## Test plan
- [x] `yarn lint` passes
- [ ] Reviewer confirms the version stamp + diff links are correct
- [ ] After merge: run `bundle exec rake release` (no args — picks up
`v10.1.0-rc.0` from CHANGELOG.md)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk documentation-only change that updates release notes and
version comparison links with no runtime/code impact.
> 
> **Overview**
> **Prepares release notes for `v10.1.0-rc.0`** by moving the existing
Unreleased items under a new dated `v10.1.0-rc.0` header and adding a
fresh empty `## [Unreleased]` section.
> 
> Also adds two changelog entries (gem package slimming and improved
local-path detection in `NodePackageVersion#find_version`) and updates
the compare links so `[Unreleased]` now diffs from `v10.1.0-rc.0` and a
new `[v10.1.0-rc.0]` link compares against `v10.0.0`.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
f3cf5fa. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
  * Changelog updated for v10.1.0-rc.0 release.

* **Changed**
  * Published package size optimized.

* **Bug Fixes**
  * Rspack React Refresh v2 loading compatibility resolved.
* Node package version resolution improved for local-path dependencies.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/shakacode/shakapacker/pull/1119?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
justin808 added a commit that referenced this pull request May 21, 2026
PR #1110 slimmed shakapacker.gemspec to an explicit allowlist
(CHANGELOG.md MIT-LICENSE README.md shakapacker.gemspec lib sig),
dropping the gem-root package.json. But
lib/tasks/shakapacker/check_node.rake still reads it via
`Pathname.new("#{__dir__}/../../../package.json").realpath` for
the engines.node range. In the installed gem, realpath raised
Errno::ENOENT and the outer rescue printed the misleading
"Node.js not installed. Exiting!" — most visibly during
`rails assets:precompile` via shakapacker:clean → verify_install
→ check_node, even though Node had just run the webpack build.

- shakapacker.gemspec: re-add package.json to the allowlist.
- spec/shakapacker/gemspec_spec.rb: regression test for the
  inclusion so a future trim cannot silently re-break it.
- lib/tasks/shakapacker/check_node.rake: drop .realpath and gate
  the engines-range check on pkg_path.exist?, so a missing file
  no longer masquerades as Node missing.
- CHANGELOG.md: Fixed entry under [Unreleased].

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
justin808 added a commit that referenced this pull request May 21, 2026
PR #1110 slimmed shakapacker.gemspec to an explicit allowlist
(CHANGELOG.md MIT-LICENSE README.md shakapacker.gemspec lib sig),
dropping the gem-root package.json. But
lib/tasks/shakapacker/check_node.rake still reads it via
`Pathname.new("#{__dir__}/../../../package.json").realpath` for
the engines.node range. In the installed gem, realpath raised
Errno::ENOENT and the outer rescue printed the misleading
"Node.js not installed. Exiting!" — most visibly during
`rails assets:precompile` via shakapacker:clean → verify_install
→ check_node, even though Node had just run the webpack build.

- shakapacker.gemspec: re-add package.json to the allowlist.
- spec/shakapacker/gemspec_spec.rb: regression test for the
  inclusion so a future trim cannot silently re-break it.
- lib/tasks/shakapacker/check_node.rake: drop .realpath and gate
  the engines-range check on pkg_path.exist?, so a missing file
  no longer masquerades as Node missing.
- CHANGELOG.md: Fixed entry under [Unreleased].

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
justin808 added a commit that referenced this pull request May 21, 2026
…gem (#1120)

## Summary

- **Root cause:** [PR
#1110](#1110) slimmed
`shakapacker.gemspec` to an explicit allowlist (`CHANGELOG.md
MIT-LICENSE README.md shakapacker.gemspec lib sig`), which dropped the
gem-root `package.json` from the published gem. But
`lib/tasks/shakapacker/check_node.rake` still reads it via
`Pathname.new("#{__dir__}/../../../package.json").realpath` for the
`engines.node` range. In the installed gem `realpath` raises
`Errno::ENOENT`, the outer `rescue Errno::ENOENT` swallows it, and the
task prints the misleading `Node.js not installed. Exiting!` — most
visibly during `bundle exec rails assets:precompile`, since
`react_on_rails` enhances that task to invoke `shakapacker:clean` →
`verify_install` → `check_node` (and Node had just run the webpack build
seconds earlier).
- **Fixes:**
- `shakapacker.gemspec` — re-add `package.json` to the allowlist so the
published gem contains the file `check_node.rake` reads.
- `lib/tasks/shakapacker/check_node.rake` — drop `.realpath` and gate
the engines-range check on `pkg_path.exist?`. If `package.json` is ever
absent again, the task skips the version check rather than blaming Node.
- `spec/shakapacker/gemspec_spec.rb` — regression test asserting
`gemspec.files.include?("package.json")`, so a future allowlist trim
cannot silently re-break this.
  - `CHANGELOG.md` — Fixed entry under `[Unreleased]`.
- **Gem footprint:** went from 75 files (~121K) to 76 files;
`package.json` is ~6.7K, so the slim-gem goal of
[#1110](#1110) is
essentially preserved.

## Repro (before fix)

```
$ mv package.json /tmp/ && cd spec/shakapacker/test_app
$ bundle exec rake shakapacker:check_node
Node.js not installed. Please download and install Node.js https://nodejs.org/en/download/
Exiting!
$ node -v
v22.20.0   # Node was here the whole time
```

## Test plan

- [x] Reproduced the bug on baseline (above).
- [x] After fix: same scenario with `package.json` hidden → `rake
shakapacker:check_node` exits 0 silently (no false Node error).
- [x] Happy path unchanged: `rake shakapacker:check_node` from
`spec/shakapacker/test_app` exits 0.
- [x] `bundle exec rspec spec/shakapacker/gemspec_spec.rb
spec/shakapacker/rake_tasks_spec.rb` → 24 examples, 0 failures.
- [x] `bundle exec rubocop shakapacker.gemspec
lib/tasks/shakapacker/check_node.rake spec/shakapacker/gemspec_spec.rb`
→ 0 offenses.
- [x] `bundle exec gem build shakapacker.gemspec` → succeeds; `tar -tz`
on the resulting gem confirms both `package.json` and
`lib/install/package.json` ship.
- [ ] CI green.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: small packaging + rake-task guard changes that only affect
Node version checking and error messaging when `package.json` is
missing.
> 
> **Overview**
> Fixes `shakapacker:check_node` incorrectly reporting Node as missing
in the published gem by **shipping the gem-root `package.json`** again
and making the task **skip the `engines.node` validation when that file
isn’t present**.
> 
> Adds a regression spec to ensure `package.json` remains included in
`shakapacker.gemspec`, and documents the fix in `CHANGELOG.md`.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
20f8d4b. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Fixed `shakapacker:check_node` task incorrectly reporting "Node.js not
installed" when the gem package was missing `package.json`.
* Gem packaging now includes `package.json` to ensure proper Node.js
version validation.
* Task now gracefully skips version range checks when `package.json` is
unavailable instead of raising errors.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/shakacode/shakapacker/pull/1120?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
justin808 added a commit that referenced this pull request May 21, 2026
## Summary

Stamps the `v10.1.0-rc.1` header and collapses `v10.1.0-rc.0` per the
project's RC collapse convention.

- Renamed `## [v10.1.0-rc.0] - May 20, 2026` → `## [v10.1.0-rc.1] - May
21, 2026`
- Moved the post-rc.0 `Unreleased` Fixed entry for PR #1032
(webpack-dev-server `static` config) into the merged `### Fixed` section
- Dropped the PR #1120 entry (`shakapacker:check_node` regression fix) —
it only fixes a bug introduced by PR #1110 that shipped solely in
`v10.1.0-rc.0`, so users going from `v10.0.0` → `v10.1.0-rc.1` never see
it
- Updated `[Unreleased]` and `[v10.1.0-rc.1]` diff links

## Test plan

- [ ] CI passes
- [ ] Maintainer confirms the rc.0 → rc.1 collapse looks right

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk documentation-only change that updates release notes and
comparison links without affecting runtime code.
> 
> **Overview**
> **Updates `CHANGELOG.md` for the `v10.1.0-rc.1` release.**
> 
> Renames the `v10.1.0-rc.0` section to `v10.1.0-rc.1` (with the new
date), moves the webpack-dev-server `static` fix (PR #1032) from
*Unreleased* into the release’s *Fixed* section, removes the rc.0-only
`shakapacker:check_node` regression note (PR #1120), and updates the
bottom compare links to point at `v10.1.0-rc.1`.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
eaf83d5. 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.7 (1M context) <noreply@anthropic.com>
justin808 added a commit that referenced this pull request May 23, 2026
PR #1110 (gem allowlist) and PR #1120 (added `package.json` to the
allowlist to fix `shakapacker:check_node`) ship together in
v10.1.0-rc.1. Update the rc.1 entry to credit both and reflect the
final allowlist instead of just the PR #1110 state. The earlier
"drop PR #1120" change (PR #1124) is now superseded.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
justin808 added a commit that referenced this pull request May 23, 2026
## Summary

Follow-up to #1124. Per maintainer feedback ("we might just merge both
entries"), update the `v10.1.0-rc.1` changelog so the PR #1110 entry
reflects the **final shipped state** instead of dropping the PR #1120
fix entirely.

- Credit both PRs in the link list: `[PR #1110](…), [PR #1120](…)`
- Add `package.json` to the documented allowlist — that's what actually
ships in v10.1.0-rc.1 thanks to PR #1120

This is a docs-only change. The released gem and tag are unaffected. If
you want the GitHub release notes for v10.1.0-rc.1 to reflect this too,
the release notes need to be edited on GitHub after this merges.

The companion `/update-changelog` command update in #1125 already
prefers this "merge into the original PR entry" approach over "drop
entirely".

## Test plan

- [ ] Maintainer confirms the merged entry reads correctly

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Docs-only change updating a single changelog entry; no runtime code or
packaging behavior is modified.
> 
> **Overview**
> Updates the `v10.1.0-rc.1` changelog entry for the gem size reduction
to reflect the final shipped state by **crediting both** [PR #1110] and
[PR #1120] and by **including `package.json`** in the documented gem
file allowlist.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
76d3a20. 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.7 (1M context) <noreply@anthropic.com>
justin808 added a commit that referenced this pull request May 24, 2026
## Summary

When collapsing prereleases (e.g., `v10.1.0-rc.0` → `v10.1.0-rc.1`), a
fix for a bug introduced by a PR that only ever shipped in the
prerelease train is invisible to consumers of the last stable release.
Listing it under the new RC/release header just adds noise.

This PR updates `.claude/commands/update-changelog.md` so the command:

- **Excludes RC-only regression fixes** in the "Do NOT add entries for"
list (with a forward-reference to the detailed rule)
- **Adds a dedicated step** in the RC/beta collapse procedure that walks
through detecting and dropping these entries, with the rc.0 → rc.1
example
- **Requires surfacing dropped entries in the final summary** so the
maintainer can override case-by-case (e.g., keep one for RC testers)

## Motivation

Caught while stamping `v10.1.0-rc.1` in #1124. PR #1120 fixes a
regression introduced by PR #1110 (gem-file allowlist), which itself
only shipped in `v10.1.0-rc.0`. Users on `v10.0.0` jumping straight to
`v10.1.0-rc.1` never see the bug, so PR #1120's fix is internal RC churn
rather than a user-facing change. The previous version of the command
would have kept it in the changelog.

## Test plan

- [ ] Maintainer review of the prose
- [ ] Try the next `/update-changelog rc` invocation and confirm the
model now asks about (or silently drops) RC-only regression fixes

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: documentation/procedure updates only, affecting how
changelog entries are curated during RC/beta version stamping.
> 
> **Overview**
> Updates the `/update-changelog` instructions to **avoid standalone
changelog entries for RC-only regression fixes** (fixes that only undo a
regression introduced earlier in the same prerelease train).
> 
> Adds a dedicated prerelease-collapsing step that directs the
maintainer to **merge such fixes into the original prerelease PR entry
(or drop them if redundant)**, and to **explicitly list any
merged/dropped items in the final summary** for review/override.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
08b4488. 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.7 (1M context) <noreply@anthropic.com>
justin808 added a commit that referenced this pull request May 24, 2026
…coverage-v1

* origin/main:
  Teach /update-changelog to drop RC-only regression fixes (#1125)
  Restructure supplemental package dependencies (#1131) (#1133)
  [codex] Add Shakapacker brand assets (#1135)
  [codex] Fix shakapacker config helper binstubs (#1132)
  Surface v10.1 supplemental packages from README and key docs (#1134)
  CHANGELOG: merge PR #1120 into PR #1110 entry for v10.1.0-rc.1 (#1126)

# Conflicts:
#	lib/install/bin/diff-bundler-config
#	lib/install/bin/shakapacker-config
#	package/configExporter/cli.ts
#	spec/dummy/bin/shakapacker-config
#	spec/shakapacker/binstub_sync_spec.rb
#	spec/shakapacker/helper_binstubs_spec.rb
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.

Reduce the amount of stuff included in the published gem

1 participant