Release notes & QA status: replace (#N) squash-subject regex with commits→PRs API - #37213
Release notes & QA status: replace (#N) squash-subject regex with commits→PRs API#37213sfreudenthaler wants to merge 3 commits into
Conversation
…ject regex Both release scripts extracted PR numbers by matching `(#N)$` against commit subjects, which only works under squash merging. dotCMS removed squash merging after the aug-24 incident, so the compare range between release tags now contains merge commits plus every feature-branch commit. Two failure modes follow: merge commits whose subject has no `(#N)` drop their PR entirely, and feature-branch subjects ending in an ISSUE number (e.g. `(#37132)`) get fed to `pulls.get` as a fake PR number, which 404s. Replace `extractPRNumbers` with an async `resolvePRNumbers` in both packages that calls `GET /repos/{owner}/{repo}/commits/{sha}/pulls` (`octokit.repos.listPullRequestsAssociatedWithCommit`) per commit, filters to `merged_at`, and dedupes through a Set. The API maps a merged PR's branch commits and its merge commit to the same PR, so dedup is free, and it returns `[]` for direct pushes. Batched at 15 with `Promise.all` and a 500ms inter-batch sleep, mirroring the existing `fetchPRDetails` pattern; a per-commit try/catch warns to stderr so one bad sha cannot abort the range. `CommitInfo.message` was read only by the old regex, so it and the message-building line in `fetchCommitRange` are removed. In release-qa-status the "has the merge strategy changed?" stderr warning is deleted — it existed solely to flag the squash assumption this change removes. No workflow changes: `pull-requests: read` is already granted where these run. Closes: #37201 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Drop the redundant per-commit-failure test and stderr spy, the duplicate resolvePRNumbers test block in release-qa-status (mirror is covered by gather-release-data), a dead ordering comment, and trim the docblock. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Claude finished @sfreudenthaler's task in 2m 52s —— View job Code Review: PR #37213The core change — swapping the New Issues
Everything else in the diff is clean: the |
Why
.github/scripts/gather-release-data/src/github.tsand.github/scripts/release-qa-status/src/github.tsboth extracted PR numbers from commit subjects with the same\(#(\d+)\)\s*$regex. That only holds under squash merging.After the aug-24 incident dotCMS removed squash merging, so PRs now land as merge commits and the compare range between two release tags contains merge commits and every feature-branch commit underneath them. Two things go wrong:
Merge pull request #N from …, or a custom merge title) doesn't end in(#N), so its PR is never resolved. It drops out of the AI release notes and out of the QA-status section.release-qa-statuswarned about this atindex.ts:272;gather-release-datawas silent.mainverbatim, and their subjects frequently end in an issue number the author typed — e.g.fix(edit-content): pick the asset picker per host (#37132), where#37132is the issue and#37196is the PR. The old regex hands37132topulls.get, which 404s.What changed
extractPRNumbersis replaced in both packages by an asyncresolvePRNumbers(octokit, owner, repo, commits)that resolves each commit throughGET /repos/{owner}/{repo}/commits/{sha}/pulls(octokit.repos.listPullRequestsAssociatedWithCommit):pr.merged_at— for commits not reachable from the default branch the endpoint also returns open PRs.Set. The API maps a merged PR's branch commits and its merge commit to the same PR number, so branch/merge dedup is free.BATCH_SIZE = 15withPromise.allandsleep(500)between batches, reusing the existingfetchPRDetailsconcurrency pattern in the same files.try/catchwrites a warning to stderr and returns[], so one unresolvable sha cannot abort the whole range — consistent with howfetchPRDetailsalready degrades to partial results.No regex fast path. A "two-parent commits only" shortcut was considered and rejected: it saves roughly one API call, still needs per-commit resolution for the branch commits underneath, and re-introduces exactly the
merge_commit_titlefragility this change removes.Supporting cleanups:
CommitInfo.messagewas read only by the old regex, so the field (types.ts) and the message-building line infetchCommitRangeare both removed in both packages.release-qa-status/src/index.ts: the 11-line "has the merge strategy changed? expected squash-merge commit subjects" stderr warning is deleted, not reworded — it existed solely to flag the squash assumption this PR removes, and the line above it already printsResolved N merged PRs from M commits.release-qa-status/src/github.ts: the stale comment infetchClosingIssueRefsthat justified GraphQL alias interpolation by citing "extractPRNumbers' strict regex" now cites the API. TheNumber.isInteger(n) && n > 0belt-and-suspenders filter stays.The two scripts remain independent parallel copies, per the existing
Mirrors the patterns in .github/scripts/gather-release-data/src/github.tsheader — no shared module was extracted. Both must land together or the documented mirror pair goes out of sync.No workflow changes needed.
cicd_comp_ai-release-notes-phase.yml:41already grantspull-requests: read, which covers this endpoint, and thereportjob incicd_6-release.ymlalready callspulls.getwith the same scope.Testing
gather-release-data:npm test→ 35/35 passing,npx tsc --noEmitclean,npm run buildclean. The three oldextractPRNumbersregex tests were replaced by threeresolvePRNumberscases:aaa(feature-branch commit whose subject ended in issue(#37132)),bbb(its two-parent merge commit),ccc(direct push). Asserts[37196]and 3 API calls, covering merge-commit resolution, branch/merge dedup, and the direct-push case in one shot.merged_at: null).process.stderr.writespy sees the failing sha.release-qa-status:npm test→ 41/41 passing (was 40; +1),npx tsc --noEmitclean,npm run buildclean. Adds oneresolvePRNumbersdrift-guard case with the same Release notes & QA status: replace (#N) squash-subject regex with commits→PRs API #37201 fixture, in the same style as the existingfindPreviousTagdrift guard.jest.fnin both suites — no network, no new dependencies, no new test harness. All fixtures are ≤3 commits so the inter-batchsleep(500)never runs and no fake timers are needed.Zero new dependencies. No behavior change beyond PR-number resolution.
Closes: #37201
🤖 Generated with Claude Code