Skip to content

Improve release script: remove OTP sleep, conditional changelog message#2587

Merged
justin808 merged 1 commit intomasterfrom
jg/release-script-improvements
Mar 11, 2026
Merged

Improve release script: remove OTP sleep, conditional changelog message#2587
justin808 merged 1 commit intomasterfrom
jg/release-script-improvements

Conversation

@justin808
Copy link
Copy Markdown
Member

@justin808 justin808 commented Mar 11, 2026

Summary

  • Remove unnecessary 5-second sleep between gem publishes — the retry logic already handles OTP failures by prompting for a fresh code
  • Make the "Next steps" changelog message conditional: show a checkmark when the CHANGELOG.md section already exists, only suggest /update-changelog when missing
  • Refactor the completion message from a heredoc to direct puts calls for cleaner formatting

Test plan

  • All 26 release rake helper specs pass
  • RuboCop passes with no offenses
  • Verify output formatting during next real or dry-run release

🤖 Generated with Claude Code


Note

Medium Risk
Touches the release automation path for publishing gems/npm packages; removing the inter-gem delay and changing post-release messaging could affect real release runs if OTP timing/CLI behavior differs from assumptions.

Overview
Removes the fixed 5-second pause between publishing react_on_rails and react_on_rails_pro gems, relying on the existing retry/OTP re-prompt flow instead.

Refactors the end-of-release output from a heredoc into explicit puts calls and makes the changelog guidance conditional: prints a success line when CHANGELOG.md already contains the released version section, otherwise prints the “Next steps” instructions.

Written by Cursor Bugbot for commit 30823d5. Configure here.

Summary by CodeRabbit

  • Chores
    • Streamlined release process by eliminating a 5-second delay before package publication.
    • Improved release feedback with detailed line-by-line console output.
    • Added smart messaging that validates release documentation and provides tailored next steps guidance based on documentation status.

- Remove unnecessary 5-second sleep between gem publishes. The retry
  logic already handles OTP failures by prompting for a fresh code.
- Make the "Next steps" changelog message conditional: show a checkmark
  when the changelog section already exists, only suggest updating it
  when the section is missing.
- Replace heredoc-based message with direct puts for cleaner formatting.

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

coderabbitai Bot commented Mar 11, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fb887226-75a9-42a5-960d-8e190ad6de34

📥 Commits

Reviewing files that changed from the base of the PR and between c7a86c9 and 30823d5.

📒 Files selected for processing (1)
  • rakelib/release.rake

Walkthrough

Modified the release task in rakelib/release.rake to remove a 5-second OTP delay before publishing, replace the release completion message with line-by-line output, and add conditional messaging based on whether a CHANGELOG.md section exists for the released version.

Changes

Cohort / File(s) Summary
Release Task Refinement
rakelib/release.rake
Removed pre-publish sleep delay; replaced consolidated completion message with explicit line-by-line console output; added logic to detect CHANGELOG.md section existence and conditionally display either confirmation or "Next steps" guidance accordingly.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 The publish task now hops with grace,
No sleepy delays in this space,
Changelog detection, conditional cheer—
Clear guidance for what comes near! ✨

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jg/release-script-improvements

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.

@justin808 justin808 merged commit bf44209 into master Mar 11, 2026
21 of 22 checks passed
@justin808 justin808 deleted the jg/release-script-improvements branch March 11, 2026 03:43
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Mar 11, 2026

Greptile Summary

This PR makes two focused improvements to rakelib/release.rake: it removes the 5-second sleep between the two gem publishes (now redundant because publish_gem_with_retry already prompts for a fresh OTP on failure), and it refactors the post-release completion message to conditionally show either a "✓ found" confirmation or a "Next steps" guide depending on whether a CHANGELOG.md section already exists for the released version.

Key points:

  • The sleep removal is well-reasoned — retry logic in publish_gem_with_retry handles expired/reused OTP codes by prompting interactively, making the delay unnecessary.
  • The conditional changelog message is a nice UX improvement; it avoids showing the /update-changelog prompt when the operator has already prepared the changelog entry.
  • extract_changelog_section is called twice with identical arguments: once inside sync_github_release_after_publish and once again at line 915. Both results are independently computed, which is slightly redundant (two file reads of CHANGELOG.md).
  • The truthiness check on has_changelog_section treats an empty string "" (section header exists but no body) as "found", which is consistent with how sync_github_release_after_publish handles the same case, but could give a false sense of completeness if a changelog header is present but has no content.

Confidence Score: 4/5

  • Safe to merge — changes are limited to release tooling with no impact on library code or end users.
  • The PR is narrowly scoped to a single rake file, all 26 specs pass, and RuboCop is clean. The sleep removal is backed by the existing retry-and-prompt logic. The two identified issues (duplicate file read and empty-section truthiness edge case) are minor style concerns in a release script, not correctness bugs.
  • No files require special attention beyond the two minor style notes in rakelib/release.rake.

Important Files Changed

Filename Overview
rakelib/release.rake Removes the 5-second OTP sleep between gem publishes (justified by existing retry logic), and adds a conditional post-release changelog status message. Two minor style issues: extract_changelog_section is called twice reading the same file, and an empty changelog section header is treated as "found" due to Ruby's truthy empty string.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Release complete] --> B[sync_github_release_after_publish]
    B --> C{CHANGELOG section\nexists?}
    C -- No --> D[Print: Skipping GitHub release\nReturn early]
    C -- Yes --> E[Create/Update GitHub Release]
    E --> F[extract_changelog_section\ncalled AGAIN line 915]
    D --> F
    F --> G{has_changelog_section\ntruthiness check}
    G -- truthy\nnon-nil string,\nincludes empty string --> H["✓ CHANGELOG.md section found\nfor {version}"]
    G -- nil --> I[Print Next steps:\nOption A: /update-changelog\nOption B: Manual steps]
Loading

Last reviewed commit: 30823d5

Comment thread rakelib/release.rake
Comment on lines +914 to +915
changelog_path = File.join(monorepo_root, "CHANGELOG.md")
has_changelog_section = extract_changelog_section(changelog_path: changelog_path, version: released_gem_version)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant extract_changelog_section file read

extract_changelog_section is already called internally by sync_github_release_after_publish (line 477 of the same file). This means CHANGELOG.md is read and parsed twice in a row with identical arguments. The result from that internal call is discarded and not returned to the caller.

Since this is a release script (not a hot path), the double file read isn't a correctness issue, but it is unnecessary. Consider refactoring sync_github_release_after_publish to return the extracted section so it can be reused, or caching the result:

# Instead of calling extract_changelog_section a second time, refactor
# sync_github_release_after_publish to return the section it already extracts.
changelog_section = sync_github_release_after_publish(...)
has_changelog_section = !changelog_section.nil?

Alternatively, just call extract_changelog_section once before sync_github_release_after_publish and pass the result in.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment thread rakelib/release.rake
Comment on lines +932 to +943
if has_changelog_section
puts "Changelog: ✓ CHANGELOG.md section found for #{released_gem_version}"
else
puts "Next steps:"
puts " Option A - Use Claude Code (recommended):"
puts " Run /update-changelog to analyze commits, write entries, and create a PR"
puts ""
puts " Option B - Manual:"
puts " 1. Ensure CHANGELOG.md entries are complete"
puts " 2. Push any follow-up changelog fixes if needed"
end
puts ""
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Empty changelog section treated as present

extract_changelog_section returns the content of the section as a string (or nil when no header is found). If the header ### [x.y.z] exists but has no body, the function returns "" (an empty string after .strip). In Ruby, "" is truthy, so if has_changelog_section evaluates to true and the script prints "✓ CHANGELOG.md section found" even when the section contains no actual release notes.

This is the same assumption made by sync_github_release_after_publish, so the behaviour is at least consistent. However, it can give a false sense of completeness. Consider an explicit nil? check or checking !has_changelog_section.to_s.empty? to distinguish a missing section from an empty one:

if has_changelog_section && !has_changelog_section.empty?
  puts "Changelog: ✓ CHANGELOG.md section found for #{released_gem_version}"
else
  # show next-steps prompt
end

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Mar 11, 2026

Post-merge Review

Overall this is a clean improvement — removing the sleep 5 in favour of the existing retry/re-prompt flow is the right call, and making the changelog message conditional is a nice UX win. Two issues worth following up on:

Bug: empty changelog section shows false-positive ✓

extract_changelog_section returns "" (an empty string) when a ### [X.Y.Z] header exists in CHANGELOG.md but has no body lines. In Ruby "" is truthy, so has_changelog_section will be truthy and the script will print ✓ CHANGELOG.md section found for X.Y.Z even when the section is completely empty. In practice a release with an empty section would still fail later (GitHub release notes would be blank), but the terminal output would be misleading.

A minimal fix is to check for a non-empty string:

has_changelog_section = extract_changelog_section(changelog_path: changelog_path, version: released_gem_version)
# ...
if has_changelog_section && !has_changelog_section.empty?

Or change extract_changelog_section to return nil instead of "" when the content strips to empty.

Inefficiency: CHANGELOG.md is read twice

sync_github_release_after_publish (called at line 912) already calls extract_changelog_section internally. The very next two lines call it again on the same file. The result from the first read is thrown away. The simplest fix would be to have sync_github_release_after_publish return the section string (or nil) so the caller can reuse it.

Minor: sleep 5 removal

The removal is well-reasoned — publish_gem_with_retry returns the last used OTP and passes it to the next publication, and will re-prompt on failure. No functional issue, but it's worth keeping in mind that back-to-back publications within the same 30-second TOTP window may hit a "OTP already used" rejection on some RubyGems server configurations. The retry loop handles that gracefully, so the UX cost is at most one extra OTP prompt.

Comment thread rakelib/release.rake
1. Ensure CHANGELOG.md entries are complete
2. Push any follow-up changelog fixes if needed
changelog_path = File.join(monorepo_root, "CHANGELOG.md")
has_changelog_section = extract_changelog_section(changelog_path: changelog_path, version: released_gem_version)
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.

Potential false-positive: extract_changelog_section returns "" (empty string) when the ### [X.Y.Z] header exists but has no body content. Since "" is truthy in Ruby, has_changelog_section will be truthy and the if branch below will print ✓ CHANGELOG.md section found even for a completely empty section.

Consider guarding with:

Suggested change
has_changelog_section = extract_changelog_section(changelog_path: changelog_path, version: released_gem_version)
has_changelog_section = extract_changelog_section(changelog_path: changelog_path, version: released_gem_version)
has_changelog_section = nil if has_changelog_section&.empty?

Or alternatively, fix extract_changelog_section to return nil when the stripped content is blank.

Comment thread rakelib/release.rake
Comment on lines +914 to +915
changelog_path = File.join(monorepo_root, "CHANGELOG.md")
has_changelog_section = extract_changelog_section(changelog_path: changelog_path, version: released_gem_version)
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.

Duplicate CHANGELOG.md read: sync_github_release_after_publish (called two lines above) already calls extract_changelog_section on the same file internally (release.rake:477). This reads and parses the file a second time for no additional benefit.

A cleaner solution would be for sync_github_release_after_publish to return the section string so the caller can reuse it, avoiding the double I/O.

justin808 added a commit that referenced this pull request Mar 13, 2026
…k cleanup (#2596)

## Summary
- Added missing changelog entries for PRs #2439, #2477, #2554
- Stamped version header for 16.4.0.rc.9 (collapsed rc.8 into rc.9)
- **Fixed rake task bug**: `collapse_prerelease_sections` removed
section headers but left behind orphaned compare links at the bottom of
CHANGELOG.md. Added `cleanup_collapsed_prerelease_links` to remove these
links and update `[unreleased]` to compare from the last stable version.

## Changes
1. **CHANGELOG.md**: New entries + rc.9 stamp + removed orphaned
`[16.4.0.rc.8]` link
2. **update_changelog.rake**: Added `cleanup_collapsed_prerelease_links`
function, called from `prepare_changelog_for_auto_version`
3. **update_changelog_rake_helpers_spec.rb**: 3 new tests covering link
cleanup (multi-prerelease chain, single prerelease, no prereleases)

## Skipped PRs (not user-visible)
- #2593 — test only (lock instrumentation)
- #2591 — test only (Jest clearMocks)
- #2588 — internal refactoring (Thor shell output)
- #2584 — docs restructuring
- #2587 — internal tooling (release script)
- #2589 — docs fix (JWT claim name)
- #2586 — docs/CI (dead link removal)

## Test plan
- [x] All 13 rake helper tests pass (3 new)
- [ ] CI passes
- [ ] After merge, run `rake release` to publish 16.4.0.rc.9

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

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

## Summary by CodeRabbit

* **Bug Fixes**
  * Fixed bin/setup failing in pnpm workspace member directories.

* **New Features**
* Added host configuration option for the Node Renderer Fastify worker.

* **Improvements / Changed**
* Automatic installation of react_on_rails_pro enabled for --rsc/--pro
flags.
* Clarified Pro-installation signaling related to immediate hydration
warnings.
* Updated changelog to include RC9 entries and ensure Unreleased links
point to the correct base.

* **Documentation**
* Added startup warning and remediation guidance for unsafe compression
middleware callbacks.

* **Tests**
  * Added tests covering changelog prerelease-link cleanup behavior.

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

---------

Co-authored-by: Claude Opus 4.6 <[email protected]>
justin808 added a commit that referenced this pull request Mar 30, 2026
…k cleanup (#2596)

## Summary
- Added missing changelog entries for PRs #2439, #2477, #2554
- Stamped version header for 16.4.0.rc.9 (collapsed rc.8 into rc.9)
- **Fixed rake task bug**: `collapse_prerelease_sections` removed
section headers but left behind orphaned compare links at the bottom of
CHANGELOG.md. Added `cleanup_collapsed_prerelease_links` to remove these
links and update `[unreleased]` to compare from the last stable version.

## Changes
1. **CHANGELOG.md**: New entries + rc.9 stamp + removed orphaned
`[16.4.0.rc.8]` link
2. **update_changelog.rake**: Added `cleanup_collapsed_prerelease_links`
function, called from `prepare_changelog_for_auto_version`
3. **update_changelog_rake_helpers_spec.rb**: 3 new tests covering link
cleanup (multi-prerelease chain, single prerelease, no prereleases)

## Skipped PRs (not user-visible)
- #2593 — test only (lock instrumentation)
- #2591 — test only (Jest clearMocks)
- #2588 — internal refactoring (Thor shell output)
- #2584 — docs restructuring
- #2587 — internal tooling (release script)
- #2589 — docs fix (JWT claim name)
- #2586 — docs/CI (dead link removal)

## Test plan
- [x] All 13 rake helper tests pass (3 new)
- [ ] CI passes
- [ ] After merge, run `rake release` to publish 16.4.0.rc.9

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

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

## Summary by CodeRabbit

* **Bug Fixes**
  * Fixed bin/setup failing in pnpm workspace member directories.

* **New Features**
* Added host configuration option for the Node Renderer Fastify worker.

* **Improvements / Changed**
* Automatic installation of react_on_rails_pro enabled for --rsc/--pro
flags.
* Clarified Pro-installation signaling related to immediate hydration
warnings.
* Updated changelog to include RC9 entries and ensure Unreleased links
point to the correct base.

* **Documentation**
* Added startup warning and remediation guidance for unsafe compression
middleware callbacks.

* **Tests**
  * Added tests covering changelog prerelease-link cleanup behavior.

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

---------

Co-authored-by: Claude Opus 4.6 <[email protected]>
justin808 added a commit that referenced this pull request Apr 6, 2026
…k cleanup (#2596)

## Summary
- Added missing changelog entries for PRs #2439, #2477, #2554
- Stamped version header for 16.4.0.rc.9 (collapsed rc.8 into rc.9)
- **Fixed rake task bug**: `collapse_prerelease_sections` removed
section headers but left behind orphaned compare links at the bottom of
CHANGELOG.md. Added `cleanup_collapsed_prerelease_links` to remove these
links and update `[unreleased]` to compare from the last stable version.

## Changes
1. **CHANGELOG.md**: New entries + rc.9 stamp + removed orphaned
`[16.4.0.rc.8]` link
2. **update_changelog.rake**: Added `cleanup_collapsed_prerelease_links`
function, called from `prepare_changelog_for_auto_version`
3. **update_changelog_rake_helpers_spec.rb**: 3 new tests covering link
cleanup (multi-prerelease chain, single prerelease, no prereleases)

## Skipped PRs (not user-visible)
- #2593 — test only (lock instrumentation)
- #2591 — test only (Jest clearMocks)
- #2588 — internal refactoring (Thor shell output)
- #2584 — docs restructuring
- #2587 — internal tooling (release script)
- #2589 — docs fix (JWT claim name)
- #2586 — docs/CI (dead link removal)

## Test plan
- [x] All 13 rake helper tests pass (3 new)
- [ ] CI passes
- [ ] After merge, run `rake release` to publish 16.4.0.rc.9

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

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

## Summary by CodeRabbit

* **Bug Fixes**
  * Fixed bin/setup failing in pnpm workspace member directories.

* **New Features**
* Added host configuration option for the Node Renderer Fastify worker.

* **Improvements / Changed**
* Automatic installation of react_on_rails_pro enabled for --rsc/--pro
flags.
* Clarified Pro-installation signaling related to immediate hydration
warnings.
* Updated changelog to include RC9 entries and ensure Unreleased links
point to the correct base.

* **Documentation**
* Added startup warning and remediation guidance for unsafe compression
middleware callbacks.

* **Tests**
  * Added tests covering changelog prerelease-link cleanup behavior.

<!-- 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