Conversation
Control reads threw out of response.json on non-JSON bodies and rejected the panel poll; they now answer null on malformed shapes. client envelope unwrap threw TypeError on null/array bodies; it now throws the caller fallback. socketUrl interpolated unchecked WS ports so bad values threw in WebSocket constructors; only 1-65535 digits override same-origin. Screenshot and page-frame readers shape-check before atob; live-screen drops non-finite dimensions and oversized payloads; relativeTime returns the input on invalid dates.
Ayush7614
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso,
mxmzb and
tylerslaton
as code owners
September 15, 2026 09:28
Contributor
|
Thanks — the guards themselves are right and the tests cover the cases well. One blocker: Four spots (lines ~62, 72, 84, 96). Cast through })) as unknown as typeof fetch;Push that and CI goes green — happy to merge it straight after. |
davidmckayv
added a commit
that referenced
this pull request
Sep 15, 2026
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.
Contributor
|
Landed in #561 (your change + a one-line test-cast fix so the app typechecks). GitHub wouldn't let me push the fix to this branch directly, so I folded it in there, credited to you. Thanks! |
Contributor
|
Superseded by #561 — merged. Thanks @Ayush7614. |
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.
Control reads threw out of response.json on non-JSON bodies and rejected the panel poll; they now answer null on malformed shapes. client envelope unwrap threw TypeError on null/array bodies; it now throws the caller fallback. socketUrl interpolated unchecked WS ports so bad values threw in WebSocket constructors; only 1-65535 digits override same-origin. Screenshot and page-frame readers shape-check before atob; live-screen drops non-finite dimensions and oversized payloads; relativeTime returns the input on invalid dates.
Verified: bun test app/tests/app-resilience-guards.test.ts app/tests/socket-url.test.ts — 16 pass, 0 fail. Biome lint and format clean.