You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(hono): answer a raw-mount escaped throw with the declared ADR-0112 envelope (#17643)
* fix(hono): answer a raw-mount escaped throw with the declared ADR-0112 envelope
A route mounted through `IHttpServer.getRawApp()` funnels through neither
`wrap()` nor any registrar wrapper, so its escaped throw reached Hono's own
default handler: `500 text/plain "Internal Server Error"`, with the thrown
value's declared `status`/`code` discarded. Install a transport error seam on
the raw handle that renders the SAME `declaredEnvelopeForThrow` gate `wrap()`
opted into, so `/raw/*` and a direct-mount route answer one shape.
The observation seam's rejected-request status now reads that same rule: it
defaulted to 500 because Hono's error path always sent 500, which stops being
true here, and `http_requests_total{status}` is armed off that seam.
Claude-Session: https://claude.ai/code/session_01TSf4DV7ziu4V5j73e46b7c
Co-authored-by: Claude <noreply@anthropic.com>
* test(hono): keep the raw-mount pin's Hono handlers `never`-returning, add the changeset
A Hono handler may not return `void`, and only a body whose statement IS the
`throw` infers `never` — so each door throws a value a factory hands back
instead of calling a shared throwing helper.
Claude-Session: https://claude.ai/code/session_01TSf4DV7ziu4V5j73e46b7c
Co-authored-by: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
**`getRawApp()` mounts now answer an escaped throw with the declared ADR-0112 envelope.** A route mounted on the Hono handle funnels through neither the adapter's `wrap()` nor any registrar wrapper, so an escaped throw was answered by Hono's own default handler — `500 text/plain "Internal Server Error"`, no `success` flag, no `code`, and the thrown value's own declared `status` / `code` discarded. A transport error seam on the raw handle now renders the same throw-to-envelope rule a direct-mount route already used, so both doors answer one shape: a throw declaring `503` / `SERVICE_UNAVAILABLE` answers `503 application/json` with `{"success":false,"error":{"code":"SERVICE_UNAVAILABLE",…}}`, and a throw declaring no envelope still answers `500` with no cause in the body.
6
+
7
+
The escape hatch is unchanged: consumers still mount framework-natively, still stay outside `getMountedRoutes()`, and still need no adapter verb. A thrown value carrying its own `Response` (Hono's `HTTPException`) keeps the response it declared. A consumer that installs its own `getRawApp().onError(...)` replaces the seam.
8
+
9
+
Also fixed alongside it: `afterResponse` observers — and therefore `http_requests_total{status}` — reported a hard-coded `500` for any request that ended in a throw, which stops being the status actually sent once a declared envelope is rendered.
0 commit comments