Repository navigation
[ci] Fix PR number parsing in get_contributors for cherry-picks and edge cases - #64354
Conversation
…dge cases The `_find_pr_number` helper captured all text between `(#` and the first `)`, so titles like a truncated revert (`...(#6... (#64309)`) yielded `6... (#64309` and `(#issue) (#pr)` titles yielded the fixed issue number instead of the merging PR. Replace it with `_find_pr_numbers`, which matches only well-formed `(#<digits>)` tokens via a module-level compiled regex and returns every candidate. The text alone cannot distinguish an issue from a PR or an original from a backport, so `run` now queries all candidates and credits every one that resolves as a real PR. This ensures a cherry-pick credits both the original author and the backporter rather than silently dropping the original author. Numbers that 404 (expected for issue references) are collected and printed at the end so a future change in GitHub's behavior surfaces instead of silently dropping a contributor. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: sai.miduthuri <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request updates the contributor extraction script to parse multiple PR and issue numbers from commit messages, which is particularly useful for cherry-picks and backports. It replaces the single PR parser with a regex-based multi-PR parser and improves error handling for non-PR references. The review feedback suggests two key improvements: simplifying the PR number extraction by running the parser directly on the entire commits string, and parallelizing the GitHub API requests using a ThreadPoolExecutor to significantly boost performance.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Run _find_pr_numbers directly on the full commits string instead of looping over lines, since re.findall already scans across newlines. Add a test covering multiple commit titles passed in a single blob. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: sai.miduthuri <[email protected]>
Address code-review findings on get_contributors: - Non-404 GitHub API errors (rate limit, 5xx, network) previously printed and continued, silently dropping a real contributor while the script still exited 0. Collect these numbers and raise a ClickException at the end so the operator knows the contributor list is incomplete. - Document the union-parsing trade-off: keeping every "(#N)" reference also credits PRs merely mentioned in prose (e.g. the reverted PR in a revert commit). This is accepted to avoid ever missing a real contributor. - Refresh the now-stale module comment (the regex is no longer called "a thousand times"; it runs once on the whole blob) and rename the _find_pr_numbers param from `line` to `text` to match its actual usage. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: sai.miduthuri <[email protected]>
…dge cases (ray-project#64354) ## Description The `get_contributors` release-notes script extracts PR numbers from commit subjects to look up contributor logins. The old `_find_pr_number` helper grabbed all text between `(#` and the first `)`, which produced wrong results for several real commit titles: - A truncated revert like `Revert "... hot path (ray-project#6... (ray-project#64309)` yielded `6... (ray-project#64309` instead of `64309`. - A title carrying a fixed-issue reference followed by the merging PR, e.g. `... cpu_percent (ray-project#63729) (ray-project#63733)`, yielded the issue number `63729` instead of the PR `63733`. - **Cherry-picks** such as `... in MiB (ray-project#63932) (ray-project#64042)` (original PR + backport PR) credited only one number, silently dropping the original author. This PR replaces it with `_find_pr_numbers`, which: - Matches only well-formed `(#<digits>)` tokens using a module-level compiled regex (the helper runs up to thousands of times per invocation). - Returns **every** candidate in title order. The commit text alone cannot tell an issue from a PR or an original from a backport, so `run` queries all candidates via the GitHub API and credits each one that resolves as a real PR. A cherry-pick now credits both the original author and the backporter. - Treats a `404` as expected (the number is an issue, not a PR) and collects those numbers, printing them at the end. This way, if GitHub's behavior ever changes and a real PR starts returning `404`, the dropped numbers are surfaced rather than silently lost. ## Related issues N/A ## Additional information Unit tests cover the parsing edge cases (truncated revert, issue+PR, cherry-pick, non-digit parentheticals) and the CLI behavior (both cherry-pick authors credited; an issue `404` does not drop the real PR author and is reported in the output). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: sai.miduthuri <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]>
…dge cases (ray-project#64354) ## Description The `get_contributors` release-notes script extracts PR numbers from commit subjects to look up contributor logins. The old `_find_pr_number` helper grabbed all text between `(#` and the first `)`, which produced wrong results for several real commit titles: - A truncated revert like `Revert "... hot path (ray-project#6... (ray-project#64309)` yielded `6... (ray-project#64309` instead of `64309`. - A title carrying a fixed-issue reference followed by the merging PR, e.g. `... cpu_percent (ray-project#63729) (ray-project#63733)`, yielded the issue number `63729` instead of the PR `63733`. - **Cherry-picks** such as `... in MiB (ray-project#63932) (ray-project#64042)` (original PR + backport PR) credited only one number, silently dropping the original author. This PR replaces it with `_find_pr_numbers`, which: - Matches only well-formed `(#<digits>)` tokens using a module-level compiled regex (the helper runs up to thousands of times per invocation). - Returns **every** candidate in title order. The commit text alone cannot tell an issue from a PR or an original from a backport, so `run` queries all candidates via the GitHub API and credits each one that resolves as a real PR. A cherry-pick now credits both the original author and the backporter. - Treats a `404` as expected (the number is an issue, not a PR) and collects those numbers, printing them at the end. This way, if GitHub's behavior ever changes and a real PR starts returning `404`, the dropped numbers are surfaced rather than silently lost. ## Related issues N/A ## Additional information Unit tests cover the parsing edge cases (truncated revert, issue+PR, cherry-pick, non-digit parentheticals) and the CLI behavior (both cherry-pick authors credited; an issue `404` does not drop the real PR author and is reported in the output). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: sai.miduthuri <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]> Signed-off-by: 400Ping <[email protected]>
Description
The
get_contributorsrelease-notes script extracts PR numbers from commit subjects to look up contributor logins. The old_find_pr_numberhelper grabbed all text between(#and the first), which produced wrong results for several real commit titles:Revert "... hot path (#6... (#64309)yielded6... (#64309instead of64309.... cpu_percent (#63729) (#63733), yielded the issue number63729instead of the PR63733.... in MiB (#63932) (#64042)(original PR + backport PR) credited only one number, silently dropping the original author.This PR replaces it with
_find_pr_numbers, which:(#<digits>)tokens using a module-level compiled regex (the helper runs up to thousands of times per invocation).runqueries all candidates via the GitHub API and credits each one that resolves as a real PR. A cherry-pick now credits both the original author and the backporter.404as expected (the number is an issue, not a PR) and collects those numbers, printing them at the end. This way, if GitHub's behavior ever changes and a real PR starts returning404, the dropped numbers are surfaced rather than silently lost.Related issues
N/A
Additional information
Unit tests cover the parsing edge cases (truncated revert, issue+PR, cherry-pick, non-digit parentheticals) and the CLI behavior (both cherry-pick authors credited; an issue
404does not drop the real PR author and is reported in the output).🤖 Generated with Claude Code