fix: add custom_major_increment_regex for breaking change detection#545
fix: add custom_major_increment_regex for breaking change detection#545
Conversation
breaking_always_bump_major alone didn't trigger major bumps for commits using the conventional commit `!` marker. Add an explicit regex to match `type!:` and `type(scope)!:` patterns. Co-Authored-By: Claude Opus 4.6 <[email protected]>
a06029f to
e77f510
Compare
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the version bumping logic to correctly identify and apply major version increments when breaking changes are present in commit messages. It addresses a limitation where the existing Highlights
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds a custom_major_increment_regex to cliff.toml to more explicitly detect breaking changes from conventional commit messages. This is a good "belt-and-suspenders" approach to ensure major version bumps happen correctly. I've suggested a small refinement to the regex to align it more closely with the existing commit_parsers configuration in the same file, ensuring consistency in how different commit types are handled.
| # Detect breaking changes from conventional commit `!` marker and footer | ||
| breaking_always_bump_major = true | ||
| # Also match the `!` breaking change indicator in commit messages directly | ||
| custom_major_increment_regex = "^(feat|fix|refactor|perf|chore|style|test|docs)(!|\\(.*\\)!):" |
There was a problem hiding this comment.
This regex is a good addition to ensure breaking changes are detected. I've noticed a couple of minor inconsistencies with the commit_parsers configuration in this file:
- This regex uses
docs, while the parser at line 101 usesdoc. - The parser at line 105 includes
revert, but it's missing from this regex. Revert commits can also be breaking changes.
To make this more consistent with the rest of the configuration, I suggest updating the regex to include revert and use doc instead of docs.
custom_major_increment_regex = "^(feat|fix|refactor|perf|chore|style|test|doc|revert)(!|\\(.*\\))!:"
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| # Detect breaking changes from conventional commit `!` marker and footer | ||
| breaking_always_bump_major = true | ||
| # Also match the `!` breaking change indicator in commit messages directly | ||
| custom_major_increment_regex = "^(feat|fix|refactor|perf|chore|style|test|docs)(!|\\(.*\\)!):" |
There was a problem hiding this comment.
Regex missing revert type present in commit parsers
Low Severity
The custom_major_increment_regex type list omits revert, even though commit_parsers explicitly handles ^[Rr]evert commits (line 105). Since the PR states breaking_always_bump_major doesn't work, this regex is the primary breaking-change detection mechanism. A revert!: commit would be classified as a Revert in the changelog but would fail to trigger a major version bump.
Additional Locations (1)
Greptile SummaryThis PR adds a Key changes:
Concern: The one commit that actually needs to be detected — Confidence Score: 3/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["git cliff --bumped-version\n(called in tasks/release-plz line 18)"] --> B{Scan commit history}
B --> C[Parse each commit\nwith conventional-commit parser]
C --> D{breaking: true\ndetected by parser?}
D -- yes --> E["breaking_always_bump_major = true\n→ force major bump"]
D -- no --> F{Match commit message\nagainst custom_major_increment_regex}
F -- matches --> E
F -- no match --> G{Any feat: commit?}
G -- yes --> H[Bump minor]
G -- no --> I[Bump patch]
E --> J["Output: v3.0.0 ✅"]
H --> K["Output: v2.x.0"]
I --> L["Output: v2.18.x"]
style E fill:#4caf50,color:#fff
style J fill:#4caf50,color:#fff
style F fill:#ff9800,color:#fff
Last reviewed commit: e77f510 |
| # Detect breaking changes from conventional commit `!` marker and footer | ||
| breaking_always_bump_major = true | ||
| # Also match the `!` breaking change indicator in commit messages directly | ||
| custom_major_increment_regex = "^(feat|fix|refactor|perf|chore|style|test|docs)(!|\\(.*\\)!):" |
There was a problem hiding this comment.
Regex misses feat!(scope): format — the pattern that triggered this fix
The regex ^(feat|fix|refactor|perf|chore|style|test|docs)(!|\(.*\)!): only handles two standard conventional-commit forms:
feat!:— breaking, no scopefeat(scope)!:— breaking, scope before!
However, the commit that actually needs to be detected as a breaking change is 9fcfcb7 feat!(spec): add support for license, before/after help metadata — the ! appears after the type but before the scope (feat!(spec):). This non-standard ordering is not matched by either alternative in (!|\(.*\)!).
Trace through the regex for feat!(spec)::
feat— matches(!|\(.*\)!)against!(spec):- Alt 1
!matches!, but then:is required and(follows → fails - Alt 2
\(.*\)!requires(first, but!follows → fails
- Alt 1
- → no match
breaking_always_bump_major = true may still save the day if git-cliff's internal parser recognises the non-standard ! position, but if you want the regex to also cover this format, add a third alternative:
| custom_major_increment_regex = "^(feat|fix|refactor|perf|chore|style|test|docs)(!|\\(.*\\)!):" | |
| custom_major_increment_regex = "^(feat|fix|refactor|perf|chore|style|test|docs)(!|\\(.*\\)!|!\\(.*\\)):" |
With !\\(.*\\) added, feat!(spec): would match via the new third alternative.
### 🚀 Features - **(spec)** **breaking** add support for license, before/after help metadata by [@jdx](https://github.com/jdx) in [#542](#542) ### 🐛 Bug Fixes - **(cobra)** escape newlines, tabs, and carriage returns in kdlQuoteAlways by [@thecodesmith](https://github.com/thecodesmith) in [#539](#539) - bump major version for breaking changes in release automation by [@jdx](https://github.com/jdx) in [#544](#544) - add custom_major_increment_regex for breaking change detection by [@jdx](https://github.com/jdx) in [#545](#545) - handle all breaking change commit formats in major bump regex by [@jdx](https://github.com/jdx) in [27e1ab1](27e1ab1) - normalize breaking change commit format in preprocessor by [@jdx](https://github.com/jdx) in [aa72b92](aa72b92) ### 📚 Documentation - add argparse-usage integration by [@jdx](https://github.com/jdx) in [#531](#531) - mark KDL code blocks as KDL and use correct inline-comment `//` by [@muzimuzhi](https://github.com/muzimuzhi) in [#536](#536) - fix include syntax to match implementation by [@jdx](https://github.com/jdx) in [#540](#540) - consolidate integration list to single source by [@jdx](https://github.com/jdx) in [#541](#541) - fix link to integrations by [@muzimuzhi](https://github.com/muzimuzhi) in [#543](#543) ### 🛡️ Security - **(deps)** update dependency eslint to v10 by [@renovate[bot]](https://github.com/renovate[bot]) in [#526](#526) ### 🔍 Other Changes - Added an integration with ruby's OptionParser by [@packrat386](https://github.com/packrat386) in [#533](#533) ### 📦️ Dependency Updates - update actions/setup-node digest to 53b8394 by [@renovate[bot]](https://github.com/renovate[bot]) in [#525](#525) - update jdx/mise-action action to v3 by [@renovate[bot]](https://github.com/renovate[bot]) in [#528](#528) - update rust crate roff to v1 by [@renovate[bot]](https://github.com/renovate[bot]) in [#529](#529) ### New Contributors - @thecodesmith made their first contribution in [#539](#539) - @packrat386 made their first contribution in [#533](#533)
⚠️ **CAUTION: this is a major update, indicating a breaking change!**⚠️ This MR contains the following updates: | Package | Update | Change | |---|---|---| | [usage](https://github.com/jdx/usage) | major | `2.18.2` → `3.2.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>jdx/usage (usage)</summary> ### [`v3.2.0`](https://github.com/jdx/usage/blob/HEAD/CHANGELOG.md#320---2026-03-23) [Compare Source](jdx/usage@v3.1.0...v3.2.0) ##### 🚀 Features - Support env-backed choices with `choices env=...` by [@​mustafa0x](https://github.com/mustafa0x) in [#​548](jdx/usage#548) ##### 🐛 Bug Fixes - **(zsh)** escape parentheses and brackets in completion descriptions by [@​jdx](https://github.com/jdx) in [#​559](jdx/usage#559) ##### New Contributors - [@​mustafa0x](https://github.com/mustafa0x) made their first contribution in [#​548](jdx/usage#548) ### [`v3.1.0`](https://github.com/jdx/usage/blob/HEAD/CHANGELOG.md#310---2026-03-22) [Compare Source](jdx/usage@v3.0.0...v3.1.0) ##### 🚀 Features - **(cli)** render all doc-related fields in --help output by [@​jdx](https://github.com/jdx) in [#​554](jdx/usage#554) - **(cli)** support reading spec from stdin via --file - by [@​jdx](https://github.com/jdx) in [#​555](jdx/usage#555) ##### 🐛 Bug Fixes - **(zsh)** remove trailing space from completions and add directory slash by [@​jdx](https://github.com/jdx) in [#​556](jdx/usage#556) - use field assignment for non-exhaustive Spec in benchmarks by [@​jdx](https://github.com/jdx) in [#​552](jdx/usage#552) ##### 📦️ Dependency Updates - update apple-actions/import-codesign-certs digest to [`fe74d46`](jdx/usage@fe74d46) by [@​renovate\[bot\]](https://github.com/renovate\[bot]) in [#​550](jdx/usage#550) - update codecov/codecov-action digest to [`1af5884`](jdx/usage@1af5884) by [@​renovate\[bot\]](https://github.com/renovate\[bot]) in [#​551](jdx/usage#551) - lock file maintenance by [@​renovate\[bot\]](https://github.com/renovate\[bot]) in [#​547](jdx/usage#547) ### [`v3.0.0`](https://github.com/jdx/usage/blob/HEAD/CHANGELOG.md#300---2026-03-13) [Compare Source](jdx/usage@v2.18.2...v3.0.0) ##### 🚀 Features - **(spec)** **breaking** add support for license, before/after help metadata by [@​jdx](https://github.com/jdx) in [#​542](jdx/usage#542) ##### 🐛 Bug Fixes - **(cobra)** escape newlines, tabs, and carriage returns in kdlQuoteAlways by [@​thecodesmith](https://github.com/thecodesmith) in [#​539](jdx/usage#539) - bump major version for breaking changes in release automation by [@​jdx](https://github.com/jdx) in [#​544](jdx/usage#544) - add custom\_major\_increment\_regex for breaking change detection by [@​jdx](https://github.com/jdx) in [#​545](jdx/usage#545) - handle all breaking change commit formats in major bump regex by [@​jdx](https://github.com/jdx) in [27e1ab1](jdx/usage@27e1ab1) - normalize breaking change commit format in preprocessor by [@​jdx](https://github.com/jdx) in [aa72b92](jdx/usage@aa72b92) ##### 📚 Documentation - add argparse-usage integration by [@​jdx](https://github.com/jdx) in [#​531](jdx/usage#531) - mark KDL code blocks as KDL and use correct inline-comment `//` by [@​muzimuzhi](https://github.com/muzimuzhi) in [#​536](jdx/usage#536) - fix include syntax to match implementation by [@​jdx](https://github.com/jdx) in [#​540](jdx/usage#540) - consolidate integration list to single source by [@​jdx](https://github.com/jdx) in [#​541](jdx/usage#541) - fix link to integrations by [@​muzimuzhi](https://github.com/muzimuzhi) in [#​543](jdx/usage#543) ##### 🛡️ Security - **(deps)** update dependency eslint to v10 by [@​renovate\[bot\]](https://github.com/renovate\[bot]) in [#​526](jdx/usage#526) ##### 🔍 Other Changes - Added an integration with ruby's OptionParser by [@​packrat386](https://github.com/packrat386) in [#​533](jdx/usage#533) ##### 📦️ Dependency Updates - update actions/setup-node digest to [`53b8394`](jdx/usage@53b8394) by [@​renovate\[bot\]](https://github.com/renovate\[bot]) in [#​525](jdx/usage#525) - update jdx/mise-action action to v3 by [@​renovate\[bot\]](https://github.com/renovate\[bot]) in [#​528](jdx/usage#528) - update rust crate roff to v1 by [@​renovate\[bot\]](https://github.com/renovate\[bot]) in [#​529](jdx/usage#529) ##### New Contributors - [@​thecodesmith](https://github.com/thecodesmith) made their first contribution in [#​539](jdx/usage#539) - [@​packrat386](https://github.com/packrat386) made their first contribution in [#​533](jdx/usage#533) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDIuMTAiLCJ1cGRhdGVkSW5WZXIiOiI0My4xMDIuMTAiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbIlJlbm92YXRlIEJvdCIsImF1dG9tYXRpb246Ym90LWF1dGhvcmVkIiwiZGVwZW5kZW5jeS10eXBlOjptYWpvciJdfQ==-->


Summary
breaking_always_bump_majorfrom fix: bump major version for breaking changes in release automation #544 didn't work —git cliff --bumped-versionstill returnedv2.18.3instead ofv3.0.0custom_major_increment_regexto explicitly match the!breaking change indicator in conventional commits (feat!:,feat(scope)!:, etc.)breaking_always_bump_majorFollow-up to #544
Test plan
🤖 Generated with Claude Code
Note
Low Risk
Low risk config-only change that affects version bumping; main risk is unintended major bumps if the regex matches more commit messages than expected.
Overview
Adjusts git-cliff bumping behavior to more reliably detect breaking changes from conventional commits.
Adds
custom_major_increment_regexincliff.tomlto explicitly treatfeat!:/type(scope)!:style messages as major-version increments, complementingbreaking_always_bump_major.Written by Cursor Bugbot for commit e77f510. This will update automatically on new commits. Configure here.