Skip to content

Commit 57f72ea

Browse files
committed
refactor(metadata-protocol): guard the row's 4xx quote on a sandbox origin only
The runner's own faults never declare a status, so the isSandboxOwnFault half of the guard could not be reached. Claude-Session: https://claude.ai/code/session_01AHeUBbe6S3JRawcpbLejXD Co-authored-by: Claude <noreply@anthropic.com>
1 parent de0660d commit 57f72ea

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

‎packages/metadata-protocol/src/protocol.ts‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
type AnonymousFlowDoorCandidate,
1313
} from '@objectstack/spec/api';
1414
import { IDataEngine, engineCanRollBack, objectNotFoundError, recordNotFoundError, relationConditionSites } from '@objectstack/core';
15-
import { declaredHttpStatus, declaredUserMessage, isSandboxOrigin, isSandboxOwnFault, resolveTenancyPosture, resolveThrownHttpError, sandboxBusinessMessage } from '@objectstack/types';
15+
import { declaredHttpStatus, declaredUserMessage, isSandboxOrigin, resolveTenancyPosture, resolveThrownHttpError, sandboxBusinessMessage } from '@objectstack/types';
1616
// [#6285] ADR-0105 D1's authority on "does this deployment wall organizations?".
1717
// `resolveMultiOrgEnabled()` is DEMOTED and its own doc comment says answering
1818
// this question with it is a bug (cloud#1020, #5233) — so the posture, and only
@@ -4021,13 +4021,13 @@ function sandboxRefusalSentence(err: unknown): string | undefined {
40214021
* through {@link sandboxRefusalSentence} FIRST, which is
40224022
* `sandboxBusinessMessage` (`@objectstack/types`), the import runner's read.
40234023
*
4024-
* And a sandboxed error's `.message` is never quoted, whatever it declared.
4024+
* And a sandbox origin's `.message` is never quoted, whatever it declared.
40254025
* It is the wrapper, written for the log: a refusal that declared a 4xx used
40264026
* to be quoted from there, wrapper and all, and so did a body that CRASHED
40274027
* with a declared 4xx, which every data door answers `500` with its text
4028-
* withheld. "Sandboxed" is the import runner's test (a sandbox origin or the
4029-
* sandbox's own fault). What stays withheld is what the doors withhold: a
4030-
* crash, the runner's own fault, a refusal that declared a 5xx, and every
4028+
* withheld. (The runner's own faults never declare a status, so the 4xx
4029+
* branch cannot reach them.) What stays withheld is what the doors withhold:
4030+
* a crash, the runner's own fault, a refusal that declared a 5xx, and every
40314031
* non-sandbox error that declared no 4xx.
40324032
*/
40334033
function clientFacingRowFailureText(err: unknown, fallback: string): string {
@@ -4036,8 +4036,7 @@ function clientFacingRowFailureText(err: unknown, fallback: string): string {
40364036
// 500 as the fallback status: an error that declared nothing is a server
40374037
// fault in row form, exactly what `toRowApiError`'s own code limb assumes.
40384038
const { status } = resolveThrownHttpError(err, 500);
4039-
const sandboxed = isSandboxOrigin(err) || isSandboxOwnFault(err);
4040-
if (status >= 400 && status < 500 && !sandboxed) {
4039+
if (status >= 400 && status < 500 && !isSandboxOrigin(err)) {
40414040
const declared = (err as { message?: unknown } | null | undefined)?.message;
40424041
if (typeof declared === 'string' && declared.length > 0) return declared;
40434042
}

0 commit comments

Comments
 (0)