Skip to content

Fix prepare release version guard#41

Merged
qwrobins merged 1 commit into
mainfrom
codex/fix-prepare-release-version-guard
May 17, 2026
Merged

Fix prepare release version guard#41
qwrobins merged 1 commit into
mainfrom
codex/fix-prepare-release-version-guard

Conversation

@qwrobins

@qwrobins qwrobins commented May 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • Allow prepare-release to generate metadata when package.json is already ahead of the latest release tag
  • Keep rejecting package versions older than the latest tag
  • Preserve the existing already-prepared metadata recovery path

Validation

  • npm run release:prepare -- --dry-run
  • npm run lint -- --quiet
  • npm test
  • coderabbit review --plain --type uncommitted

Summary by CodeRabbit

  • Chores
    • Improved release preparation script to more reliably handle version synchronization between package metadata and release tags, with enhanced error detection and clearer status reporting.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 17, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 846851b1-bdf5-41be-a7df-ac2af5656e7b

📥 Commits

Reviewing files that changed from the base of the PR and between 6394557 and 1493e54.

📒 Files selected for processing (1)
  • scripts/prepare-release.mjs

📝 Walkthrough

Walkthrough

The release-preparation script improves handling of version mismatches between package.json and git tags. It now validates that package.json is not behind the latest tag, refactors the next-version selection to skip bump detection when package.json is already ahead, and updates the output message to reflect which path was taken.

Changes

Release-preparation control flow

Layer / File(s) Summary
Version validation and next-version selection
scripts/prepare-release.mjs
A guard throws an error if package.json version is older than the latest tag. The bump/version selection logic is refactored to treat bump as null when package.json is already ahead (skipping conventional-commit detection), compute nextVersion from package.json in that case or via releaseBump otherwise, and early-exit only when neither a bump nor ahead condition exists. The final console message is reformatted as a multi-line template with clarified phrasing for bumped vs existing version.

Possibly related PRs

  • qwrobins/aether#29: Both PRs modify scripts/prepare-release.mjs's release-preparation/bump-detection control flow—refactoring how the next version is computed (including bump determination based on tag/version position and/or GitHub PR metadata)—so the changes overlap at the core bump-selection logic.
  • qwrobins/aether#25: Both PRs modify scripts/prepare-release.mjs's release-preparation/version-tag decision logic (handling "ahead/behind" package.json vs latest tags and prepared release metadata), so they directly overlap on the same control flow.
  • qwrobins/aether#23: Both PRs touch scripts/prepare-release.mjs, changing the release-preparation/version-tag computation control flow (the main PR refactors the bump/version decision logic, while the retrieved PR introduces the prepare-release implementation used by the new workflow).

Poem

🐰 A rabbit hops through version trees,
Checking tags against the breeze—
When ahead, skip the bumpy track,
When behind? Throw an error back!
Release flows clear, no more delays,
The script's refactored, hip-hip-hooray! 🎉

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly relates to the main change: refactoring the version guard logic in the prepare-release script to better handle cases where package.json is ahead of or behind the latest release tag.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-prepare-release-version-guard

Comment @coderabbitai help to get the list of available commands and usage tips.

@qwrobins qwrobins merged commit c5eecd8 into main May 17, 2026
1 check passed
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