Skip to content

fix(changelog): normalize leading branch prefixes in PR titles - #225

Merged
blizzz merged 3 commits into
masterfrom
jtr/fix-changelog-PRTitlePrefixes
Nov 11, 2026
Merged

blizzz merged 3 commits into
masterfrom
jtr/fix-changelog-PRTitlePrefixes

Conversation

@joshtrichards

Copy link
Copy Markdown
Member

Fix title cleanup consuming the opening bracket of a second prefix; also treat a [master] prefix in the same manner as [stableXX].

These problems are visible in the v33.0.10 changelog, where one entry begins with Stable35] and two begin with Master].

The current regex:

  • Has a trailing \W* that matches any non-word character, including the opening [ of a second bracketed prefix. For example, the viewer PR title is [stable33] [stable35] fix: ...; after removing the first prefix, the regex also consumes the second [, leaving stable35] fix: ... as the entry.
  • Matches an unclosed tag such as [stable33 or mismatched delimiters such as [stable33).
  • Removes version-like tags inside a title, so Fix [stable33] thing becomes Fix thing.

The updated title cleanup removes consecutive leading branch prefixes without stripping the opening bracket from an unrecognized tag. It also treats master in the same way as stableXX.

[stable33] [stable35] fix: optimize file lookup
→ Fix: optimize file lookup

[stable33] [master] fix(security): Update code signing revocation list
→ Fix(security): Update code signing revocation list

[stable33] [master] [blah] fix: ...
→ [blah] fix: ...

The cleanup now requires matching delimiters - i.e. no mismatched combinations like [stableXX) - and leaves branch-like text elsewhere in titles untouched.

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Remove stacked stable-version and master prefixes from the start of PR titles without consuming the opening bracket of the next tag.

Require complete, matching delimiters and leave branch-like text
elsewhere in titles untouched.

Assisted-by: Copilot:gpt-6.1-terra

Signed-off-by: Josh <josh.t.richards@gmail.com>

@blizzz blizzz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is one regression on the security tag: The new regex only matches at ^, and the [security] strip runs after it, once. So a title starting with [security] never gets its branch tags removed.

Suggested fix: handle security inside the same repeating prefix group, so prefixes in any order are removed in one pass. Then delete line 68:
'!^(?:(?:\[(?:(?:stable)? ?\d\d|master|main|security)\]|\((?:(?:stable)? ?\d\d|master|main)\))[\s:,-]*)+!i'

Handle leading security and branch prefixes in the same repeating
group so a security prefix cannot prevent branch cleanup.

Also recognize main as a branch prefix.

Signed-off-by: Josh <josh.t.richards@gmail.com>
Add tests for prefix ordering, stacked tags, and titles that should remain unchanged.

Assisted-by: Copilot:gpt-6.1-terra

Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards

Copy link
Copy Markdown
Member Author

Good call. Totally overlooked the interaction. Also, makes sense to include main too.

Fixed (hopefully) and also added test coverage. :)

@joshtrichards
joshtrichards requested a review from blizzz November 10, 2026 14:03
@blizzz
blizzz merged commit 6696398 into master Nov 11, 2026
11 checks passed
@blizzz
blizzz deleted the jtr/fix-changelog-PRTitlePrefixes branch November 11, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants