Stop substituting synthetic market data when live quote/history providers fail #14

Closed
opened 2026-03-15 01:25:53 +00:00 by Francy51 · 0 comments
Owner

The codebase currently substitutes deterministic fake market data when the upstream quote provider fails, and downstream analysis consumes that data as if it were real.

Why this is a problem:

  • Violates correctness and predictability under failure.
  • Turns provider outages into silent data corruption instead of explicit degraded state.
  • Pollutes valuation, charting, and portfolio refresh flows with fabricated values.

Observed in:

  • lib/server/prices.ts
    • fallbackQuote()
    • getQuote() fallback path
    • getPriceHistory() synthetic history fallback
  • lib/server/company-analysis.ts
    • consumes getQuote() and getPriceHistory()
  • lib/server/task-processors.ts
    • uses getQuote() during portfolio price refresh

Suggested direction:

  • Return null or a typed degraded-state result on upstream failure.
  • Preserve the last known good value only if it is explicitly marked stale.
  • Surface provider failure to callers so UI and background jobs can show a degraded state instead of fabricated numbers.
  • Add tests that fail if synthetic prices/history are emitted from live-data paths.

Acceptance criteria:

  • No live-data server path fabricates quotes or historical series.
  • Downstream consumers handle unavailable price data explicitly.
  • Failure state is observable in task output and company analysis payloads.
The codebase currently substitutes deterministic fake market data when the upstream quote provider fails, and downstream analysis consumes that data as if it were real. Why this is a problem: - Violates correctness and predictability under failure. - Turns provider outages into silent data corruption instead of explicit degraded state. - Pollutes valuation, charting, and portfolio refresh flows with fabricated values. Observed in: - `lib/server/prices.ts` - `fallbackQuote()` - `getQuote()` fallback path - `getPriceHistory()` synthetic history fallback - `lib/server/company-analysis.ts` - consumes `getQuote()` and `getPriceHistory()` - `lib/server/task-processors.ts` - uses `getQuote()` during portfolio price refresh Suggested direction: - Return `null` or a typed degraded-state result on upstream failure. - Preserve the last known good value only if it is explicitly marked stale. - Surface provider failure to callers so UI and background jobs can show a degraded state instead of fabricated numbers. - Add tests that fail if synthetic prices/history are emitted from live-data paths. Acceptance criteria: - No live-data server path fabricates quotes or historical series. - Downstream consumers handle unavailable price data explicitly. - Failure state is observable in task output and company analysis payloads.
Francy51 added the P1 label 2026-03-15 01:25:53 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Francy51/Neon-Desk#14