Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 24, 2025

The search function was marking up any text matching the call sign regex pattern, regardless of whether the prefix was registered in the ITU allocation table. This resulted in invalid patterns like BB1ABC or QQ2XYZ being highlighted with the call sign styling.

Changes

  • Added isValidPrefix() method - Validates prefixes against PREFIX_TABLE entries
  • Modified searchCallsigns() filtering - Parses matched patterns and validates prefix before creating <call-sign> elements
while ((match = regex.exec(`${text} `)) !== null) {
  const callsign = match[1];
  const parts = callsign.match(PARTS_REGEX);
  if (parts && Callsign.isValidPrefix(parts[1])) {  // Validation added here
    matches.push({
      callsign,
      index: match.index,
      length: callsign.length
    });
  }
}

Test Coverage

Added 31 tests covering:

  • Prefix validation for registered ranges (US: W/K/N/AA-AL, International: SM/DL/G/JA/VK)
  • Rejection of unregistered prefixes (Q, X, BB, KK, QQ, YZ)
  • Integration tests for mixed valid/invalid call signs in text

Manual Verification

Validation test page

Valid prefixes (W1AW, SM8AYA, DL1ABC) highlighted with flags. Invalid patterns (Q1ABC, BB1ABC, KK2XYZ) remain plain text.

Original prompt

Text strings that match how call signs look but aren't in any registered range should not be marked up by the search function


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits November 24, 2025 13:52
Co-authored-by: phieri <12006381+phieri@users.noreply.github.com>
Co-authored-by: phieri <12006381+phieri@users.noreply.github.com>
@phieri phieri marked this pull request as ready for review November 24, 2025 13:59
Copilot AI changed the title [WIP] Remove markup for unregistered call signs in search function Filter search results to registered ITU prefixes only Nov 24, 2025
Copilot AI requested a review from phieri November 24, 2025 13:59
@phieri phieri merged commit 76eaa88 into main Nov 24, 2025
5 checks passed
@phieri phieri deleted the copilot/remove-invalid-call-signs-markup branch November 24, 2025 14:00
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.

2 participants