Fix airline code-collision mismatch (FOX→Flyr); consistency-aware matching #19
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/airline-code-collision"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes the issue you hit: an FR24 flight on Flyr (IATA FS, ICAO FOX) was linked to the seeded FOX Linhas Aéreas (IATA FX, ICAO FOX) — a reused ICAO that the old ICAO-first lookup matched despite the IATA conflicting.
Root cause: neither IATA nor ICAO is unique in the seed — OpenFlights
airlines.datis frozen ~2014, keeps defunct carriers, and codes get reused (34 ICAO + 7 (IATA,ICAO) collisions; Flyr isnt in the seed at all). Verified in the seed DB.Fix: new pure, unit-tested
src/lib/airline-match.ts#pickAirline, used by bothresolveAirline(import) andbuildPrefill(enrichment):Verified against the real seed:
(FS/FOX)→ freeform "Flyr" ✓ (was: wrong link)(DY/NOZ)→ still links to seeded(DY/NAX)✓ (name corroboration prevents a regression — the first naive cut broke this)Existing flights are unaffected — the resolved
airline_id/freeform is pinned per row (so your manual fix stands). 52 tests pass (10 new forpickAirline). CLAUDE.md pattern #2 updated.pnpm typecheck/lint/testgreen.