Skip to content

ci: fix prelease flag set wrong if releasing from a merge#37258

Merged
kodiakhq[bot] merged 1 commit into
developfrom
ci-fix-latest-release-flag
Oct 18, 2025
Merged

ci: fix prelease flag set wrong if releasing from a merge#37258
kodiakhq[bot] merged 1 commit into
developfrom
ci-fix-latest-release-flag

Conversation

@rodrigok

@rodrigok rodrigok commented Oct 18, 2025

Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Refactor
    • Improved internal handling of pre-release state determination during release publishing to enhance logical clarity and consistency.

@dionisio-bot

dionisio-bot Bot commented Oct 18, 2025

Copy link
Copy Markdown
Contributor

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is targeting the wrong base branch. It should target 7.12.0, but it targets 7.11.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented Oct 18, 2025

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 94bb9aa

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Oct 18, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

A refactoring of prerelease state handling in the release publishing workflow that introduces an intermediate variable startAsPreRelease to capture the initial prerelease condition, then derives a final prerelease variable based on merge state, adjusting conditional logic accordingly.

Changes

Cohort / File(s) Summary
Prerelease state variable refactoring
packages/release-action/src/publishRelease.ts
Introduces startAsPreRelease variable from isPreRelease(cwd) call; updates merge-final conditional to use startAsPreRelease; adds derived prerelease variable computed as !mergeFinal && startAsPreRelease; affects downstream isLatestRelease and prerelease handling logic.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

The change involves variable state refactoring with cascading effects on downstream conditional logic. While localized to one file, understanding the impact on isLatestRelease determination and prerelease handling throughout the function requires careful tracing of variable dependencies.

Poem

🐰 A rabbit hops through states so clear,
Starting fresh, the path is near,
startAsPreRelease marks the way,
While prerelease finds its play—
Old logic split, now logic thrives! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "ci: fix prelease flag set wrong if releasing from a merge" is directly related to the main change in the changeset. The raw summary shows that the changes specifically fix the prerelease flag logic by introducing a startAsPreRelease variable and updating the conditional from if (mergeFinal && prerelease) to if (mergeFinal && startAsPreRelease). This precisely addresses the issue described in the title—fixing how the prerelease flag is set when releasing from a merge scenario. The title is concise, clear, and specific enough for a developer scanning the git history to understand the primary change. There is a minor typo ("prelease" instead of "prerelease"), but this does not meaningfully impact clarity.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ci-fix-latest-release-flag

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.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/release-action/src/publishRelease.ts (1)

67-67: Pre-existing bug: Missing template literal for version interpolation.

The error message doesn't interpolate the newVersion variable. This is a pre-existing issue not introduced by this PR.

Apply this diff to fix:

-		throw new Error('Could not find changelog entry for version newVersion');
+		throw new Error(`Could not find changelog entry for version ${newVersion}`);
🧹 Nitpick comments (1)
packages/release-action/src/publishRelease.ts (1)

39-46: LGTM! The prerelease flag logic is now correctly implemented.

The refactoring correctly addresses the issue where the prerelease flag was set incorrectly when releasing from a merge. By introducing startAsPreRelease to capture the initial state and deriving the final prerelease variable as !mergeFinal && startAsPreRelease, the logic now ensures:

  • When mergeFinal is true (releasing from a merge), prerelease is false even if it started as a prerelease
  • When mergeFinal is false and it started as a prerelease, prerelease remains true

This correctly propagates to line 123 where the GitHub release is created.

Optional: Consider adding a clarifying comment.

To improve maintainability, you might add a brief comment explaining the derived logic:

+	// prerelease is true only if we started as prerelease AND are not merging final
 	const prerelease = !mergeFinal && startAsPreRelease;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c635c9f and 94bb9aa.

📒 Files selected for processing (1)
  • packages/release-action/src/publishRelease.ts (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). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build

@codecov

codecov Bot commented Oct 18, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.58%. Comparing base (c635c9f) to head (94bb9aa).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #37258      +/-   ##
===========================================
- Coverage    67.59%   67.58%   -0.01%     
===========================================
  Files         3341     3341              
  Lines       114016   114016              
  Branches     20665    20665              
===========================================
- Hits         77068    77059       -9     
- Misses       34267    34277      +10     
+ Partials      2681     2680       -1     
Flag Coverage Δ
e2e 57.30% <ø> (-0.04%) ⬇️
unit 71.53% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sampaiodiego sampaiodiego added this to the 7.12.0 milestone Oct 18, 2025
@sampaiodiego sampaiodiego added the stat: QA assured Means it has been tested and approved by a company insider label Oct 18, 2025
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Oct 18, 2025
@kodiakhq kodiakhq Bot merged commit 78be34c into develop Oct 18, 2025
52 checks passed
@kodiakhq kodiakhq Bot deleted the ci-fix-latest-release-flag branch October 18, 2025 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants