Commit fc71b84
* fix(service-package): classify a publish driver fault as 5xx and stop returning driver text (#8131)
`POST /api/v1/packages/publish` answered `400 PACKAGE_PUBLISH_FAILED` with the
raw driver message whenever the `INSERT INTO sys_packages` statement failed.
Reproduced on a real SQLite engine before changing anything:
400 {"code":"PACKAGE_PUBLISH_FAILED","message":"no such table: sys_packages"}
400 {"code":"PACKAGE_PUBLISH_FAILED",
"message":"NOT NULL constraint failed: sys_packages.tenant_ref"}
Two independent defects: a server fault labelled a client error, and a driver
dump handed back as caller-visible data.
Fixed at the producer. `publish` no longer returns `(error as Error).message`;
it returns a discriminated `driverFault` carrying a stable, non-interpolated
sentence, and re-throws a refusal that declares its own status so the door's
existing mapping answers it with that status and code. The door maps a
returned driver fault to 500.
The producer half is load-bearing, and measured to be: the 5xx withhold lives
in `sendThrownError`, which a RETURNED failure never reaches at any status, and
`looksLikeInternalErrorLeak('no such table: sys_packages')` is false — so
reclassifying alone would have left the driver line on the wire.
The discriminant is the STATUS channel only. Accepting a string `code` as a
declaration was tried and reverted: every SQL driver populates it
(ERR_SQLITE_ERROR, 42P01, ER_NO_SUCH_TABLE), so it re-threw genuine driver
faults into a 500 whose message the heuristic does not withhold.
Caller-facing 4xx is untouched, per the card's binding scope guard.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ARidKDYSCD56LaygrvDPnk
* docs(changeset): state the ADR-0087 disposition without a ledger-style FROM/TO block (#8131)
The ledger's subject is metadata; this change touches a runtime TS interface
only. The consumer guidance stays — it is now prose plus the compiler error,
which is the channel that actually reaches a caller of this service.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ARidKDYSCD56LaygrvDPnk
* test(rest): invert the leak-predicate pins that #8132 turned red, and re-prove the fix without them (#8131)
CI went red on three cases in this PR's own new suite, all reading
`expected true to be false`. Cause: #8132 (f598aa8) landed on main after this
branch point and taught `looksLikeInternalErrorLeak` the bare-SQLite and
Postgres phrasings, so `no such table: sys_packages` is now recognised. The
pins asserted it was NOT.
That is the outcome those cases were written to signal, and their own
instruction — and #8136's — was "delete or invert; do not repair to green".
Inverted, not silently flipped: the prose that claimed a gap is rewritten,
because the gap is closed.
What this does NOT change is why the producer fix exists. That argument had
two halves and only the second is retired:
- structural (still true, and now the sole reason): the withhold lives in
`sendThrownError`; a RETURNED failure reaches `sendError`, which consults
no predicate at any status;
- semantic (retired by #8132): the phrasing used to trip nothing.
Re-measured against the WIDENED predicate, main's producer with only the
status corrected to 500 still answers
`500 {"code":"PACKAGE_PUBLISH_FAILED","message":"no such table: sys_packages"}`
— the driver line on the wire while a predicate that recognises it perfectly
is never asked. A new case pins exactly that, so nobody concludes #8132 made
this fix redundant.
Docblocks, the producer comment and the changeset are corrected to match;
no behaviour change.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ARidKDYSCD56LaygrvDPnk
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent a7e94e9 commit fc71b84
6 files changed
Lines changed: 1044 additions & 6 deletions
File tree
- .changeset
- packages
- rest/src
- services/service-package/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 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
240 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
241 | 248 | | |
242 | 249 | | |
243 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
244 | 277 | | |
245 | 278 | | |
246 | 279 | | |
| |||
0 commit comments