5. Add Cog playground API client#3106
Conversation
|
I'm Bonk, and I've done a quick review of your PR. This PR adds a proxy-backed Cog API client with bounded HTTP/SSE parsing and browser file conversion, plus comprehensive tests. I found a couple of actionable issues:
|
There was a problem hiding this comment.
I'm Bonk, and I've done a quick review of your PR.
This PR adds a proxy-backed Cog API client with bounded HTTP/SSE parsing and browser file conversion, plus comprehensive tests. The previously reported issues (SSE cleanup and file size bounds) have been addressed.
I found one remaining issue:
-
Reader lock double-release in
sse.tsandhttp.ts(high severity)
Per the Streams spec,ReadableStreamDefaultReader.cancel()releases the reader lock synchronously before its returned promise settles. Callingreader.releaseLock()afterward unconditionally throws aTypeErrorbecause the reader is no longer active.- In
sse.ts, this means any early termination of an SSE stream (e.g., the consumer breaks out of afor await...ofloop) causesiterator.return()to reject with a TypeError instead of completing cleanly. - In
http.ts, when a response exceeds the streaming size limit,reader.cancel()releases the lock and thenreleaseLock()in thefinallyblock throws, masking the intended "Response body exceeds..." error with an unrelated TypeError.
The existing test "releases an SSE reader lock when cancellation fails" uses a mock that does not faithfully implement the spec (it never releases the lock), so it gives a false sense of security. The test should also be updated to verify correct behavior with a spec-compliant reader.
I've posted suggestions for both files.
- In
|
I'm Bonk, and I've done a quick review of your PR. This PR adds a proxy-backed Cog API client with bounded HTTP/SSE parsing and browser file conversion, plus comprehensive tests. I found one remaining issue:
|
|
Follow-up disposition: validated against the Streams Standard and a local Web Streams probe. |
There was a problem hiding this comment.
I'm Bonk, and I've done a quick review of your PR.
This PR adds a proxy-backed Cog API client with bounded HTTP/SSE parsing and browser file conversion, plus comprehensive tests.
I found one remaining issue:
- Missing unit tests for
cancelandconfigmethods (low severity) — These two public methods onCogApihave no test coverage.cancelinvolves URL construction and error handling, whileconfigfetches and parses local playground configuration. Adding basic tests would prevent regressions for these entrypoints.
|
I've completed the review of PR #3106. The batch review has been posted successfully. Summary: I found one actionable issue — missing unit tests for the The previously discussed issues (SSE cleanup and file size bounds) were already addressed in earlier review rounds. The author also provided a clear technical response regarding the reader lock behavior, which I accepted as resolved. |
markphelps
left a comment
There was a problem hiding this comment.
I spotted two type-boundary issues in the new API client. Both are small structurally, but worth fixing before callers start depending on these public types.
|
LGTM |
Uh oh!
There was an error while loading. Please reload this page.