Skip to content

Rename create_release to release and fix version.rb staging path#986

Merged
justin808 merged 2 commits intomainfrom
jg/fix-changelog-version-in-release
Mar 17, 2026
Merged

Rename create_release to release and fix version.rb staging path#986
justin808 merged 2 commits intomainfrom
jg/fix-changelog-version-in-release

Conversation

@justin808
Copy link
Copy Markdown
Member

@justin808 justin808 commented Mar 17, 2026

Summary

  • Renames create_release task to release, replacing Bundler's default release task. This matches the react_on_rails naming convention — users just run rake release.
  • Fixes git add version.rbgit add lib/shakapacker/version.rb — the path was wrong since the command runs from the repo root, causing fatal: pathspec 'version.rb' did not match any files.
  • Updates all references in docs/releasing.md and the update-changelog command.

Closes #985 context — the release crashed because git add version.rb couldn't find the file at the repo root level.

Test plan

  • rake release shows the custom release task (not Bundler's)
  • rake build and rake install still work from bundler/gem_tasks
  • rake -T release shows correct task name and description
  • No remaining create_release references in codebase
  • RuboCop passes
  • All 14 rake_tasks specs pass

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Updated release guide to reflect new task naming conventions and enhanced workflow
  • Chores
    • Renamed release task from create_release to release throughout the system
    • Enhanced release workflow to automatically detect gem version from CHANGELOG.md when not explicitly provided

Bundler's built-in `release` task reads version.rb directly, bypassing
the custom `create_release` task's CHANGELOG version detection, npm
publish, GitHub release sync, and version policy checks. This caused
releases to use the wrong version when CHANGELOG had been updated.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 17, 2026

Caution

Review failed

Pull request was closed or merged during review

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: 9621b235-3690-4a57-904a-d3afe53c780f

📥 Commits

Reviewing files that changed from the base of the PR and between 34e95ac and 14f0f46.

📒 Files selected for processing (4)
  • .claude/commands/update-changelog.md
  • Rakefile
  • docs/releasing.md
  • rakelib/release.rake

Walkthrough

This pull request renames the rake task from create_release to release and updates all documentation and configuration references accordingly. The release task is enhanced to derive the gem version from CHANGELOG.md when not explicitly provided as an argument.

Changes

Cohort / File(s) Summary
Documentation Updates
.claude/commands/update-changelog.md, docs/releasing.md
Updated all references to the rake task from create_release to release. Reflects the new workflow in command examples, explanatory text, and version-detection patterns that reference CHANGELOG.md.
Rake Configuration
Rakefile, rakelib/release.rake
Clears Bundler's default release task in Rakefile to defer to custom implementation. Renames task from create_release to release, updates gem version file path reference, and adds logic to detect target version from CHANGELOG.md when no explicit version is provided.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A task renamed from old to new,
From create_release to release it flew,
The changelog now speaks the version's name,
Bundler's default cleared—a cleaner game!
Thump thump goes the paw on the release command! 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes: renaming the task from create_release to release and fixing the version.rb staging path, which are the primary objectives of the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jg/fix-changelog-version-in-release
📝 Coding Plan
  • Generate coding plan for human review comments

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
Contributor

greptile-apps bot commented Mar 17, 2026

Greptile Summary

This PR overrides Bundler's built-in rake release task in the Rakefile to prevent maintainers from accidentally bypassing the project's custom rake create_release flow, which handles CHANGELOG version detection, npm publish, GitHub release sync, and version policy enforcement.

  • Rake::Task[:release].clear correctly clears the existing Bundler-defined task (actions + prerequisites) before redefining it — this is the idiomatic Rake pattern for task overriding and is safe because require "bundler/gem_tasks" on line 2 always registers :release before this code runs.
  • The new :release task calls abort with a clear, actionable error message pointing to rake create_release, and exits with a non-zero code as expected.
  • rake build, rake install, and the internal release:guard_clean / release:source_control_push subtasks defined by Bundler are unaffected.
  • The motivation is well-grounded: the scenario described in the PR (CHANGELOG already bumped to v9.7.0 but version.rb still on the old version) would cause Bundler's raw rake release to publish the wrong version.

Confidence Score: 5/5

  • This PR is safe to merge — it is a small, well-scoped guard that only affects the disabled rake release entry point and has no impact on the active release flow or any other tasks.
  • The change is minimal (16 lines added to the Rakefile), uses the standard idiomatic Rake pattern for task overriding (Rake::Task[:task].clear followed by a re-definition), is order-safe given the placement after require "bundler/gem_tasks", and is backed by a clear motivating scenario. No logic paths, data flows, or existing tasks are broken.
  • No files require special attention.

Important Files Changed

Filename Overview
Rakefile Overrides Bundler's default rake release task using Rake::Task[:release].clear and redefines it to abort with a helpful message; implementation is idiomatic, order-safe, and leaves rake build/rake install unaffected.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Developer runs rake release] --> B{Which task?}
    B -->|Old Bundler default| C[Reads version.rb directly]
    B -->|New override in this PR| D[abort with helpful message]
    C --> E[Skips CHANGELOG detection]
    C --> F[Skips npm publish check]
    C --> G[Skips version policy check]
    C --> H[Potential wrong-version release]
    D --> I[Prints: use rake create_release instead]
    I --> J[Exit 1]
    
    K[Developer runs rake create_release] --> L[extract_latest_changelog_version]
    L --> M[validate_release_version_policy!]
    M --> N[verify_npm_auth + verify_gh_auth]
    N --> O[gem bump + bundle install]
    O --> P[release-it npm publish]
    P --> Q[gem release RubyGems]
    Q --> R[sync_github_release_after_publish]
Loading

Last reviewed commit: 20a36d0

@claude
Copy link
Copy Markdown
Contributor

claude bot commented Mar 17, 2026

Review

Clean, well-motivated change. The approach is correct — Rake::Task[:release].clear followed by redefining the task is the canonical Rake pattern for overriding a task defined by a library.

One minor robustness note: Rake::Task[:release].clear will raise a RuntimeError if Bundler ever stops defining the :release task (e.g., a future major Bundler version). A lightweight guard would protect against that:

Rake::Task[:release].clear if Rake::Task.task_defined?(:release)

This is a low-probability scenario, but given that this is in an open-source project that needs to work across a range of Bundler versions, it's worth the one-line defensive check.

Everything else looks good:

  • The error message is clear and actionable
  • rake build / rake install are unaffected (those come from bundler/gem_tasks and aren't cleared)
  • The comment accurately explains the motivation
  • Consistent with the emoji style already used in rakelib/release.rake
  • No CHANGELOG entry needed — this is internal developer tooling, not a user-visible change

- Rename `create_release` task to `release`, replacing Bundler's default
  task. Matches react_on_rails naming convention.
- Fix `git add version.rb` → `git add lib/shakapacker/version.rb` to use
  the correct path from the repo root.
- Update all references in docs/releasing.md and update-changelog command.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@justin808 justin808 changed the title Disable Bundler's rake release to prevent bypassing release flow Rename create_release to release and fix version.rb staging path Mar 17, 2026
@claude
Copy link
Copy Markdown
Contributor

claude bot commented Mar 17, 2026

Review: Rename create_release to release + Fix version.rb Path

This PR is clean, well-scoped, and fixes a real bug. The changes are consistent across all files.

Bug Fix (release.rake line 514)

The git add version.rb -> git add lib/shakapacker/version.rb fix is correct. The original path was relative to the repo root, so staging silently failed — the direct cause of release crashes described in the PR.

Rake Task Override Pattern (Rakefile line 8)

Rake::Task[:release].clear is the standard Rake idiom for overriding a task defined by a dependency. clear removes the existing task's actions and prerequisites, leaving the task registered so rakelib/release.rake can define new actions on it. Load order is correct: Rakefile executes first (clears Bundler's task), then rakelib files load (defines the custom task).

One thing to consider

Looking at rakelib/release.rake line 514, spec/dummy-rspack lockfiles are not staged — only spec/dummy ones are. The Rakefile also has a dummy_rspack spec task. If the rspack dummy app's lockfiles change during a release, this pre-existing omission could cause silent staging failures too. Worth a follow-up audit, though outside the scope of this PR.

All create_release references updated?

Confirmed with a codebase-wide search — no remaining create_release references exist after this PR.

LGTM. The fix is correct, the rename is consistent, and the override pattern is sound.

@justin808 justin808 merged commit 17bf648 into main Mar 17, 2026
27 of 28 checks passed
@justin808 justin808 deleted the jg/fix-changelog-version-in-release branch March 17, 2026 07:46
justin808 added a commit that referenced this pull request Mar 18, 2026
## Summary

- Renames `create_release` task to `release`, replacing Bundler's
default `release` task. This matches the react_on_rails naming
convention — users just run `rake release`.
- Fixes `git add version.rb` → `git add lib/shakapacker/version.rb` —
the path was wrong since the command runs from the repo root, causing
`fatal: pathspec 'version.rb' did not match any files`.
- Updates all references in docs/releasing.md and the update-changelog
command.

Closes #985 context — the release crashed because `git add version.rb`
couldn't find the file at the repo root level.

## Test plan

- [x] `rake release` shows the custom release task (not Bundler's)
- [x] `rake build` and `rake install` still work from bundler/gem_tasks
- [x] `rake -T release` shows correct task name and description
- [x] No remaining `create_release` references in codebase
- [x] RuboCop passes
- [x] All 14 rake_tasks specs pass

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

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

## Summary by CodeRabbit

* **Documentation**
* Updated release guide to reflect new task naming conventions and
enhanced workflow
* **Chores**
* Renamed release task from `create_release` to `release` throughout the
system
* Enhanced release workflow to automatically detect gem version from
CHANGELOG.md when not explicitly provided

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

---------

Co-authored-by: Claude Opus 4.6 <[email protected]>
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