Skip to content

Don't match a version prefix after a magic word - #150

Closed
Mohith26 wants to merge 1 commit into
linear:mainfrom
Mohith26:fix/magic-word-version-prefix
Closed

Mohith26 wants to merge 1 commit into
linear:mainfrom
Mohith26:fix/magic-word-version-prefix

Conversation

@Mohith26

@Mohith26 Mohith26 commented Nov 3, 2026 •

Copy link
Copy Markdown

The magic-word path can link the wrong issue when the token after the keyword is a version. On main:

"Fix ios-17.4 keyboard crash"   -> ["IOS-1"]
"Fix node-20.11 build"          -> ["NODE-2"]
"Fixes ENG-123, ENG-45.6"       -> ["ENG-123", "ENG-4"]
'Revert "Fix ios-17.4 keyboard crash"' (reverted ids) -> ["IOS-1"]

ISSUE_ID_CORE has the (?!\.\d) version lookahead, but nothing stops [0-9]{1,9} from backtracking: 17 fails the lookahead, so the regex retries with 1, which is followed by 7 and passes. The captured ios-1 then goes through matchAllIdentifiers and becomes IOS-1. Branch names don't have this problem because ISSUE_IDENTIFIER_REGEX has an end boundary.

The fix adds (?![0-9]) before the version lookahead so the number can't end mid-digit. Real identifiers like Fixes IOS-1641 and lists like Fixes LIN-123, LIN-456 and ENG-789 are unchanged.

Testing: added the cases above to the version suffix tests (all 5 fail on main, pass with the change). vitest --run (473 tests), tsc --noEmit, oxlint and oxfmt --check pass.

ISSUE_ID_CORE let the issue number backtrack to a shorter prefix, so the
(?!\.\d) version lookahead could be skipped: "Fix ios-17.4 keyboard crash"
extracted IOS-1, and "Fix node-20.11 build" extracted NODE-2. Require the
number to end on a non-digit before checking the version suffix.
@Mohith26 Mohith26 closed this by deleting the head repository Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant