Skip to content

Guard app reads against malformed payloads and invalid dates - #561

Merged
davidmckayv merged 1 commit into
mainfrom
ci/app-resilience-guards
Sep 15, 2026
Merged

davidmckayv merged 1 commit into
mainfrom
ci/app-resilience-guards

Conversation

@davidmckayv

Copy link
Copy Markdown
Contributor

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.ts are cast through unknown (as unknown as typeof fetch) so bun run typecheck passes. #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.

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
davidmckayv merged commit 69ae8c5 into main Sep 15, 2026
28 of 30 checks passed
@davidmckayv
davidmckayv deleted the ci/app-resilience-guards branch September 15, 2026 17:31
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