Skip to content

fix(military): narrow ICAO hex ranges to stop civilian false positives#627

Merged
koala73 merged 3 commits into
mainfrom
fix/military-false-positives
Mar 1, 2026
Merged

fix(military): narrow ICAO hex ranges to stop civilian false positives#627
koala73 merged 3 commits into
mainfrom
fix/military-false-positives

Conversation

@koala73

@koala73 koala73 commented Mar 1, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #462 — commercial aircraft (Alitalia, JAL, Air India, etc.) were being flagged as military activity.

Root cause: MILITARY_HEX_RANGES in src/config/military.ts used entire country ICAO allocations instead of the actual military-specific sub-ranges. For example, Italy's full block 300000-33FFFF was marked as military — this includes ALL Italian commercial aircraft. Same issue for Japan (840000-87FFFF), India (800000-83FFFF), Spain (340000-37FFFF), and the US civilian range A00000-A3FFFF.

Additionally, the server-side isMilitaryCallsign() had an overly broad regex /^[A-Z]{4,}\d{1,3}$/ that matched any 4+ letter prefix with 1-3 trailing digits — catching GA callsigns and foreign registrations.

Fix: Replaced all ranges with verified military sub-ranges from tar1090-db/ranges.json (the authoritative ADS-B community database):

Country Before (wrong) After (correct) Impact
USA A00000-A3FFFF removed (civilian N-numbers) ~4M false positives removed
Italy 300000-33FFFF 33FF00-33FFFF Alitalia/ITA no longer flagged
Japan 840000-87FFFF removed entirely JAL/ANA no longer flagged
India 800000-83FFFF 800200-8002FF Air India/IndiGo no longer flagged
Spain 340000-37FFFF 350000-37FFFF Iberia/Vueling no longer flagged
France 3A0000-3BFFFF 3AA000-3AFFFF + 3B7000-3BFFFF Air France no longer flagged
Germany 3F0000-3FFFFF 3EA000-3EBFFF + 3F4000-3FBFFF Lufthansa no longer flagged
Canada C00000-C0FFFF C20000-C3FFFF Air Canada no longer flagged

Also removed unconfirmed ranges (South Korea, Sweden, Singapore, Pakistan) and added confirmed military ranges (Austria, Belgium, Switzerland, Brazil).

Test plan

  • Deploy to staging, open Military Activity layer
  • Verify commercial airlines no longer appear as military dots
  • Verify known military callsigns (REACH, NAVY, etc.) still detected
  • Check Mediterranean/Middle East region for proper military coverage

…false positives (#462)

MILITARY_HEX_RANGES used entire country ICAO allocations instead of
military-specific sub-ranges (sourced from tar1090-db/ranges.json).
This flagged ALL commercial aircraft from Italy, Spain, Japan, India,
South Korea, etc. as military activity.

Key changes:
- Remove A00000-A3FFFF (US civilian N-numbers) — military starts at ADF7C8
- Italy 300000-33FFFF → 33FF00-33FFFF (top 256 codes only)
- Spain 340000-37FFFF → 350000-37FFFF (upper 3/4 confirmed military)
- Japan 840000-87FFFF removed (no confirmed JASDF sub-range)
- France narrowed to 3AA000-3AFFFF + 3B7000-3BFFFF
- Germany narrowed to 3EA000-3EBFFF + 3F4000-3FBFFF
- India 800000-83FFFF → 800200-8002FF (256 codes)
- Canada C00000-C0FFFF → C20000-C3FFFF (upper half)
- Remove unconfirmed: South Korea, Sweden, Singapore, Pakistan
- Add confirmed: Austria, Belgium, Switzerland, Brazil
- Drop overly broad /^[A-Z]{4,}\d{1,3}$/ callsign regex from server
@vercel

vercel Bot commented Mar 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
worldmonitor Ready Ready Preview, Comment Mar 1, 2026 6:00am
worldmonitor-finance Ready Ready Preview, Comment Mar 1, 2026 6:00am
worldmonitor-happy Ready Ready Preview, Comment Mar 1, 2026 6:00am
worldmonitor-startup Ready Ready Preview, Comment Mar 1, 2026 6:00am

Request Review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

koala73 added 2 commits March 1, 2026 09:58
Move ambiguous 2-letter prefixes (AE, RF, TF, PAT, SAM, OPS, CTF,
IRG, TAF) to SHORT_MILITARY_PREFIXES — these now only match when
followed by a digit (e.g. AE1234=military, AEE123=Aegean Airlines).

Add 97-case test suite covering:
- Military callsign detection (19 known patterns)
- Short prefix digit gating (6 cases)
- Civilian airline non-detection (26 airlines)
- Short prefix letter rejection (6 cases)
- Military hex range boundaries (7 confirmed ranges)
- Civilian hex non-detection (19 codes)
- Boundary precision (ADF7C8 start, 33FF00 start, etc.)
- No-full-allocation guard (10 countries)
@koala73
koala73 merged commit 1123879 into main Mar 1, 2026
6 checks passed
koala73 added a commit that referenced this pull request Mar 1, 2026
#627)

* fix(military): narrow hex ranges and callsign regex to stop civilian false positives (#462)

MILITARY_HEX_RANGES used entire country ICAO allocations instead of
military-specific sub-ranges (sourced from tar1090-db/ranges.json).
This flagged ALL commercial aircraft from Italy, Spain, Japan, India,
South Korea, etc. as military activity.

Key changes:
- Remove A00000-A3FFFF (US civilian N-numbers) — military starts at ADF7C8
- Italy 300000-33FFFF → 33FF00-33FFFF (top 256 codes only)
- Spain 340000-37FFFF → 350000-37FFFF (upper 3/4 confirmed military)
- Japan 840000-87FFFF removed (no confirmed JASDF sub-range)
- France narrowed to 3AA000-3AFFFF + 3B7000-3BFFFF
- Germany narrowed to 3EA000-3EBFFF + 3F4000-3FBFFF
- India 800000-83FFFF → 800200-8002FF (256 codes)
- Canada C00000-C0FFFF → C20000-C3FFFF (upper half)
- Remove unconfirmed: South Korea, Sweden, Singapore, Pakistan
- Add confirmed: Austria, Belgium, Switzerland, Brazil
- Drop overly broad /^[A-Z]{4,}\d{1,3}$/ callsign regex from server

* fix(military): constrain short prefixes + add classification tests

Move ambiguous 2-letter prefixes (AE, RF, TF, PAT, SAM, OPS, CTF,
IRG, TAF) to SHORT_MILITARY_PREFIXES — these now only match when
followed by a digit (e.g. AE1234=military, AEE123=Aegean Airlines).

Add 97-case test suite covering:
- Military callsign detection (19 known patterns)
- Short prefix digit gating (6 cases)
- Civilian airline non-detection (26 airlines)
- Short prefix letter rejection (6 cases)
- Military hex range boundaries (7 confirmed ranges)
- Civilian hex non-detection (19 codes)
- Boundary precision (ADF7C8 start, 33FF00 start, etc.)
- No-full-allocation guard (10 countries)

* fix: use charAt() instead of bracket indexing for strict TS
matthewvecchione1-ops pushed a commit to matthewvecchione1-ops/worldmonitor that referenced this pull request Mar 4, 2026
koala73#627)

* fix(military): narrow hex ranges and callsign regex to stop civilian false positives (koala73#462)

MILITARY_HEX_RANGES used entire country ICAO allocations instead of
military-specific sub-ranges (sourced from tar1090-db/ranges.json).
This flagged ALL commercial aircraft from Italy, Spain, Japan, India,
South Korea, etc. as military activity.

Key changes:
- Remove A00000-A3FFFF (US civilian N-numbers) — military starts at ADF7C8
- Italy 300000-33FFFF → 33FF00-33FFFF (top 256 codes only)
- Spain 340000-37FFFF → 350000-37FFFF (upper 3/4 confirmed military)
- Japan 840000-87FFFF removed (no confirmed JASDF sub-range)
- France narrowed to 3AA000-3AFFFF + 3B7000-3BFFFF
- Germany narrowed to 3EA000-3EBFFF + 3F4000-3FBFFF
- India 800000-83FFFF → 800200-8002FF (256 codes)
- Canada C00000-C0FFFF → C20000-C3FFFF (upper half)
- Remove unconfirmed: South Korea, Sweden, Singapore, Pakistan
- Add confirmed: Austria, Belgium, Switzerland, Brazil
- Drop overly broad /^[A-Z]{4,}\d{1,3}$/ callsign regex from server

* fix(military): constrain short prefixes + add classification tests

Move ambiguous 2-letter prefixes (AE, RF, TF, PAT, SAM, OPS, CTF,
IRG, TAF) to SHORT_MILITARY_PREFIXES — these now only match when
followed by a digit (e.g. AE1234=military, AEE123=Aegean Airlines).

Add 97-case test suite covering:
- Military callsign detection (19 known patterns)
- Short prefix digit gating (6 cases)
- Civilian airline non-detection (26 airlines)
- Short prefix letter rejection (6 cases)
- Military hex range boundaries (7 confirmed ranges)
- Civilian hex non-detection (19 codes)
- Boundary precision (ADF7C8 start, 33FF00 start, etc.)
- No-full-allocation guard (10 countries)

* fix: use charAt() instead of bracket indexing for strict TS
@koala73
koala73 deleted the fix/military-false-positives branch March 4, 2026 19:40
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.

All aircraft marked as military activity

1 participant