Repository navigation
fix: stop bare #N in comments, link text, colours and words becoming tickets - #4198
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
⚙️ Agent run details
|
PR Code Suggestions ✨Explore these optional code suggestions:
⚙️ Agent run details
|
3665003 to
8f63088
Compare
…tickets A bare `#N` was read as an issue of the PR's own repository wherever it appeared. Dependabot release notes link `#6211` to another repo, PR templates keep example `Closes #1234` inside HTML comments, and Tailwind arbitrary values such as `bg-[#121212]` produced bogus tickets like `issues/121212`. The default `#N` branch now skips a match when it is: - inside a closed HTML comment, - the whole text of an HTML or Markdown link, - glued to a word on either side (`issue#12`, `#0a0a0a`), - a Tailwind arbitrary value (`[` preceded by a word or `-`). An `owner/repo#N` tail keeps its existing behaviour. Explicit URLs and shorthand references are unchanged, as is the `[#42]` and `(#42)` form. Fixes #4196 Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
6a84036 to
13d72d4
Compare
IsmaelMartinez
left a comment
There was a problem hiding this comment.
Thanks @jay23606 for turning #4196 round the same day, failing tests first. Every default-path example from the issue now drops out, while Fixes #42, (#42), [#42], full issue URLs and owner/repo#N still resolve. Two asks before merge. The comment pattern, the anchor pattern and the any() over spans all go quadratic on long input, and new regexes here need to be linear-time; the first three suggestions keep every default-path result identical on real descriptions with one find pass, [^<>]* and a set lookup. #4196 also names description_issue_regex taking #1234 from a template comment; the second suggestion fixes that by seeding explicit_spans with the comment spans, and the last one pins it.
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
Refs #4196 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for working through all four suggestions, and for picking up the PR-Agent bot's quoted-attribute and reference-link cases too. One regression came in with the reference-link support: allowing a space between |
User description
Fixes #4196
Change
extract_ticket_links_from_pr_descriptiontreated every bare#N(up to six digits) as an issue of the PR's own repository. The default#Nbranch now skips a match when it is:<!-- Example: Closes #1234 -->),<a href="...">#6211</a>,[#6211](...)),issue#12,#0a0a0a),[follows a word character or-(bg-[#121212],dark:bg-[#0a0a0a]).Unchanged: explicit issue URLs,
owner/repo#Nshorthand,(#42),[#42], and thedescription_issue_regexpath.Design choice
The issue suggests these four rules. I did not follow the issue's wording for one case. The "glued to a word" rule does not apply when the glued text is an
owner/repo#Ntail, becausex/my-org/my-repo#42already resolves to local issue 42 andtest_regression_mid_token_does_not_match_cross_repopins that. Alternative for the maintainer: drop the before-side word check entirely, which would leaveissue#12resolving as a ticket.Tests
Failing test first:
tests/unittest/test_hash_reference_false_positives.py.(#42),[#42],Fixes #42and the real anchor/comment cases).Touched tests after the fix:
test_hash_reference_false_positives.py,test_github_issue_reference_extraction.py,test_ticket_compliance.py,test_ticket_compliance_non_list.py,test_extract_issue_from_branch.py,test_markdown_ticket_output_core.py: 280 passed.Not verified: the full unit suite was not run. Only the ticket-extraction test files above were run, on Python 3.14 on Windows.
🤖 Generated with Claude Code
PR Type
Bug fix, Tests
Description
Ignore bare issue numbers in comments and links.
Reject word fragments and Tailwind colour values.
Preserve explicit references and custom regex behavior.
Add regression tests for false-positive ticket extraction.
Diagram Walkthrough
File Walkthrough
ticket_pr_compliance_check.py
Filter misleading bare hashes during ticket extractionpr_agent/tools/ticket_pr_compliance_check.py
containing only
#N.inside Tailwind arbitrary values.
custom regexes, and repository-like tails.
test_hash_reference_false_positives.py
Cover false positives and valid issue referencestests/unittest/test_hash_reference_false_positives.py
text.
extractable.
⚙️ Agent run details