Bound pending SSE decoder state - #6777
Conversation
🦋 Changeset detectedLatest commit: 5e5d909 The changes in this PR will be included in the next version bump. This PR includes changesets to release 29 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — bound pending SSE decoder state with a configurable maximum event size, surfaced as a typed SseError across all channel and client contracts.
SseErrortype and size enforcement — newData.TaggedErrorwithEventTooLargereason;Parser.feed()returnsSseError | undefined;decode/decodeSchema/decodeDataSchemaaccept optionalDecodeOptionswith configurablemaxEventSize(default 10 MiB).- Provider client wiring —
mapSseErrorhelper added to each AI provider'sinternal/errors.ts, mappingSseErrortoAiError.InvalidOutputError;Stream.catchTagshandlers hook into each client's stream pipeline. - Generated code and type-level propagation — OpenAI/OpenRouter
Generated.tsinterfaces, OpenAPI generator templates,HttpApiClientSuccessType, and type tests all carrySse.SseErrorin their SSE error channels. - Tests — four new
Sse.test.tscases: unterminated line overflow, accumulated data overflow, borderline pass (just under limit), and cross-chunk event reconstruction.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — extracted EventTooLarge as a standalone tagged error reason class, restructured SseError to wrap a SseErrorReason union.
EventTooLargeextracted —Data.TaggedError("EventTooLarge")now holdsmaxEventSizeand its ownmessage; this makes failure reasons independently matchable viainstanceOfand allowsSseErrorReasonto grow with future variants.SseErrordelegates to reason —reasonfield changed from a string literal toSseErrorReason(union ofEventTooLarge), andmessagedelegates tothis.reason.message. ThemaxEventSizefield moved offSseErrorontoEventTooLarge.- Tests updated — assertions switched from
strictEqual(error.reason, "EventTooLarge")+strictEqual(error.maxEventSize, N)toinstanceOf(error.reason, EventTooLarge)+strictEqual(error.reason.maxEventSize, N).
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏

Summary
SseErroracross low-level SSE stream contractsAiError.InvalidOutputErrorTesting
pnpm lint-fixpnpm checkpnpm --filter effect test --run test/unstable/encoding/Sse.test.tspnpm --filter @effect/openapi-generator test --run test/OpenApiGenerator.test.tspnpm test-types HttpApiClient.tst.tsCloses EFF-218