Repository navigation
Commit baeb4f0
A write to a read-only federated external object was refused correctly —
`ExternalWriteForbiddenError` names the datasource, its `schemaMode` and both
flags that would be required, and nothing is applied — but reached the client
as a bare 500 INTERNAL_ERROR with no `code`, indistinguishable from a crash.
The `code` was never the missing half: `EXTERNAL_WRITE_FORBIDDEN` is already
registered in the ADR-0112 error-code ledger. The missing half was an HTTP
status, which no exit can invent — so the refusal fell past every structured
branch of `mapDataError` and left through the terminal `UNCLASSIFIED_FAULT`,
which sanitises to 500 and ships no code the producer never declared.
Fixed at the producer, for the whole `EXTERNAL_ERROR_CODES` family at once:
new `EXTERNAL_ERROR_HTTP_STATUS` maps every code to its status, and each error
class carries it as `status`. Every HTTP exit in the repo already resolves
`status` then `statusCode` (`declaredHttpStatus`, `resolveErrorResponse`,
`HttpDispatcher.errorFromThrown`, `dispatcher-plugin.errorResponseBase`,
`endpoint-executor`, `domains/actions`, `plugin-hono-server`), so one table
fixes every door; a branch in `rest-server.ts` would have fixed one.
`rest-server.ts` is untouched.
EXTERNAL_WRITE_FORBIDDEN 403 policy refusal, not malformed input
EXTERNAL_SCHEMA_MODE_VIOLATION 403 same, for DDL
EXTERNAL_SCHEMA_MISMATCH 503 a deployment state, not the caller
`satisfies Record<ExternalErrorCode, number>` makes a future gate that adds a
code without a status a compile error.
Claude-Session: https://claude.ai/code/session_0158ZQo7LiHSxGWpYKuPq1wu
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 591f675 commit baeb4f0
6 files changed
Lines changed: 533 additions & 0 deletions
File tree
- .changeset
- packages
- rest/src
- spec
- api-surface
- export-origins
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
0 commit comments