Skip to content

runtime dispatcher's SSE-fallback { events } body is off-envelope — the one non-conforming literal body left in dispatcher-plugin.ts after #9813's discovery flip #9936

Description

@huangyiirene

Found while implementing #9813 (the discovery-body envelope flip), by predicting what scripts/check-route-envelope.mjs's new express-style scan population would read from packages/runtime/src/dispatcher-plugin.ts. Filed unassigned — recording, not starting. Measured on origin/main at 45862a5.

The site

In the dispatcher route wrapper's streaming branch, locate by text res.json({ events }) (around line 269 on the measured ref; line numbers drift). When a dispatch result declares stream: true but the transport's response object has no write/end streaming surface, the handler collects the SSE events into an array and answers:

// Fallback: collect events into arrayconstevents=[];forawait(consteventofresult.events){events.push(event);}res.json({ events });

That body has no success flag and carries its payload under a top-level events key — off BaseResponseSchema in the same one-key-short family as the discovery bodies #9436/#9813 enveloped, plus a stray top-level key.

Why it is not swept into #9813

#9813's inherited ruling covers the two discovery bodies only (the #9436 sibling class: machine-read discovery surfaces, measured-tolerant readers). This body has a different consumer population — callers that requested an SSE stream and got the JSON fallback — and no reader sweep has been run on it. Whether it should be enveloped ({ success: true, data: { events } }), left as-is with a written reason, or the fallback retired outright is an undecided fork, not an inherited fix.

Where it is pinned

#9813's PR registers dispatcher-plugin.ts in check-route-envelope.mjs's enumerated express-style population with unenveloped: 1 and a ratchet naming this issue — so the count can only tick down, and this card is what drives it to zero.

Related: #9813 (the discovery flip and the scan population) · #9436 (the mother ruling) · #9389 (the pre-auth exemption boundary, a closed list this body is not on) · #9559 (rest-server's own envelope conversion; this file is not in its scope).


Generated by Claude Code

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions