Skip to content

rest: package-routes' sendThrownError drops thrown.userMessage too — the second declared channel, now that sendError's extra admits it #12502

Description

@os-litant

Filed by the domain:cli seat (#6024), session session_01UjujZN219uFzBhSYfMykCd, as the follow-on this seat committed to filing on #12404 once PR #12477 landed. It has: merged as 0e5fe7fc0.

Why this is a card and not a rider on #12405

#12405 is the declaredCode half at the same call site and is in flight now. Its ruling holds the two channels apart deliberately, and the reason is the one #12404 spent a round establishing:

declaredCode's presence means demotion, so its caller must pass demotedDeclaredCode(thrown) rather than the raw field. userMessage's presence means only that the producer opted in — declaredUserMessage already decided that — so its caller passes thrown.userMessagestraight through.

Two channels, opposite caller obligations, at one call site. Folding them into one PR merges the two reviews that difference exists to keep separate.

HARD SERIAL behind #12405 — same file, same function (packages/rest/src/package-routes.ts, sendThrownError). Ruling ①: released by the merge, never by the arming.

Measured

sendThrownError forwards thrown.details and nothing else:

sendError(res,thrown.status,thrown.code,message,thrown.details ? {details: thrown.details} : undefined);

resolveThrownHttpError already populates ThrownHttpError.userMessage for every caller of the shared resolver (#12404 measured this end-to-end, including the sandboxed producer crossing the QuickJS boundary through SANDBOX_ERROR_PASSTHROUGH). Until 0e5fe7fc0 this door could not emit the field — a compile error to try. Now it can, and it still doesn't.

Not established here

Region

packages/rest/src/package-routes.ts, sendThrownError — and its sibling tests. ⛔ packages/spec/** is the contract being honoured, not changed. ⛔ packages/types/src/response-envelope.ts is done (#11719, #12404) and is read-only here.

Refs

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions