Skip to content

fix(xtask): stop changelog gen over-capturing in-title #N cross-references#5924

Merged
houko merged 1 commit into
mainfrom
fix/changelog-pr-number-overcapture
May 30, 2026
Merged

fix(xtask): stop changelog gen over-capturing in-title #N cross-references#5924
houko merged 1 commit into
mainfrom
fix/changelog-pr-number-overcapture

Conversation

@houko

@houko houko commented May 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the xtask changelog generator pulling unrelated, ancient, or unmerged PRs into release notes.

extract_pr_numbers ran git log --oneline <range> and grepped the whole output with #(\d+), collecting every match.
A GitHub squash merge carries the merge-PR reference as the trailing (#N) of the subject; any earlier #N is an in-title cross-reference — an issue (fixes #5740), a prior PR (post-#5053), or a "part N of M" marker ((#2)) — not the PR that introduced the commit.
Those got captured and fed to gh pr view, which resolved to whatever ancient/unmerged PR owned the low number.

Observed while regenerating the v2026.5.30-beta.15 changelog over v2026.5.28-beta.14..HEAD: #2, #6, #10, and #5053 were spuriously resolved (#2 / #6 are unmerged dependabot PRs, #10 is not a PR), surfacing as bogus entries and bogus contributor credit.

Change

  • Parse only the last #N per subject line — the squash-merge PR number.
  • Split the line-parsing out of the git-shelling extract_pr_numbers into a pure parse_pr_numbers(&str) helper so it is unit-testable without a git fixture.

Verification

  • cargo test -p xtask changelog::tests:: — 6/6 pass (trailing-ref capture, in-title cross-reference rejection, merge-commit subjects, no-ref lines, dedup/sort, empty input).
  • cargo clippy -p xtask --all-targets -- -D warnings — clean.
  • cargo fmt -p xtask -- --check — clean.

Closes #5923

…log gen

extract_pr_numbers grepped every #N on a oneline subject, so in-title
cross-references (issue refs like 'fixes #5740', prior-PR refs like
'post-#5053', and 'part N of M' markers like '(#2)') were treated as
their own PRs and fed to 'gh pr view', pulling unrelated ancient or
unmerged PRs into the generated release notes.

A squash merge always appends the PR reference as the trailing (#N) of
the subject, so parse only the last match per line. Split the parsing
into a pure parse_pr_numbers helper with unit coverage.
@github-actions github-actions Bot added area/docs Documentation and guides size/M 50-249 lines changed labels May 30, 2026
@houko
houko merged commit 6f073b4 into main May 30, 2026
29 checks passed
@houko
houko deleted the fix/changelog-pr-number-overcapture branch May 30, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Documentation and guides size/M 50-249 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

xtask(changelog): extract_pr_numbers over-captures in-title #N cross-references

1 participant