Guard History and Analytics against partial API payloads#35
Merged
Conversation
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.
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.
The Playwright suite surfaced two unhandled TypeErrors that blanked pages whenever the API returned a partial/unexpected shape:
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.