Skip to content

Conversation

justin808
Copy link
Member

@justin808 justin808 commented Oct 2, 2025

Summary

  • Fixed the release rake task to properly handle the entire release workflow
  • Aligned the implementation with react_on_rails pattern for consistency
  • Task now commits version changes, creates tags, and pushes automatically

Problems Fixed

1. Immediate Issue

The release script was failing with "Uncommitted changes found" because:

  • gem bump --no-commit modifies lib/cypress_on_rails/version.rb
  • gem release expects a clean working directory and aborts if there are uncommitted changes

2. Design Issues

  • The actual version wasn't captured for automatic patch bumps
  • Dry-run mode wasn't respected for git operations
  • No automatic tagging or pushing was happening
  • Gemfile.lock wasn't being updated

Solution

Updated the release task to match the react_on_rails pattern:

  1. Bump version with gem bump --no-commit
  2. Read the actual version from the file (handles auto-patch bumps)
  3. Run bundle install to update Gemfile.lock
  4. Commit all changes together (version + Gemfile.lock)
  5. Create a git tag for the release
  6. Push commit and tags to repository
  7. Run gem release to publish

All git operations respect the dry-run flag.

Testing

The release task should now complete successfully without manual intervention.

Note

The RELEASING.md documentation references release:prepare and release:publish tasks that don't exist. This should be addressed in a follow-up PR.

Summary by CodeRabbit

  • Documentation

    • Simplified release instructions to a single command with an optional dry-run.
    • Updated pre-/post-release and rollback guidance to match the unified workflow.
    • Removed legacy multi-step directions and outdated error sections.
  • Chores

    • Streamlined release task to automate version bumping, lockfile updates, commit/tag creation, pushing, and publishing in one flow.
    • Improved dry-run output to clearly describe intended actions without making changes.
    • Ensured consistent tagging and clearer messaging during the release process.

Copy link

coderabbitai bot commented Oct 2, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Consolidates the release process into a single Rake task with optional dry-run, updates documentation accordingly, and revises the release Rake task to handle version bumping, lockfile update, commit, tag, push, and gem publishing with OTP.

Changes

Cohort / File(s) Summary
Docs: Single-task release workflow
RELEASING.md
Rewrites release instructions to a single command: rake release[VERSION,DRY_RUN]. Updates examples, clarifies steps performed by the task, aligns pre/post/rollback guidance, and removes legacy multi-step instructions.
Build tooling: Rake release flow
rakelib/release.rake
Switches gem bump flag to --version, loads actual version from version.rb, runs bundler to update Gemfile.lock, and in non-dry-run: commits bump and lockfile, tags v<version>, pushes, and releases gem (OTP). Dry-run prints intended actions without side effects.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor Dev as Developer
    participant R as Rake release task
    participant B as Bundler
    participant G as Git
    participant GH as GitHub
    participant RG as RubyGems

    Dev->>R: rake release[VERSION,DRY_RUN]
    R->>R: Bump version (--version)
    R->>R: Load actual VERSION from version.rb
    R->>B: bundle install (update Gemfile.lock)

    alt DRY_RUN = true
      R-->>Dev: Print planned actions with resolved version
    else DRY_RUN = false
      R->>G: commit version bump + Gemfile.lock
      R->>G: create tag v<VERSION>
      R->>G: push commits and tags
      G->>GH: update repo and tag
      R->>RG: gem build & push (OTP prompt)
      RG-->>R: publish result
      R-->>Dev: Post-publish changelog reminder
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

I thump my paws: release day’s here,
One hop, one task, the path is clear.
Tags take flight, the gems soon gleam,
OTP blinks—ship the dream!
In tidy trails my changelogs sing—
With one swift rake, I spring. 🐇✨

Pre-merge checks and finishing touches

✅ 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 succinctly describes the primary change by indicating that the release task is being fixed to commit the version bump before performing the gem release, which directly matches the pull request’s core update. It is concise, clear, and specific enough for a teammate scanning the history to understand the main fix without extraneous detail.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-release-commit

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 RuboCop (1.81.1)
rakelib/release.rake

Could not find gem 'rspec' in locally installed gems.
/usr/lib/ruby/3.1.0/bundler/resolver.rb:269:in block in verify_gemfile_dependencies_are_found!' /usr/lib/ruby/3.1.0/bundler/resolver.rb:252:in map!'
/usr/lib/ruby/3.1.0/bundler/resolver.rb:252:in verify_gemfile_dependencies_are_found!' /usr/lib/ruby/3.1.0/bundler/resolver.rb:48:in start'
/usr/lib/ruby/3.1.0/bundler/resolver.rb:23:in resolve' /usr/lib/ruby/3.1.0/bundler/definition.rb:269:in resolve'
/usr/lib/ruby/3.1.0/bundler/definition.rb:468:in materialize' /usr/lib/ruby/3.1.0/bundler/definition.rb:190:in specs'
/usr/lib/ruby/3.1.0/bundler/runtime.rb:85:in block in definition_method' /var/lib/gems/3.1.0/gems/rubocop-1.81.1/lib/rubocop/config_loader_resolver.rb:296:in gem_config_path'
/var/lib/gems/3.1.0/gems/rubocop-1.81.1/lib/rubocop/config_loader_resolver.rb:84:in block (2 levels) in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.81.1/lib/rubocop/config_loader_resolver.rb:82:in reverse_each'
/var/l

... [truncated 270 characters] ...

fig_loader_resolver.rb:76:in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.81.1/lib/rubocop/config_loader.rb:58:in load_file'
/var/lib/gems/3.1.0/gems/rubocop-1.81.1/lib/rubocop/config_store.rb:34:in options_config=' /var/lib/gems/3.1.0/gems/rubocop-1.81.1/lib/rubocop/config_store.rb:29:in apply_options!'
/var/lib/gems/3.1.0/gems/rubocop-1.81.1/lib/rubocop/cli.rb:167:in act_on_options' /var/lib/gems/3.1.0/gems/rubocop-1.81.1/lib/rubocop/cli.rb:49:in block in run'
/var/lib/gems/3.1.0/gems/rubocop-1.81.1/lib/rubocop/cli.rb:87:in profile_if_needed' /var/lib/gems/3.1.0/gems/rubocop-1.81.1/lib/rubocop/cli.rb:45:in run'
/var/lib/gems/3.1.0/gems/rubocop-1.81.1/exe/rubocop:15:in <top (required)>' /usr/local/bin/rubocop:25:in load'
/usr/local/bin/rubocop:25:in `

'


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.

Copy link

claude bot commented Oct 2, 2025

Code Review

Thanks for working on fixing the release task! The approach is on the right track, but there are several issues that need to be addressed before merging.

Critical Issues

1. Commit message will be incorrect for automatic patch bumps

Location: rakelib/release.rake:47

When gem_version is empty (automatic patch bump), the commit message will be incomplete.

Issue: The actual bumped version is not captured after gem bump runs. You need to read the version file after bumping to get the actual version.

Suggested fix: After the bump command, require the version file and read CypressOnRails::VERSION to get the actual version, then use that in the commit message.

2. Dry-run mode not respected

Location: rakelib/release.rake:46-47

The git commit commands run unconditionally, even when is_dry_run is true. This defeats the purpose of dry-run mode.

Suggested fix: Wrap the git commands in an unless is_dry_run block.

Design Concerns

3. Inconsistency with documented release process

The RELEASING.md documentation describes a two-step process where commits are made manually. This PR makes the :release task auto-commit.

Questions:

  • Is the :release task still being used, or has it been superseded?
  • Should the documentation be updated?

What's Good

  • The core logic is correct: version file needs to be committed before gem release
  • The placement of the commit between bump and release is exactly right
  • The PR description clearly explains the problem and solution

Testing Recommendations

  1. Test with explicit version in dry-run mode
  2. Test with automatic bump in dry-run mode
  3. Verify commit messages in both scenarios
  4. Verify that dry-run mode doesn't create commits

Summary

The fix addresses the right problem but needs refinement to handle edge cases properly. Please address the critical issues above before merging.

The gem bump command modifies the version file but the --no-commit
flag means it doesn't commit it. This causes gem release to fail
because it expects a clean working directory.

This commit adds git commands to stage and commit the version file
after bumping but before releasing the gem.
@justin808 justin808 requested a review from Copilot October 2, 2025 05:22
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Fixes the release rake task so that version bumps are committed, tagged, pushed, and then released automatically, resolving prior failure due to uncommitted changes after bumping. Key improvements add explicit version capture, lockfile update, and dry-run handling.

  • Switches gem bump flag from -v to --version and reads the bumped version constant.
  • Adds automated commit, tag, and push steps before running gem release.
  • Introduces dry-run branching (though current implementation still mutates the working tree).

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


unless is_dry_run
# Commit the version bump and Gemfile.lock update
sh_in_dir(gem_root, "git add -A")
Copy link
Preview

Copilot AI Oct 2, 2025

Choose a reason for hiding this comment

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

[nitpick] git add -A may unintentionally include unrelated local changes in the release commit. Restrict the add to the specific intended files, e.g.: git add lib/cypress_on_rails/version.rb Gemfile.lock to avoid accidental inclusion of unrelated modifications.

Suggested change
sh_in_dir(gem_root, "git add -A")
sh_in_dir(gem_root, "git add lib/cypress_on_rails/version.rb Gemfile.lock")

Copilot uses AI. Check for mistakes.

puts "Carefully add your OTP for Rubygems. If you get an error, run 'gem release' again."
sh_in_dir(gem_root, "gem release")
else
puts "DRY RUN: Would have committed, tagged v#{actual_version}, pushed, and released gem"
Copy link
Preview

Copilot AI Oct 2, 2025

Choose a reason for hiding this comment

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

In dry-run mode the task still performs gem bump and bundle install earlier (modifying version.rb and Gemfile.lock), leaving a dirty workspace despite messaging that implies only hypothetical actions. Consider wrapping the bump and bundle install in the same unless is_dry_run block (or revert changes after) so a dry run does not alter the working tree.

Copilot uses AI. Check for mistakes.

@justin808
Copy link
Member Author

@claude review this pr

Copy link

claude bot commented Oct 2, 2025

Claude finished @justin808's task —— View job


Code Review for PR #195

Tasks

  • Read the changed file (rakelib/release.rake)
  • Analyze the implementation
  • Review for bugs and edge cases
  • Provide comprehensive feedback

Review Summary

This PR correctly fixes the immediate issue where gem release fails due to uncommitted changes after gem bump. The implementation adds proper version capture, commits, tagging, and pushing. However, there are two critical issues and one important documentation concern that need to be addressed.


Critical Issues

1. 🔴 Dry-run mode modifies the working tree

Location: rakelib/release.rake:43-50

Problem: Even in dry-run mode, the task executes:

  • gem bump --no-commit (modifies lib/cypress_on_rails/version.rb)
  • bundle install (modifies Gemfile.lock)

This leaves the workspace dirty despite the message saying "Would have committed..." which implies no changes were made.

Impact: Users running dry-run to preview the release will end up with modified files they need to revert manually.

Suggested fix: Wrap the bump and bundle commands in the same unless is_dry_run block, or add cleanup logic to revert changes at the end of a dry run.

unless is_dry_run
  sh_in_dir(gem_root, "gem bump --no-commit --file lib/cypress_on_rails/version.rb #{gem_version.strip.empty? ? '' : %(--version #{gem_version})}")
  
  # Read the actual version from the file after bump
  require_relative "../lib/cypress_on_rails/version"
  actual_version = CypressOnRails::VERSION
  
  # Update Gemfile.lock files
  sh_in_dir(gem_root, "bundle install")
  
  # Commit, tag, push, release...
else
  puts "DRY RUN: Would bump to #{gem_version.strip.empty? ? 'next patch' : gem_version}, commit, tag, push, and release gem"
end

2. ⚠️ git add -A may include unrelated files

Location: rakelib/release.rake:54

Problem: Using git add -A stages ALL changes in the working directory, not just the version bump and Gemfile.lock. If there are any other uncommitted files (IDE configs, temporary files, etc.), they'll be included in the release commit.

Impact: Release commits could accidentally include unrelated changes.

Suggested fix: Be explicit about which files to add:

sh_in_dir(gem_root, "git add lib/cypress_on_rails/version.rb Gemfile.lock")

This matches the copilot reviewer's suggestion and is safer.


Important Documentation Issue

3. 📚 RELEASING.md references non-existent tasks

Location: RELEASING.md:21-24, 31-32, 56-57

Problem: The documentation extensively describes rake release:prepare and rake release:publish tasks, but these tasks do not exist in the codebase. Only rake release exists.

Your PR note acknowledges this: "The RELEASING.md documentation references release:prepare and release:publish tasks that don't exist. This should be addressed in a follow-up PR."

Impact: Users following the documentation will get "task not found" errors. This creates confusion about the correct release process.

Recommendation: Either:

  1. Update this PR to also fix the documentation (preferred), OR
  2. Create a follow-up PR immediately after this one to update the docs

The disconnect between docs and code is significant enough that it shouldn't wait too long.


What's Good ✅

  1. Correctly fixes the root cause: Committing version changes before gem release resolves the "uncommitted changes" error
  2. Proper version capture: Reading CypressOnRails::VERSION after bump handles automatic patch bumps correctly
  3. Complete workflow: Now includes commit, tag, and push operations that were missing
  4. Gemfile.lock update: Good catch to include bundle install to keep the lockfile in sync
  5. Clear commit message: Release v#{actual_version} is descriptive
  6. Flag change: Correcting -v to --version is the right choice (line 43)

Minor Observations

  1. Error handling: Consider what happens if gem release fails after the commit/tag/push. The local and remote repos will have the version bump but the gem won't be published. Users would need to:

    • Fix the issue
    • Run gem release manually

    The message at line 64 helps with this, but you might want to add instructions for this scenario.

  2. Tag annotation: Consider using annotated tags (git tag -a v#{actual_version} -m "Release v#{actual_version}") instead of lightweight tags for better Git history.


Testing Recommendations

Before merging, test:

  1. ✅ Explicit version in dry-run mode (verify no files are modified)
  2. ✅ Automatic patch bump in dry-run mode (verify no files are modified)
  3. ✅ Explicit version in normal mode
  4. ✅ Automatic patch bump in normal mode
  5. ✅ Verify that only version.rb and Gemfile.lock are committed (not other files)

Action Items

Must fix before merge:

Should fix (strongly recommended):


Job RunBranch: fix-release-commit

- Changed git add -A to explicitly add only version.rb and Gemfile.lock
  This prevents accidentally including unrelated files in release commits

- Updated RELEASING.md to match the actual rake task implementation
  The docs referenced non-existent release:prepare and release:publish tasks
  Now correctly documents the single rake release task
Copy link

@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.

Actionable comments posted: 1

🧹 Nitpick comments (2)
RELEASING.md (2)

58-58: Optional: Consider using a Markdown link for the URL.

The bare URL works fine but using a Markdown link would be more consistent with Markdown best practices and silence the linter warning.

-   - Go to the releases page: https://github.com/shakacode/cypress-playwright-on-rails/releases
+   - Go to the [releases page](https://github.com/shakacode/cypress-playwright-on-rails/releases)

As per static analysis hints.


132-145: Add explicit HEAD verification before reset
Include a step to confirm the release commit is at HEAD (e.g., git log --oneline -1) before running git reset --hard HEAD~1.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5e4041d and eb50e3d.

📒 Files selected for processing (2)
  • RELEASING.md (4 hunks)
  • rakelib/release.rake (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
RELEASING.md

58-58: Bare URL used

(MD034, no-bare-urls)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: rails_8
  • GitHub Check: rails_7_2
  • GitHub Check: rails_6_1
  • GitHub Check: claude-review
🔇 Additional comments (8)
rakelib/release.rake (5)

43-43: LGTM! Correct use of --version flag.

The command correctly uses --version (not -v) to specify the version for gem bump. The --no-commit flag appropriately defers committing to allow bundling the version change with Gemfile.lock updates.


49-50: LGTM! Gemfile.lock update is necessary.

Running bundle install after the version bump correctly updates Gemfile.lock to reflect the new gem version, ensuring consistency.


54-54: LGTM! Specific file staging addresses past concern.

The command explicitly stages only lib/cypress_on_rails/version.rb and Gemfile.lock, avoiding the risk of accidentally committing unrelated changes that might exist in the working directory.

Based on past review comments.


67-68: Dry-run implementation correctly avoids filesystem changes.

The dry-run logic correctly skips all git operations and gem release, addressing the past concern about leaving a dirty workspace. Since gem bump --no-commit and bundle install run before the dry-run check, the workspace will be modified, but this is acceptable because:

  1. The initial clean check (lines 30-33) ensures a clean starting state
  2. Users can easily revert with git checkout lib/cypress_on_rails/version.rb Gemfile.lock && bundle install
  3. The dry-run message clearly indicates the version that would be released

Based on past review comments.


52-66: Fail-fast release workflow matches documentation
RELEASING.md specifies that the release task fails fast on errors and can be retried (with dry-run support) after fixing issues, so no additional atomic rollback is needed.

RELEASING.md (3)

13-32: LGTM! Clear documentation of the unified release command.

The documentation clearly describes the single-task release workflow with helpful examples for explicit versions, auto-patch bumps, and dry runs. This aligns well with the implementation in rakelib/release.rake.


34-45: Documentation accurately reflects implementation.

The 7-step workflow description matches the implementation in rakelib/release.rake:

  1. ✓ git pull (line 42)
  2. ✓ version bump (line 43)
  3. ✓ bundle install (line 50)
  4. ✓ commit version + Gemfile.lock (lines 54-55)
  5. ✓ create tag (line 58)
  6. ✓ push commit and tag (line 61)
  7. ✓ publish gem with OTP prompt (lines 64-65)

46-67: Clear post-release workflow documentation.

The post-release steps are well-documented with clear commands for updating CHANGELOG.md, creating GitHub releases, and optional announcements. This provides helpful guidance for completing the release process.

Copy link

claude bot commented Oct 2, 2025

PR Review: Fix release task to commit version bump before gem release - This PR fixes critical issues in the release workflow. Full review with multiple points follows in next comments.

Copy link

claude bot commented Oct 2, 2025

Code Quality - STRENGTHS: Well-structured workflow (bump → bundle → commit → tag → push → release). Clean implementation. Proper dry-run support for all git operations (release.rake:52-67). Good error handling with pre-flight check for uncommitted changes (release.rake:31-33). Documentation improvements are excellent - much clearer release process with practical examples.

Copy link

claude bot commented Oct 2, 2025

CRITICAL ISSUE: Version Constant Caching (release.rake:46-47) - After gem bump modifies the version file, require_relative loads the module, but Ruby constants are cached. If this task runs multiple times in the same process, CypressOnRails::VERSION won't reflect the new value. RECOMMENDATION: Read version directly from file using regex parsing instead of require_relative to avoid caching issues.

Copy link

claude bot commented Oct 2, 2025

Potential Bug: gem bump flag (release.rake:43) - Changed from -v to --version. Please verify with gem-release documentation which is correct. The -v flag is more commonly documented.

Copy link

claude bot commented Oct 2, 2025

Error Recovery Issue (release.rake:61) - Using git push && git push --tags in single command. If first push fails, tags won't be pushed. If first succeeds but tag push fails, you're in inconsistent state. RECOMMENDATION: Split into two separate sh_in_dir calls for better error recovery and clarity.

Copy link

claude bot commented Oct 2, 2025

Security: Command Injection Risk (release.rake:55,58) - Version string is interpolated into shell commands without validation. While gem-release validates format, safer to add explicit version format check or use Shellwords.escape() for defense in depth. Consider: unless actual_version.match?(/\A\d+.\d+.\d+\z/) then raise end

Copy link

claude bot commented Oct 2, 2025

Test Coverage - No automated tests exist for the release task. Optional but consider adding tests for: version parsing logic, dry-run mode behavior, error handling for dirty working directory. Release tasks are difficult to test, so this is low priority.

Copy link

claude bot commented Oct 2, 2025

Additional Suggestions - 1) Consider adding confirmation prompt before pushing to prevent accidental releases. 2) Consider running tests before release (though CI should handle this). 3) If gem release fails after git push (line 61), commit and tags are pushed but gem isn't published - add rescue block with guidance. 4) RELEASING.md could make CI status check more prominent in checklist.

Copy link

claude bot commented Oct 2, 2025

Conclusion - This is a solid improvement! Main concerns: 1) CRITICAL: Fix version constant caching issue. 2) IMPORTANT: Verify --version flag is correct for gem-release. 3) Nice to have: Better error recovery and security hardening. The documentation improvements are excellent and make the release process much clearer. Recommendation: Approve with minor changes requested for the version reading logic. Great work aligning this with the react_on_rails pattern!

Changed from require_relative to load with File.expand_path to ensure
the bumped VERSION constant is properly picked up at runtime after
gem bump modifies the file.

Using load forces Ruby to re-evaluate the file even if it was previously
required, which is necessary since gem bump modifies the version.rb file
during the rake task execution.
Copy link

claude bot commented Oct 2, 2025

Review of PR #195: Fix release task

Strengths

  • Excellent problem analysis identifying the gem bump --no-commit issue
  • Solution aligns with react_on_rails patterns
  • Comprehensive documentation improvements in RELEASING.md

Code Quality Issues

1. Module Loading (rakelib/release.rake:46-47)
Using load may trigger constant warnings. Consider parsing the file directly instead.

2. Git Operations (rakelib/release.rake:61)
Combined push command creates race condition. Should separate: git push then git push --tags

3. Dry Run Mode (rakelib/release.rake:42-50)
Dry run still modifies files via git pull, gem bump, and bundle install. Should be truly read-only.

Security Concerns

  • git pull --rebase could introduce changes without review
  • Gemfile.lock changes auto-committed without verification

Test Coverage

No automated tests for the release task. Should add tests for error conditions, dry-run mode, and version bumping.

Recommendations

Must Fix:

  • Make dry run truly read-only
  • Consider parsing version from file instead of load

Should Fix:

  • Separate git push operations
  • Add branch verification (must be on master/main)

Summary

Approve with recommendations. This significantly improves the release workflow. Core logic is sound but consider the edge cases above.

Copy link

@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.

Actionable comments posted: 1

♻️ Duplicate comments (1)
rakelib/release.rake (1)

43-43: Dry-run still modifies version.rb.

This line executes even when is_dry_run is true, modifying lib/cypress_on_rails/version.rb and leaving the workspace dirty. Wrap this and the subsequent bundle install (line 50) in the same unless is_dry_run block so a dry run performs no file modifications.

Apply this diff to respect dry-run:

-  sh_in_dir(gem_root, "git pull --rebase")
-  sh_in_dir(gem_root, "gem bump --no-commit --file lib/cypress_on_rails/version.rb #{gem_version.strip.empty? ? '' : %(--version #{gem_version})}")
-
-  # Read the actual version from the file after bump
-  load File.expand_path("../lib/cypress_on_rails/version.rb", __dir__)
-  actual_version = CypressOnRails::VERSION
-
-  # Update Gemfile.lock files
-  sh_in_dir(gem_root, "bundle install")
-
-  unless is_dry_run
+  sh_in_dir(gem_root, "git pull --rebase")
+
+  unless is_dry_run
+    sh_in_dir(gem_root, "gem bump --no-commit --file lib/cypress_on_rails/version.rb #{gem_version.strip.empty? ? '' : %(--version #{gem_version})}")
+
+    # Read the actual version from the file after bump
+    load File.expand_path("../lib/cypress_on_rails/version.rb", __dir__)
+    actual_version = CypressOnRails::VERSION
+
+    # Update Gemfile.lock files
+    sh_in_dir(gem_root, "bundle install")
+
     # Commit the version bump and Gemfile.lock update

For the dry-run path, you'll need to determine what version would be bumped. Consider using gem bump --pretend or parsing the current version to display the intended change.

🧹 Nitpick comments (2)
rakelib/release.rake (2)

61-61: Consider atomic push with --follow-tags.

Using git push && git push --tags requires two network round-trips. If the first succeeds but the second fails, you'll have pushed the commit without its tag, requiring manual recovery.

Consider this more atomic alternative:

-    sh_in_dir(gem_root, "git push && git push --tags")
+    sh_in_dir(gem_root, "git push --follow-tags")

This ensures the commit and its associated tag are pushed together in a single operation.


64-65: Gem release error recovery could be clearer.

If the user's OTP is incorrect or expires, gem release will fail. However, re-running gem release alone won't work because the version has already been bumped, committed, and tagged locally. The user would need to either:

  • Re-run the entire rake release task (which would fail the uncommitted changes check), or
  • Manually run gem release from the correct directory after fixing OTP issues.

Consider updating the error guidance to be more specific:

-    puts "Carefully add your OTP for Rubygems. If you get an error, run 'gem release' again."
+    puts "Carefully add your OTP for Rubygems. If you get an error, cd to the gem root and run 'gem release' manually."
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb50e3d and 404fbe9.

📒 Files selected for processing (1)
  • rakelib/release.rake (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: claude-review
  • GitHub Check: rails_7_2
  • GitHub Check: rails_6_1
  • GitHub Check: rails_8
🔇 Additional comments (2)
rakelib/release.rake (2)

45-47: Version reload correctly uses load.

Good - using load instead of require_relative ensures the bumped VERSION constant is picked up at runtime, addressing the previous review concern.


54-54: Specific file paths in git add - correctly addresses past review.

Good - restricting git add to only lib/cypress_on_rails/version.rb Gemfile.lock prevents accidentally committing unrelated local changes.

puts "Carefully add your OTP for Rubygems. If you get an error, run 'gem release' again."
sh_in_dir(gem_root, "gem release")
else
puts "DRY RUN: Would have committed, tagged v#{actual_version}, pushed, and released gem"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

❓ Verification inconclusive

Dry-run message will fail after fixing the workspace modification issue.

After addressing the critical dry-run issue (moving bump/install inside the conditional), actual_version won't be defined in the else branch, causing this line to fail with an undefined variable error.

After applying the fix for line 43, you'll need to determine the version for the dry-run message. Consider one of these approaches:

  1. Parse current version and calculate next version:
else
  # For dry-run, calculate what the version would be
  require_relative "../lib/cypress_on_rails/version"
  current_version = CypressOnRails::VERSION
  if gem_version.strip.empty?
    # Calculate patch bump
    parts = current_version.split('.')
    parts[-1] = (parts[-1].to_i + 1).to_s
    next_version = parts.join('.')
  else
    next_version = gem_version
  end
  puts "DRY RUN: Would have committed, tagged v#{next_version}, pushed, and released gem"
end
  1. Use gem bump --pretend if supported:
else
  output = `cd #{gem_root} && gem bump --pretend --file lib/cypress_on_rails/version.rb #{gem_version.strip.empty? ? '' : %(--version #{gem_version})}`
  # Parse output to get version
  puts "DRY RUN: Would have committed, tagged v<version>, pushed, and released gem"
end

Run this script to check if gem bump supports --pretend:


🏁 Script executed:

#!/bin/bash
gem bump --help | grep -E '(pretend|dry.?run|simulate)' -i

Length of output: 83


Handle undefined actual_version in dry-run branch

After moving the bump/install into the production path, actual_version no longer exists in the else branch and will trigger an undefined variable error. Replace the dry-run message with a manual version calculation (since gem bump --pretend isn’t supported):

else
  require_relative "../lib/cypress_on_rails/version"
  current_version = CypressOnRails::VERSION
  gem_version_strip = gem_version.strip
  next_version = if gem_version_strip.empty?
    parts = current_version.split('.')
    parts[-1] = (parts[-1].to_i + 1).to_s
    parts.join('.')
  else
    gem_version_strip
  end
  puts "DRY RUN: Would have committed, tagged v#{next_version}, pushed, and released gem"
end
🤖 Prompt for AI Agents
In rakelib/release.rake around line 67, the dry-run branch references undefined
actual_version after moving bump/install into the production path; fix by
loading the current gem version (require_relative
"../lib/cypress_on_rails/version" and read CypressOnRails::VERSION), strip
gem_version, and compute next_version: if gem_version is blank, split current
version on '.', increment the last numeric segment and rejoin, otherwise use the
stripped gem_version; then use next_version in the dry-run puts message so no
undefined variable is referenced.

@justin808 justin808 merged commit 2ba5e8d into master Oct 2, 2025
7 checks passed
@justin808 justin808 deleted the fix-release-commit branch October 2, 2025 07:47
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