Skip to content

Flight-track client defaults to MockClient and silently disables track history unless env is set #7

@tg12

Description

@tg12

Summary

The client flight-track hook defaults to MockClient unless VITE_FLIGHT_PROVIDER is explicitly set to opensky. In that default branch, track history is unavailable because MockClient.track() always returns null.

Evidence

Why this matters

  • A missing or mis-set client env var changes the frontend from live provider mode to mock mode.
  • Track-history functionality can appear broken or absent even while the rest of the map renders, making the failure easy to miss.
  • This creates environment-dependent behavior that is not obvious from the UI.

Attack or failure scenario

A deployment omits VITE_FLIGHT_PROVIDER or uses a non-opensky value. Snapshot and tracking behavior diverge: parts of the flight UI rely on mock data assumptions, and track history silently resolves to null for every aircraft.

Root cause

Provider selection is driven by a fragile client-side env gate with a mock implementation as the default branch.

Recommended fix

  1. Make production provider selection explicit and fail closed when the configured provider is invalid.
  2. Do not default to a mock provider in production builds.
  3. Surface provider mode visibly in the UI or diagnostics.
  4. Add tests for provider selection and invalid env configuration.

Acceptance criteria

  • Production builds cannot silently default to MockClient.
  • Invalid or missing provider config produces explicit failure or warning state.
  • Track-history availability is deterministic across environments.

Suggested labels

  • bug
  • architecture
  • production-readiness

Severity

High — a configuration slip can silently put the client on mock behavior and break track history without obvious operator feedback.

Confidence

Confirmed — the hook defaults to MockClient, and that client's track() implementation is a hardcoded null.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions