Skip to content

fix: prevent false-positive major bumps from breaking change detection#1048

Merged
FabienMotte merged 1 commit into
mainfrom
fix/breaking-change-detection
Apr 13, 2026
Merged

fix: prevent false-positive major bumps from breaking change detection#1048
FabienMotte merged 1 commit into
mainfrom
fix/breaking-change-detection

Conversation

@FabienMotte
Copy link
Copy Markdown
Contributor

Summary

  • Fix false-positive major version bumps when commit bodies contain the words "breaking changes" in prose (e.g. "This PR includes breaking changes around package consolidation")
  • Require the BREAKING CHANGE: / BREAKING-CHANGE: footer colon separator per the Conventional Commits spec
  • Add support for the ! suffix in commit titles (e.g. feat!:, fix(scope)!:) to trigger major bumps
  • Strip trailing ! from prefixes in getCommitNumbersPerType so feat!: is correctly classified as feat

Test plan

  • Added test: prose mentioning "breaking changes" does not trigger major
  • Added test: BREAKING-CHANGE: (hyphen variant) triggers major
  • Added test: feat!: triggers major
  • Added test: fix(scope)!: triggers major
  • All existing tests still pass

@FabienMotte FabienMotte force-pushed the fix/breaking-change-detection branch from 777e989 to fc94f2d Compare April 9, 2026 15:16
@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@FabienMotte FabienMotte marked this pull request as ready for review April 9, 2026 15:20
Copilot AI review requested due to automatic review settings April 9, 2026 15:20
@FabienMotte FabienMotte requested review from dhayab and sarahdayan April 9, 2026 15:21
Copy link
Copy Markdown

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

This PR tightens ShipJS’ major-version bump detection to better follow Conventional Commits: it avoids triggering majors from incidental prose, and adds support for the ! header marker while requiring the BREAKING CHANGE: / BREAKING-CHANGE: footer format.

Changes:

  • Require BREAKING CHANGE: / BREAKING-CHANGE: (with :) for major bump detection in commit bodies (reduces false positives).
  • Detect major bumps from ! in commit titles (e.g., feat!:, fix(scope)!:).
  • Normalize commit type parsing so feat!: is counted as feat for minor/patch classification logic.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
packages/shipjs-lib/src/lib/util/getNextVersion.js Updates major bump detection to use a breaking-change footer regex and adds !-header major detection.
packages/shipjs-lib/src/lib/util/getCommitNumbersPerType.js Strips trailing ! from parsed commit type so feat!: is classified correctly.
packages/shipjs-lib/src/lib/util/tests/getNextVersion.spec.js Adds tests for hyphenated footer detection, prose false-positive prevention, and ! title handling.
packages/shipjs-lib/src/lib/const.js Changes GIT_COMMIT_BREAKING_CHANGE from a string to a regex aligned with the spec.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@dhayab dhayab left a comment

Choose a reason for hiding this comment

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

Great fix, thanks!

@FabienMotte FabienMotte merged commit 5c086e5 into main Apr 13, 2026
11 checks passed
@FabienMotte FabienMotte deleted the fix/breaking-change-detection branch April 13, 2026 03:18
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.

3 participants