fix(responses): bound synthesized SSE expansion - #1192
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe PR limits synthesized output to 10,000 items. It generates response frames incrementally, adds SSE stream conversion, updates bounded JSON handling, and adds overflow and streaming tests. ChangesSynthesized SSE output handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant BoundedJSONPath
participant responsesJsonToSseStream
participant ReadableStream
BoundedJSONPath->>responsesJsonToSseStream: pass repaired bounded JSON response
responsesJsonToSseStream->>ReadableStream: enqueue encoded frames incrementally
responsesJsonToSseStream->>ReadableStream: enqueue data: [DONE]\n\n
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Review readiness checklist
2/4 boxes ticked. This PR stays in draft until every box above is ticked. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
[DONE]trailer.Why
A bounded upstream JSON response can still contain many
outputitems. The previous HTTP path materialized both a complete event array and the complete SSE string, amplifying a provider-controlled response in memory. The shared WebSocket event sequence also had no item-count ceiling.The cap is checked before a stream is returned. Malformed/non-object JSON retains the existing plain-response fallback, while a cap violation is not swallowed by that fallback. If item-id repair fails, the path also falls back instead of synthesizing unrepaired identifiers.
Verification
b22e0e6d0): the same suites 13/13 passed.stream:truerequest above the cap returns JSON HTTP 502 with the standardserver_errorshape and no[DONE]stream.bun x tsc --noEmit: passed.bun scripts/privacy-scan.ts: passed.git diff --check: passed.Checklist
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
All CI tests are green on my local testing.
I pushed my PR to the latest dev commit.
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit
Bug Fixes
Improvements
[DONE]marker.