Skip to content

Guard History and Analytics against partial API payloads#35

Merged
kernelcoffee merged 1 commit into
masterfrom
dev/frontend_guards
Jul 12, 2026
Merged

Guard History and Analytics against partial API payloads#35
kernelcoffee merged 1 commit into
masterfrom
dev/frontend_guards

Conversation

@kernelcoffee

Copy link
Copy Markdown
Owner

The Playwright suite surfaced two unhandled TypeErrors that blanked pages whenever the API returned a partial/unexpected shape:

  • History: useEntries now normalizes at the data boundary (entries ?? [], count ?? 0) so data.items is always an array.
  • Analytics: by_type breakdown falls back to 0 per type, and the win-rate badge/label/bar use (win_rate ?? 0) instead of calling .toFixed on undefined.

e2e/degraded-api.spec.ts replays the exact degraded payloads and asserts both pages render gracefully.

Verified: 13 e2e passed, eslint zero warnings, tsc clean, 170 unit tests pass.

The Playwright suite surfaced two unhandled TypeErrors that blanked
pages whenever the API returned a partial/unexpected shape:

- History: useEntries now normalizes at the data boundary
  (entries ?? [], count ?? 0) so data.items is always an array.
- Analytics: by_type breakdown falls back to 0 per type, and the
  win-rate badge/label/bar use (win_rate ?? 0) instead of calling
  .toFixed on undefined.

e2e/degraded-api.spec.ts replays the exact degraded payloads and
asserts both pages render gracefully.

Verified: 13 e2e passed, eslint zero warnings, tsc clean, 170 unit
tests pass.
@kernelcoffee kernelcoffee merged commit 5dd9995 into master Jul 12, 2026
7 checks passed
@kernelcoffee kernelcoffee deleted the dev/frontend_guards branch July 12, 2026 23:32
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