Skip to content

Add final summary output to rake release#1041

Merged
justin808 merged 3 commits intomainfrom
jg/rake-release-summary
Apr 3, 2026
Merged

Add final summary output to rake release#1041
justin808 merged 3 commits intomainfrom
jg/rake-release-summary

Conversation

@justin808
Copy link
Copy Markdown
Member

@justin808 justin808 commented Apr 2, 2026

Summary

Adds an end-of-run summary for rake release in both dry-run and real release flows, matching the style used in react_on_rails. It also updates the release flow to return release metadata so the summary can be printed after all release steps complete.

Pull Request checklist

  • Add/update test to cover these changes
  • Update documentation
  • Update CHANGELOG file

Other Information

Validated locally with ruby -c rakelib/release.rake, bundle exec rake -T release, and bundle exec rubocop rakelib/release.rake.


Note

Medium Risk
Changes the release automation path (staging, changelog lookup, and GitHub release sync), which can affect published artifacts and post-publish steps if the new metadata/summary logic is incorrect.

Overview
Adds a final, human-readable summary to rake release for both dry runs and real releases, including the resolved gem/npm versions, which files were staged/updated, and whether a matching CHANGELOG.md section exists (with next-step guidance when missing).

Refactors the release flow to return release metadata (versions, staged files, changelog presence) and uses it to avoid re-parsing the changelog during GitHub release sync by passing an optional pre-extracted changelog_section. Staging of release-related files is centralized via release_staged_files and staged using a generated git add command.

Written by Cursor Bugbot for commit 269a4a9. This will update automatically on new commits. Configure here.

Summary by CodeRabbit

  • Chores
    • Enhanced release process to provide a consolidated post-release summary after runs.
    • Dry-run mode now lists which files would be staged and shows the next command to run.
    • Live releases report published gem and npm versions and indicate whether a changelog section was found, with follow-up instructions when missing.
    • Staged-file handling and changelog detection improved for more accurate summaries.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 2, 2026

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: 13aadeda-8585-488f-b789-cde537c49a85

📥 Commits

Reviewing files that changed from the base of the PR and between 09bbd92 and 269a4a9.

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

Walkthrough

Adds release tracking and summary to the rake release flow: collects staged files, captures released gem and npm versions, extracts the relevant CHANGELOG.md section, passes it to GitHub sync, and prints a consolidated post-run summary that distinguishes dry-run from live runs.

Changes

Cohort / File(s) Summary
Release Rake Task
rakelib/release.rake
Added release_staged_files and print_release_summary(release_result) helpers. Updated sync_github_release_after_publish(...) signature to accept changelog_section:. perform_release(...) now initializes tracking state, builds git add #{Shellwords.join(staged_files)}, records released_npm_version and released_gem_version, extracts changelog_section_found for the released version and passes it to sync_github_release_after_publish, and returns a hash { dry_run, released_gem_version, released_npm_version, changelog_section_found, staged_files }. The :release task captures this result and calls print_release_summary.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I nudge the changelog, stamp the tag,

I list the files and never lag,
Gems and npm twinkle in a row,
Dry-run hums, live-run steals the show.

🚥 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 'Add final summary output to rake release' directly and accurately summarizes the main change: adding a summary output feature to the rake release task.
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/rake-release-summary

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
Copy Markdown

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

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

656-662: Please add coverage for the new release summary flow.

This task wiring changed observable behavior (Line 661) and depends on the new return payload shape from perform_release; add tests for dry-run and live summary branches to guard against regressions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rakelib/release.rake` around lines 656 - 662, Add unit tests that cover the
new release summary flow by asserting the return payload shape from
perform_release and the behavior of print_release_summary for both dry-run and
live releases: mock or stub perform_release to return the new payload structure
and verify print_release_summary is called with the expected release_result when
is_dry_run=true (dry-run branch) and when is_dry_run=false (live branch), and
include assertions for any added fields on release_result that the rake task now
relies on to prevent regressions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@rakelib/release.rake`:
- Around line 656-662: Add unit tests that cover the new release summary flow by
asserting the return payload shape from perform_release and the behavior of
print_release_summary for both dry-run and live releases: mock or stub
perform_release to return the new payload structure and verify
print_release_summary is called with the expected release_result when
is_dry_run=true (dry-run branch) and when is_dry_run=false (live branch), and
include assertions for any added fields on release_result that the rake task now
relies on to prevent regressions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 74f6e2ba-8c60-499c-a292-480ceea3900f

📥 Commits

Reviewing files that changed from the base of the PR and between f4187f7 and 5bb191e.

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

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 2, 2026

Greptile Summary

This PR adds a final summary output to rake release by (1) capturing release metadata (released_npm_version, changelog_section_found) inside perform_release, (2) returning that metadata as a hash, and (3) introducing print_release_summary to print a human-readable recap for both dry-run and real release flows. The implementation is correct — abort guards ensure print_release_summary is only reached with fully-populated data, and the changelog detection reuses the existing extract_changelog_section helper.

Confidence Score: 5/5

  • Safe to merge; all findings are minor style and maintenance suggestions with no correctness impact.
  • No P0 or P1 issues found. The two P2 comments cover a hardcoded file list that may drift over time and a minor redundancy in "Next steps" messaging when no changelog section exists — neither affects release correctness or data integrity.
  • No files require special attention.

Important Files Changed

Filename Overview
rakelib/release.rake Adds print_release_summary helper, wires perform_release to return a result hash, and captures released_npm_version and changelog_section_found for the post-release summary; logic is correct and all abort paths prevent reaching the summary with nil versions.

Sequence Diagram

sequenceDiagram
    participant Rake as rake :release
    participant PR as perform_release
    participant WRC as with_release_checkout
    participant SGA as sync_github_release_after_publish
    participant PRS as print_release_summary

    Rake->>PR: gem_version, dry_run, allow_version_policy_override
    PR->>WRC: gem_root, dry_run
    WRC-->>PR: sets released_gem_version and released_npm_version
    alt dry_run = false
        PR->>SGA: gem_root, sync_gem_version
        SGA-->>PR: prints banner and sets changelog_section_found
    end
    PR-->>Rake: dry_run, released_gem_version, released_npm_version, changelog_section_found
    Rake->>PRS: release_result hash
    alt dry_run = true
        PRS-->>Rake: DRY RUN COMPLETE plus version and file list
    else changelog_section_found = true
        PRS-->>Rake: RELEASE COMPLETE plus published versions and changelog check
    else changelog_section_found = false
        PRS-->>Rake: RELEASE COMPLETE plus published versions and next steps
    end
Loading

Reviews (1): Last reviewed commit: "Add end-of-run summary for rake release" | Re-trigger Greptile

Comment thread rakelib/release.rake
Comment thread rakelib/release.rake
@justin808
Copy link
Copy Markdown
Member Author

Acknowledging skipped bot summary comments (#issuecomment-4176007942, #issuecomment-4176024710): these are informational status summaries, so no additional code or docs changes are required.

Comment thread rakelib/release.rake Outdated
Comment thread rakelib/release.rake
Comment thread rakelib/release.rake
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 3, 2026

Review

Nice improvement overall — the summary output makes the release process more ergonomic and the staged-files refactor is a clean win (using Shellwords.join instead of the hardcoded string is strictly better). Scope is appropriately narrow.

Three things worth addressing before merging:

1. Duplicate next-steps guidance (medium)
When no changelog section is found, the user sees the manual sync_github_release instruction twice: once from the ZZZZZ banner inside sync_github_release_after_publish, and again in the new summary. The summary is the cleaner surface — consider removing the equivalent block from sync_github_release_after_publish so there is one canonical source. See inline comment on lines 489–491.

2. Redundant extract_changelog_section call (low)
changelog_section_found is computed by calling extract_changelog_section on line 599, then sync_github_release_after_publish on line 600 calls the same function internally. CHANGELOG.md ends up being read twice with identical args. Not a real-world problem but the duplication is unnecessary. See inline comment on line 599.

3. Dry-run summary omits changelog status (low)
changelog_section_found is always false for dry-runs because the check only runs in the live path. The dry-run is meant to be a pre-flight checklist, but the missing-changelog warning (warn_changelog_missing fires mid-run) does not surface in the final summary. Worth computing it in dry-run too so the summary can flag it directly. See inline comment on lines 468–475.

Checklist note
The PR checklist marks tests as not added. Given this is release tooling rather than a library path that is probably acceptable, but worth checking whether existing rake tests cover print_release_summary and the staged-files helper.

- Pass pre-extracted changelog_section to sync_github_release_after_publish
  to avoid reading CHANGELOG.md twice with the same arguments.
- Move changelog availability check outside `unless dry_run` so it runs for
  both paths, giving the dry-run summary a self-contained pre-flight check.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@justin808
Copy link
Copy Markdown
Member Author

Addressing the review summary (#issuecomment-4181568968):

  1. Redundant extract_changelog_section call — Fixed in 269a4a9. sync_github_release_after_publish now accepts changelog_section: so the caller passes the pre-extracted section through.
  2. Duplicate next-steps guidance — Intentionally kept as-is (same decision as the earlier greptile thread). The ZZZZZ banner and summary appear at different points in the flow; keeping both helps maintainers scanning tail output.
  3. Dry-run changelog status — Fixed in 269a4a9. The changelog check now runs for both dry-run and live paths, so the dry-run summary shows a checkmark or warning status.
  4. Test coverage — This is release tooling that is manually validated during actual releases; no automated test changes needed.

Comment thread rakelib/release.rake
puts "Version would be bumped to: #{released_gem_version} (gem) / #{released_npm_version} (npm)"
puts "\nFiles that would be updated:"
staged_files.each { |file| puts " - #{file}" }
puts " - package.json (updated by release-it)"
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.

The dry-run staged-files list is split between the dynamic release_staged_files array (lines above) and this hardcoded package.json line. If release_staged_files ever changes, this line also needs updating. Consider adding a comment or constant to make the coupling explicit, e.g.:

# package.json is managed by release-it and not pre-staged
puts "  - package.json (updated by release-it)"

Or surface it from release_staged_files so there's a single source of truth.

Comment thread rakelib/release.rake
npm_version = Shakapacker::Utils::VersionSyntaxConverter.new.rubygem_to_npm(gem_version)
changelog_path = File.join(gem_root, "CHANGELOG.md")
section = extract_changelog_section(changelog_path: changelog_path, npm_version: npm_version)
section = changelog_section || extract_changelog_section(
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.

The changelog_section passed here is used only for the "should we skip?" guard (line ~293 unless section). However, prepare_github_release_context called further down always calls extract_changelog_section internally, so the file is still parsed a second time in the live path. The optimization avoids one redundant parse but doesn't fully thread the pre-extracted section all the way through — worth noting if this function is ever extended.

Comment thread rakelib/release.rake
end
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.

released_gem_version and released_npm_version are set inside the with_release_checkout block. If the block aborts (e.g. a failed git add) they remain nil here. In practice abort prevents reaching this return statement, so it isn't a live bug — but the callers (print_release_summary) silently interpolate nil into strings if they were ever nil. A guard like released_gem_version || "(unknown)" in the summary printer would make failures more obvious.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 3, 2026

Review: Add final summary output to rake release

Overall this is a clean, well-scoped improvement. The refactoring to return metadata from perform_release and the dry-run summary are both useful. A few observations:

Missing tests

The PR checklist leaves "Add/update test to cover these changes" unchecked. print_release_summary has branching logic (dry-run vs live, changelog found vs missing) and perform_release now has a new return-payload contract that downstream callers depend on. These are good candidates for unit tests — a future change to the payload shape would be silent without them.

sync_github_release_after_publish called with dry_run: false always

sync_github_release_after_publish is only reachable via unless dry_run, so the dry_run: keyword it receives is always false. The parameter is part of the existing signature so this is pre-existing, but the dry_run path inside that function is effectively dead code.

Minor: sync_gem_version nil check is redundant

sync_gem_version = released_gem_version || gem_version.to_s.strip
if sync_gem_version && !sync_gem_version.empty?

String#to_s on a string/nil always returns a String, so sync_gem_version is never nil — the && sync_gem_version guard is a no-op. The .empty? check is the meaningful one. Pre-existing pattern, but worth cleaning up if touching this area again.

Inline comments posted for the hardcoded package.json coupling, the partial changelog-parse optimization, and the nil-version interpolation risk.

@justin808 justin808 merged commit e351ed9 into main Apr 3, 2026
15 checks passed
@justin808 justin808 deleted the jg/rake-release-summary branch April 3, 2026 04:54
justin808 added a commit that referenced this pull request Apr 30, 2026
* origin/main: (22 commits)
  docs: add Dependabot configuration guide (#1094)
  Sync address-review prompt with upstream PR #16 (#1098)
  Supersede #910: entry shape test with lint unblock (#919)
  fix: align rspack v2 peer deps and installer defaults (#1091)
  docs: update README and guides for Shakapacker v10 (#1092)
  Release 10.0.0
  Update CHANGELOG.md for v10.0.0 (#1089)
  Release 10.0.0-rc.1
  Update CHANGELOG.md for v10.0.0-rc.1 (#1087)
  Supersede #961 by using pack-config-diff (#973)
  Add final summary output to rake release (#1041)
  Add bin/setup to install development deps (#1039)
  Release 10.0.0-rc.0
  Use npx release-it to avoid mise shim failures (#1040)
  Fix Nokogiri build failure on Ruby 3.4.6 (#1038)
  Update CHANGELOG.md for v10.0.0-rc.0 (#1037)
  Update rspack dev deps to 2.0.0-rc.0 (#1036)
  Fix stale and broken documentation across Shakapacker guides (#1023)
  Allow webpack-cli v7 in peer dependencies (#1021)
  refactor: simplify resolving js peer versions when installing (#1034)
  ...

# Conflicts:
#	package.json
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