From cb2d4155295c39f609334934f20dab6a27c75b1c Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 10 Aug 2026 17:39:55 +0000 Subject: [PATCH] docs(driver-sql): uncompilableAggregateFunctionError's 501 now survives to the wire (#7407) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The docblock's closing "measured consequence" paragraph recorded that `mapDataError`'s generic status passthrough on the `/data` routes was 4xx-ONLY, so this producer's declared `501` / `NOT_IMPLEMENTED` fell to `UNCLASSIFIED_FAULT`'s `500 INTERNAL_ERROR`. True when written (#5907), and #5582 was the right pointer for it. PR #7402 closed #5582: the passthrough now spans 400-599 (`packages/rest/src/rest-server.ts:846`), and the >=500 arm keeps the status and — via `declaresServerFault` — the producer's `code`. So the paragraph asserted the opposite of shipped behaviour, in the direction that costs the most: a reader measuring a real `501` on the wire had to work out which of the two was stale. Replaced with the post-#7402 reading, keeping the paragraph's purpose (don't rediscover this as a bug) pointed the new way, plus the #5582 / #7402 history so the flip is legible. Records the half that did not change: the 5xx band still drops the PROSE unconditionally, so the body is the generic `Internal server error` and the driver's carefully worded message reaches only in-process callers and the operator log — which is what the paragraph's closing ADR-0112 sentence was already about. Both halves verified against the merged code and pinned end-to-end by `packages/rest/src/rest-5xx-status-passthrough.test.ts` ("an aggregate the backend cannot compile answers 501 NOT_IMPLEMENTED on the wire"). The ADR-0112 class-2 argument and the catalog-choice rationale above it are untouched. Comment-only: no behaviour, no tests, no changeset (`skip-changeset`). Fixes objectstack-ai/objectstack#7407 --- packages/drivers/driver-sql/src/sql-driver.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/drivers/driver-sql/src/sql-driver.ts b/packages/drivers/driver-sql/src/sql-driver.ts index 870201b101..80541dc6ef 100644 --- a/packages/drivers/driver-sql/src/sql-driver.ts +++ b/packages/drivers/driver-sql/src/sql-driver.ts @@ -709,13 +709,16 @@ function undeclaredAggregateFunctionError(func: string): Error { * `UNSUPPORTED_TRANSFORM` belongs to `@objectstack/rest`'s import mapper. * * Measured consequence, recorded so it is not rediscovered as a bug: on the - * `/data` routes `mapDataError`'s generic status passthrough is 4xx-ONLY, so - * this declared 501 does not survive to the wire — it falls to - * `UNCLASSIFIED_FAULT`'s `500 INTERNAL_ERROR`. That is a gap in the REST - * boundary — #5582, which this is the first live producer for — not a reason - * for the driver to misdescribe the fault as the caller's. The driver's job is - * to state the condition truthfully at the throw site (ADR-0112), which is also - * what reaches every in-process caller and the operator log. + * `/data` routes `mapDataError`'s generic status passthrough spans 400-599, so + * this declared 501 DOES survive to the wire as `501` / `NOT_IMPLEMENTED` — + * pinned end-to-end by `rest-5xx-status-passthrough.test.ts`. This paragraph + * read the opposite until #7402 closed #5582: the passthrough was 4xx-ONLY, + * this was its first live producer, and the status fell to + * `UNCLASSIFIED_FAULT`'s `500 INTERNAL_ERROR`. What that band does drop is the + * PROSE — a 5xx body is the generic `Internal server error` — so the driver's + * job at the throw site is unchanged: state the condition truthfully + * (ADR-0112), which is what reaches every in-process caller and the operator + * log. */ function uncompilableAggregateFunctionError(func: string): Error { const err = new Error(