Skip to content

Forget a selected airport the new dataset no longer carries - #45

Open
RISCfuture wants to merge 1 commit into
navdata/prefer-prebuilt-storefrom
navdata/prune-selected-airport
Open

Forget a selected airport the new dataset no longer carries#45
RISCfuture wants to merge 1 commit into
navdata/prefer-prebuilt-storefrom
navdata/prune-selected-airport

Conversation

@RISCfuture

Copy link
Copy Markdown
Contributor

The problem

A leg's airport is remembered in the app group as a bare record ID (Defaults[.takeoffAirport] / .landingAirport, Defaults.swift:129-136), and the nav-data store is replaced wholesale each cycle. Nothing reconciled the two.

That assumption is now known to be false. FAA site numbers are not stable across cycles: in the 2026-09-03 cycle the FAA corrected FAA LID 18AL (LOUISVILLE STAGEFIELD AHP) from site 03329.19 to 00329.19 — a long-standing digit transposition — and it has not been re-published. Airports are also simply retired.

When the selected record vanishes, RunwayPerformanceService throws airportNotFound and the pilot is told:

Takeoff and landing numbers couldn't be calculated — That airport isn't in the database. Check the identifier, or reload airport data in SF50 TOLD.

Neither remedy can work. The identifier was written by the app, not typed; and reloading airport data is precisely what removed the record, so every future cycle fails the same way. The selection lives in the app-group suite — the one extensions can read — so this surfaces in the widget and in Siri, where there is no way to reselect. In-app UI is unaffected; it falls back to "Choose Airport".

The fix

install(generation:) now forgets a selection the incoming dataset cannot resolve, along with the runway chosen on it. Both install paths — the prebuilt download and the property-list import — already converge here, so one call site covers both.

The check deliberately does not use the view model's container. As the comment there notes, that container still reads the generation being replaced until the app reopens its store, so a fetch through it would find the stale airport and clear nothing. It opens the generation just installed instead, with the same in-memory guard makeImportContainer uses so tests, previews and screenshot runs keep reading the container they were given. A failed fetch reads as "present", so nothing is cleared on the strength of an error.

Operation gains clearSelection(), beside the accessors that already read the selection.

Verification

  • xcodebuild build, scheme SF50 TOLD on iPhone 17 Pro (as CI): BUILD SUCCEEDED
  • SF50 Shared Unit Tests plan: 419 tests in 50 suites + 15 in 3 suites, all passed
  • SwiftLint --strict with CI's fetched parent config: 0 violations in 383 files
  • swift-format --strict with CI's config: clean

Notes for review

No tests added. clearSelection() is wiring, and the prune sits in the app target where nothing currently tests NavDataLoaderViewModel — covering it would mean new scaffolding rather than extending existing coverage. Happy to add one if you'd rather.

Based on the stack tip (navdata/prefer-prebuilt-store) so it lands last without disturbing the ordering of #35#44. It arguably belongs in #39, where install(generation:) is introduced, but folding it there means rebasing everything above it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QZ3UWydnavm3g9Gs62Xirb

A leg's airport is remembered in the app group as a record ID, and the FAA
retires airports between cycles and occasionally corrects the site number
identifying one. Installing a dataset that lacks the record left the selection
in place, where the widget and Siri resolved it, failed, and suggested
reloading the data that had just removed it — advice that could not work,
since no later cycle restores the record either.

Installing now forgets a selection the incoming generation cannot resolve,
along with the runway chosen on it. The check reads the generation just
installed rather than the container the views still hold, which points at the
dataset being replaced.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QZ3UWydnavm3g9Gs62Xirb
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