Commit 09fa628
committed
fix(metadata-protocol): deleteMetaItem's catch re-wrap carries the error code (#7426)
`deleteMetaItem` is the only verb in `protocol.ts` that re-wraps a thrown error
instead of rethrowing it — both of its catches build a fresh `Error` carrying the
"failed to delete" context. They carried `status` forward and dropped `code`, so
a `SysMetadataRepository` refusal with a full ADR-0112 envelope reached the caller
as 403 with `code: undefined`, its code surviving only as prose in the message.
The envelope therefore depended on the deployment topology: a project kernel got
`NOT_OVERRIDABLE` from `deleteMetaItem`'s own two-tier block, a control-plane
kernel — which skips that block — got the code-less 403.
Both re-wrap exits now carry `code`, gated on membership in the declared ADR-0112
vocabulary (StandardErrorCode ∪ ERROR_CODE_LEDGER) — verbatim the predicate
`toRowApiError` in the same file already applies to thrown codes. A driver's own
dialect (42P01, SQLITE_CONSTRAINT, ECONNREFUSED) is not in the catalog and stays
out of the envelope, so the wrapper cannot smuggle an unregistered code onto a
field `ApiErrorSchema` declares as a closed union. `status` is untouched at both
sites, and the message text is unchanged.
The new pin walks the whole failure-kind matrix through those catches rather than
the one symptom, and #6960's own pin drops its topology branch: `expectRefused`
now asserts `code` + `status` on every leg instead of falling back to a message
substring on the control-plane one.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TyY4g6DC854MCzyJDRh5FR1 parent 08363a0 commit 09fa628
4 files changed
Lines changed: 694 additions & 14 deletions
File tree
- .changeset
- packages/metadata-protocol/src
| 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 | + | |
0 commit comments