gengliangwang opened a new pull request, #57131:
URL: https://github.com/apache/spark/pull/57131

   ### What changes were proposed in this pull request?
   
   This PR adds a JIRA-vs-PR verification step to `dev/merge_spark_pr.py`. 
After the committer enters the PR number (right after the existing 
Epic/Umbrella check, before the "Proceed with merging?" confirmation), the 
script now, for each SPARK JIRA id linked from the PR title:
   
   - prints the PR title next to the ticket's summary, status, and issue type, 
so a mismatch is easy to spot;
   - prints a red warning on the status line when the ticket is already 
`Resolved`/`Closed` (a fresh merge should target an open ticket);
   - requires an explicit `y/N` confirmation. Answering anything other than `y` 
aborts the merge and asks the committer to fix the PR title.
   
   Implementation notes:
   
   - A new pure helper `format_jira_verification(...)` renders the block and is 
covered by inline doctests. Coloring the Resolved/Closed warning is gated 
behind a `use_color` flag (off in doctests so the expected output stays plain 
text, on at the real call site).
   - The existing Epic/Umbrella loop already fetches each linked issue; it now 
also collects them into `linked_issues`, so the verification step reuses those 
objects and performs no extra JIRA round-trips.
   - A small `red(...)` helper was factored out of `print_error` (no behavior 
change) and reused for the warning.
   
   No JIRA id is newly required by this change: `[MINOR]`/`[TRIVIAL]` PRs still 
merge with no SPARK id (the loop is a no-op for them). The existing 
`Title.parse` requirement is unchanged.
   
   ### Why are the changes needed?
   
   `merge_spark_pr.py` already prints each linked JIRA's summary, but nothing 
forces the committer to confirm the ticket actually matches the PR. A PR can 
therefore be merged against the wrong ticket - for example when a GitHub PR 
number in the body (`Closes #NNNNN`) is mistaken for a SPARK JIRA id - which 
resolves an unrelated, possibly already-Resolved ticket on merge. This step 
surfaces both signals (title/summary mismatch and an already-resolved ticket) 
and requires a human confirmation before the merge proceeds.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. This only affects the committer-facing merge tooling.
   
   ### How was this patch tested?
   
   - `python3 -m doctest dev/merge_spark_pr.py` - all doctests pass (including 
the two new `format_jira_verification` cases).
   - Manually rendered the block with `use_color=True` and confirmed the 
Resolved/Closed warning is wrapped in the same red escape as `print_error`.
   - Verified all added lines are within the 100-char limit and contain no 
non-ASCII characters.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 4.8)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to