Guard app reads against malformed payloads and invalid dates - #561
Merged
Merged
Conversation
The app read several server responses without checking their shape: the shared client did `(await response.json())[key]` and threw on a 204 or a non-JSON body; the computer control and screen readers cast unchecked payloads and threw in the viewer; relative-time fed NaN into the formatter; and the socket URL interpolated an unvalidated port, throwing synchronously in `new WebSocket()`. Each now degrades gracefully — a real HTTP error still surfaces the server's message, only a malformed 2xx body falls back — without hiding a genuine failure. Originally #549 by Ayush7614, folded in here with the fetch mocks in the test cast through `unknown` so the app typechecks; the fork branch could not take that one-line fix directly.
davidmckayv
requested review from
MikeRyanDev,
guidovizoso,
mxmzb and
tylerslaton
as code owners
September 15, 2026 17:21
This was referenced Sep 15, 2026
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.
Folds in #549 by @Ayush7614 — the client/computer/relative-time/socket-url resilience guards, verified clean — with one fix: the fetch mocks in
app/tests/app-resilience-guards.test.tsare cast throughunknown(as unknown as typeof fetch) sobun run typecheckpasses. #549's own branch couldn't take that one-line fix (GitHub refused the maintainer push to it), so this lands the same work here. Closing #549 in favour of this.Credit to @Ayush7614 for the change.