fix(pr-issue-linkage): accept Refs/Relates markers and fail negated closers - #544
Conversation
…losers GitHub's linkage parser matches closing keywords regardless of surrounding prose, so a disclaimer next to a keyword still auto-closes the issue on merge. The gate used the same keyword shape, so the disclaimer both satisfied the required check and armed the auto-close (issue #521, observed on melodic-software/dotfiles#583). Add a first-class non-closing marker (`Refs: #N` / `Relates to: #N`, colon required, alone on its own rendered line) so an issue can be referenced without the no-issue opt-out, and fail the gate when the words immediately before a closing keyword negate it. The negation check is fail-closed and is not excused by a valid marker elsewhere in the body; only removing the keyword stops the merge from closing the issue. Co-authored-by: ksextonmelodic <ksextonmelodic@gmail.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Claude finished @kyle-sexton's task in 4m 31s —— View job Claude is reviewing this PR
|
|
Claude finished @kyle-sexton's task in 2m 31s —— View job Security review — pr-issue-linkage.yml negation/Refs update
Scope: diff between No security vulnerabilities found. Specifics I checked:
One non-blocking observation (not a security vulnerability, just a completeness note): Tests ( |
|
Last security-reviewed head: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eba5a07cbf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Claude has reviewed this PR 1 time. The lane skips further automatic reviews after 5; deleting this comment resets the count. |
A five-token window that contains "not" from "not only … but fixes #N"
was classifying an affirmative closer as negated and blocking the gate
even though GitHub would correctly auto-close. Skip "not" when the next
window token is "only"; real disclaimers ("does not close") still fail.
Co-authored-by: ksextonmelodic <ksextonmelodic@gmail.com>
…igger A comma-separated note such as "No known issues, closes #90" was read as a negated closer because the window did not reset at "," and bare "no" sat inside it. Treat comma like the other clause breaks. Keep "without" coverage on a same-clause fixture, and quote the matching trigger word in the error so a first-run failure is diagnosable. Co-authored-by: ksextonmelodic <ksextonmelodic@gmail.com>

Summary
The pr-issue-linkage gate matched GitHub's closing-keyword shape and ignored surrounding prose, so a disclaimer next to a keyword both satisfied this required check and still auto-closed the issue on merge (issue #521; observed on melodic-software/dotfiles#583). The convention also had no first-class way to reference an issue that the PR should leave open.
GitHub's official closing keywords are only close/closes/closed/fix/fixes/fixed/resolve/resolves/resolved (Linking a pull request to an issue).
RefsandRelates toare not in that list.Fix
Accept
Refs: #N/Relates to: #N(colon required, optionalowner/repo, at most three leading spaces, one marker per rendered line, no trailing prose) as a first-class linkage form alongside closing keywords and the no-issue opt-out.Fail the gate when a closing keyword is preceded, on the same rendered line and within five word tokens (cut at
.!?;), bynot/never/no/without/n'tcontractions /deliberately/intentionally. A negated closer fails even whenRefs:orNo linked issueappears elsewhere; the error tells the author to remove the closing keyword and useRefs: #N.Verification
node --test .github/scripts/pr-issue-linkage.test.cjs— 43 passed, 0 failed, including:Refs: #42plus the four contract headers passesRelates to: owner/repo#42passesNo linked issuestill failsCloses #42still passesNo linked issuestill passesRefs: #42 extra prosefails the Refs formIndependent verifier re-ran the suite on this HEAD — 43/43 pass.
Related
Closes #521