Fix PointsPath codeshare matching with a route+time fallback key#5
Merged
Merged
Conversation
Today's matcher keys on (first-segment flight number, departure date).
Codeshares break this: Matrix returns the *marketing* flight number
(e.g. AA6939 JFK→LHR) while PointsPath returns the same physical aircraft
under the *operating* flight number (e.g. BA174, surfaced inside the
American PP query — PP attributes codeshares to the operator).
AA6939 != BA174 → no award attaches, even though one exists.
Live probe (research/probe_pp_matching.py against PP's airline-search):
American query for JFK→LHR 2026-08-15 returned:
AA100 18:10 (AA-operated)
BA174 18:40 (BA-operated, AA-markets it as AA6939)
BA180 19:10
AA106 19:20
BA116 20:20, BA114 21:40, BA182 22:40
Conclusion: PP already surfaces the codeshares — they just hide behind
operating flight numbers. The fix is on our side.
Match strategy is now:
primary : (flight#, date) — unchanged for non-codeshares
fallback: (origin, dest, dep_to_minute) — bridges codeshares because both
Matrix and PP read the same
airline-published schedule
Hits from both keys are unioned and deduped by OutboundFlight identity so
non-codeshare flights aren't double-attached.
Minute-precision exact match (no tolerance window) — kept simple to start;
real schedule-source drift between Matrix and PP is rare. If users hit it,
extending to ±N min is a one-line change.
Closes work-22az.
Side notes from the probe (filed for follow-up, not this PR):
- `enableGoogleFlightMatching=true` + a synthetic flight_id hint returned
zero flights — likely PP needs *real* Google Flights IDs to anchor the
match. Worth retrying inside work-qmx1 (gflight + PP overlay), where
fli produces those IDs.
- `BritishAirways` returns "unsupported airline" on this Pro tier.
Doesn't matter for this fix (codeshares ride in via the operator's
PP record under whichever airline PP enables them), but worth noting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Today's matcher keys on
(first-segment flight number, departure date). Codeshares break this: Matrix returns the marketing flight number (e.g. AA6939 JFK→LHR) while PointsPath returns the same physical aircraft under the operating flight number (e.g. BA174, surfaced inside theAmericanPP query — PP attributes codeshares to the operator).AA6939 != BA174→ no award attaches even though one exists.A live probe against PP's airline-search (
research/probe_pp_matching.py) confirmed PP already surfaces the codeshares — they just hide behind operating flight numbers:So the fix is on our side. Match strategy is now:
(flight#, date)(origin, dest, departure_to_minute)Hits from both keys are unioned and deduped by
OutboundFlightidentity so non-codeshare flights aren't double-attached.Minute-precision exact match (no tolerance window) — kept simple to start; real schedule-source drift between Matrix and PP is rare. If users hit it, extending to ±N min is a one-line change.
Closes
work-22az.Side findings from the probe (not in this PR)
enableGoogleFlightMatching=true+ a syntheticflight_idhint dropped the result list to 0 — likely PP needs real Google Flights IDs to anchor the match. Worth retrying insidework-qmx1(gflight + PP overlay), wherefliproduces those IDs.BritishAirwaysreturns"unsupported airline"on this Pro tier. Doesn't matter here — codeshares ride in via the operator's PP record under whichever airline PP enables.Test plan
make check(ruff lint + format + basedpyright strict + pytest) — all green