Skip to content

Comments

Fix duplicate leading ticket IDs in generated report lines#62

Merged
WZ merged 1 commit intomainfrom
codex/fix-ticket-prefix-dedupe
Feb 21, 2026
Merged

Fix duplicate leading ticket IDs in generated report lines#62
WZ merged 1 commit intomainfrom
codex/fix-ticket-prefix-dedupe

Conversation

@WZ
Copy link
Owner

@WZ WZ commented Feb 21, 2026

What changed

  • Fix duplicate ticket rendering when description already starts with a plain ticket id (for example: "1259566 Added ...")
  • Keep a single canonical prefix based on TicketIDs, resulting in: "[1259566] Added ..."
  • Also handles leading forms like #1259566 and LABEL-1259566 when they match the item ticket id

Tests

  • Added report unit test coverage for plain leading ticket dedupe
  • go test ./...

Copilot AI review requested due to automatic review settings February 21, 2026 00:46
@WZ WZ merged commit fb0a399 into main Feb 21, 2026
3 checks passed
@WZ WZ deleted the codex/fix-ticket-prefix-dedupe branch February 21, 2026 00:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
if leading == tickets {
if strings.EqualFold(leading, tickets) {

Copilot uses AI. Check for mistakes.
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