Repository navigation
fix(record-context): a related object's read that fails is a failure, not a refusal - #37550
objectstack-fleet[bot] wants to merge 4 commits into
Conversation
… not a refusal At the reads of a related object get_record_context judges (step 4a's exposure check and served definition, a published definition, the child list query), one helper tells a coded refusal from a failure: a refusal answers as before, a failure fails the call SERVICE_UNAVAILABLE (503) naming the pack and the root only, with the original on cause. The citation verifier reads the same classifier. Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 7 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 3 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 0 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 03d08c1cf2185a12a867e1557c47ee21b6a2e4fc && git checkout 03d08c1cf2185a12a867e1557c47ee21b6a2e4fc
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 411646562566a1e12b4e0fc3de256192e8302719 bd03a37ed869418622699397ed127f0dccdceea6 && git checkout -B drift-repro 411646562566a1e12b4e0fc3de256192e8302719 && git merge --no-ff bd03a37ed869418622699397ed127f0dccdceea6
node scripts/docs-audit/affected-docs.mjs --json 411646562566a1e12b4e0fc3de256192e8302719
|
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head 32aba54 · 2026-11-26T13:12Z |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract reviewServed-tier: PR #37550, card #37463. Read: the card and its six comments (os-dev report 7192952275, amendment 7192997436), the PR body, the net diff (7 files), and the head's check-runs (53 completed: 37 success, 16 skipped, 0 failed). Code outside the diff was read, not run. ① Derived judgments
M1 (must-fix) — at both MCP doors the outage is logged once, at S1 (should-fix) — the S2 (should-fix) — at the child list query, a refusal the door recognises without code-plus-status is now answered as an outage. On N1 (nit) — the changeset says all four reads were refused N2 (nit) — every uncoded throw is ② Semver level
③ Boundary flags
Implemented-by: VERDICT: FAIL |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 席位核对Head-sha:
|
…lt; door refusals at the list read stay A failure at a related object's read now answers INTERNAL_ERROR (500): SERVICE_UNAVAILABLE with a 5xx is a declared capability absence the doors log once per route at warn without the error. At the child list query the executor asks the /data door's own classifier (mapDataError), so a sandboxed hook's plain throw stays 400 HOOK_ABORTED and a status-less PERMISSION_DENIED stays 403; only a door fault fails. Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc Co-authored-by: Claude <noreply@anthropic.com>
…he door's refusals at the list read The doors' fault line prints an error's message and stack, never its cause, so the failure's stack ends with the original. The harness pins an error line per call per door with the outage in it, and the two refusals the /data door answers below 500 at the list read. Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc Co-authored-by: Claude <noreply@anthropic.com>
Fixes #37463
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
get_record_context(packages/services/service-record-context) reads each related object of a pack before it answers. At four of those reads, a throw that was not a refusal (an outage, a bug) was answered asPERMISSION_DENIED403, so the citation verifier (verifyRecordCitations) read it as a refusal and dropped every citation without a report:assertApiExposedfailure that is not an API-exposure refusalSERVICE_UNAVAILABLEservedObjectDefinitionOf(child)throwingSERVICE_UNAVAILABLEpublishedOf, published-definition read throwingSERVICE_UNAVAILABLESERVICE_UNAVAILABLEisCodedRefusal(inrecord-context-tools.ts, not on the package entry) is the ADR-0112 line: a non-empty stringcodeplus a declared 4xx status (.status, then.statusCode). The executor asks it at all four sites through one helper (refusedOrFailed); the verifier now imports the same function in place of its private copy, so the two can not drift.PERMISSION_DENIED403 within the naming bound; a disabled package'sOBJECT_PACKAGE_DISABLED(404, coded) is such a refusal. At the child list query the door's own coded refusal is rethrown as the door wrote it, exactly as onmain(the child already passed step 4a, so it is served to the caller).sentences.tsreadFailed, en and zh-Hans) names the pack and the root only. The original error rides oncausefor the host (the verifier hands it toonError). Measured:mapDataError(the/dataclassifier both MCP doors answer with) answers503 SERVICE_UNAVAILABLEwith the error textInternal server errorwhatevercauseholds — tried with no cause, a plain error, a SQLite and a Postgres unique violation,SQLITE_BUSY, and a coded 403.verify-citations.ts: the docblock paragraph that said the executor turns these failures into a 403 was made false by this change and is rewritten.ADR-0160 (card item 3)
No ADR-0160 sentence fixes 403 for a failed read. The two sentences closest are about refusals only:
D3 "Object level" covers refusals by gates and says nothing on reads that fail. So no ADR text has to change for this PR; whether to add a sentence on failures stays with #37490.
Tests
record-context-tools.test.ts, newdescribe"a read of a related object that fails is a failure, not a refusal": one uncoded-throw case per site (503, the exactreadFailedsentence, none of the outage's names, the original oncause); a refusal control per object-level site (OBJECT_PACKAGE_DISABLED404 staysPERMISSION_DENIED403, unnamed) and for the child query (the door's coded refusal is rethrown unchanged); a driver errno with no status, a coded 5xx, a status with no code, and a thrown string are failures too; the sentence follows the caller's locale. The old case pinning an uncoded served-definition throw as 403 now pins a coded refusal there instead.verify-citations.test.ts: an uncoded throw at the child's served-definition read drops the citation and is reported once throughonError(503, cause is the outage); a coded refusal there drops it and reports nothing; a control that verifies the same citation.packages/runtime/src/mcp-record-context-tools-bridge.test.ts, the real-kernel harness: the related list read ofrc_revisionthrows an uncoded error inengine.find; both doors answer the same bytes,SERVICE_UNAVAILABLE503, with no object name and no outage text in them; the control call reads once the spy is removed.Acceptance notes
servedObjectDefinitionOf(...).catch(() => null)) still treats a throw as "not shown". The refusal is a real one, so a throw there only leaves out the object's name.Verification
Read first, by risk:
record-context-tools.tsrefusedOrFailedand the fourcatchsites that call it.record-context-tools.tsisCodedRefusal, andverify-citations.tsnow importing it.sentences.tsreadFailed.Two-minute check:
pnpm --filter @objectstack/service-record-context exec vitest run --maxWorkers=2 src/__tests__/record-context-tools.test.ts— expect the newdescribeto pass, all of it.Readings at head
32aba54598(this container, shared box):Package suites, ablation, local gates
pnpm --filter @objectstack/service-record-context test+typecheck: Test Files 4 passed (4), Tests 162 passed (162); tsc clean; check:test-typecheck OK. Lock VERDICT command-exit 0.pnpm --filter @objectstack/runtime test(whole suite): Test Files 649 passed (649), Tests 12062 passed, 25 skipped. Lock VERDICT command-exit 0.isCodedRefusalmade to answer "refusal" for every throw, the pre-change reading), viascripts/ablation-replace.mjs(anchor 1 to 0, blob 74d1834cb467 to 496f2990cf29), rebuilt,ablation-dist-preflightmarker present in dist index.js and index.cjs: service suites 16 failed / 122 passed (every new outage case, the new verifier pin and the verifier's existing failure cases); runtime harness 1 failed / 24 passed (the new outage case). Restore leg: blob back to 74d1834cb467 equal to HEAD,git diff HEADempty, tree clean, rebuilt, marker absent from dist: 138/138 and 25/25 pass.dispatch-gates --ranreconciliation: 68 derived, 67 run with exit 0, 1 NOT MEASURED:check:dual-build-cjs-loadsexit 3 PREREQUISITE NOT MET (reads every package's dist; this container built only the runtime closure). CI runs it.Generated by Claude Code