Repository navigation
Conversation
A match preceded by a dash is dropped only when the segment before the dash is an all-uppercase token (TRIM-UI-200 no longer yields UI-200). fix-PACA-12-login and feat-paca-12 keep linking. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — reviewed the single commit f422fe2 (2 files, +76/−3): a targeted fix to how Git task refs are parsed out of a change request's branch and title, verified by reading the full diff, the surrounding saveChangeRequest/trackChangeRequest flow, the gitdom.Store.FindTaskByRef contract, and running a standalone repro plus go test/go vet on internal/service/git.
findTaskRefsparser (services/api/internal/service/git/service.go): new helper built onFindAllStringSubmatchIndexthat drops aPREFIX-Nmatch only when it is directly preceded by-and the run before that dash is an all-uppercase token, soTRIM-UI-200no longer resolves asUI-200. Group indexing (m[2]:m[3]prefix,m[4]:m[5]number) and the surroundingseendedup are correct, and the change only removes matches, so it cannot introduce new mis-links.saveChangeRequestwiring: now consumesfindTaskRefs; theFindTaskByRefcall and linking loop are otherwise unchanged.TestFindTaskRefs: table-driven coverage for kept refs (fix-PACA-12-login,feat-paca-12,Fix PACA-12) and dropped tails (TRIM-UI-200, mixed withPACA-7).
I independently reproduced the parser on the exact issue-649 cases: feat/TRIM-UI-200-x, TRIM-UI-200, and HOTFIX-PACA-12 all yield nothing, while TRIM-200 and fix-PACA-12-login still link. The documented trade-off (an uppercase prefix followed by a dash and another key is ignored) is real and intentional, and generated branch names use a lowercase type/PREFIX-N form, so they are unaffected.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

What
The task-ref parser matched the tail of dashed tokens:
TRIM-UI-200yieldedUI-200, which could link a change request to no task, or to a project whose prefix isUI.How
findTaskRefshelper built onFindAllStringSubmatchIndex(RE2 has no lookbehind), used bysaveChangeRequestinstead oftaskRefRE.FindAllStringSubmatch.-is dropped only when the segment before that dash is an all-uppercase token ([A-Z][A-Z0-9]*, at the start of the text or after a non-alphanumeric). SoTRIM-UI-200is ignored (not reinterpreted asTRIM-200, sincePROJ-Nstays the only task identifier), whilefix-PACA-12-loginandfeature-PACA-12keep linking.Trade-off
This is a heuristic on case. An uppercase prefix followed by
-and another key (e.g.HOTFIX-PACA-12) is always ignored. Dropping every match preceded by a dash would also have stoppedfix-PACA-12-loginfrom linking, which works today.Tests
Table-driven
TestFindTaskRefs:feat/PACA-12-login,paca/PACA-1,Fix PACA-12,fix-PACA-12-loginandfeat-paca-12match;TRIM-UI-200yields nothing;fix TRIM-UI-200 and PACA-7yields onlyPACA-7.go vet ./...andgo test ./...inservices/apipass (no Postgres needed).Manual test: a merge request on a real GitLab CE with branch
fix-TST-2-searchwas linked to task TST-2 through the webhook; one with branchTRIM-UI-3was linked to nothing. That project had only theTSTprefix, so the second case does not tell the old parser apart from the new one: the unit tests do.Refs #649
🤖 Generated with Claude Code