Fix duplicate leading ticket IDs in generated report lines#62
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes duplicate ticket ID rendering in generated report lines by extending the stripLeadingTicketPrefixIfSame function to handle plain ticket prefixes (e.g., "1259566 Added ...") in addition to the existing bracketed format (e.g., "[1259566]"). The function now also recognizes variations like "#1259566" and "LABEL-1259566" when they match ticket IDs.
Changes:
- Extended ticket deduplication logic to handle plain leading ticket IDs without brackets
- Added regex pattern to match various ticket prefix formats (plain numbers, #-prefixed, label-prefixed)
- Added test coverage for plain ticket prefix deduplication
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/report/report_builder.go | Added bareTicketLeadRe regex and extended stripLeadingTicketPrefixIfSame to handle plain ticket prefixes using a ticketSet map for matching |
| internal/report/report_builder_test.go | Added test case for plain ticket prefix deduplication (e.g., "1259566 added...") |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| break | ||
| if len(matches) == 2 { | ||
| leading := canonicalTicketIDs(matches[1]) | ||
| if leading == tickets { |
There was a problem hiding this comment.
Inconsistent case handling: this comparison is case-sensitive, but the bare ticket comparison on line 712 is case-insensitive (both the ticketSet population on line 690 and the candidate lookup use ToLower). If ticket IDs can contain letters, a description like "[abc123] Implement feature" with TicketIDs "ABC123" would not be stripped here, but "abc123 Implement feature" would be stripped by the bare ticket logic. Consider using case-insensitive comparison here as well for consistency.
| if leading == tickets { | |
| if strings.EqualFold(leading, tickets) { |
What changed
Tests