Repository navigation
feat(refusals)!: one refusal names several declared reasons, each in the person's language - #37395
Conversation
… each translated A throw may carry an ordered reasons list beside a declared code; each listed reason renders in the caller's locale, the entry message closes the answer, and the lines ride details.refusals on every door. Claude-Session: https://claude.ai/code/session_01Utp6CXvMJTCqCs1b69pCH7 Co-authored-by: Claude <noreply@anthropic.com>
…every door; add its changeset Claude-Session: https://claude.ai/code/session_01Utp6CXvMJTCqCs1b69pCH7 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CXvMJTCqCs1b69pCH7 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CXvMJTCqCs1b69pCH7 Co-authored-by: Claude <noreply@anthropic.com>
…he vocabulary scan reads them Claude-Session: https://claude.ai/code/session_01Utp6CXvMJTCqCs1b69pCH7 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check37 anchor(s) derived from 3 changed package(s); no hand-written page names any of them. What this run could not see
Coarse fallback — 183 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 06bfab95577408f393fd302c84088f2a15297368 && git checkout 06bfab95577408f393fd302c84088f2a15297368
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin ecbe854bda8559069fb228eed1a1564000d2f259 4031cd56165cdf19f5ea293bfd6038ee4b42ed09 && git checkout -B drift-repro ecbe854bda8559069fb228eed1a1564000d2f259 && git merge --no-ff 4031cd56165cdf19f5ea293bfd6038ee4b42ed09
node scripts/docs-audit/affected-docs.mjs --json ecbe854bda8559069fb228eed1a1564000d2f259 |
Claude-Session: https://claude.ai/code/session_01Utp6CXvMJTCqCs1b69pCH7 Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head a2558d1 · 2026-11-26T02:42Z The seat runs the at-tier contract review of this head through an isolated sub-agent; L1 is the seat's own. |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract reviewServed-tier: PR #37395, card #36877, ruling 7178348458 (option A). Read: the card body and all seven comments, the PR body, the net diff against ① Derived judgmentsRuling terms, one by one:
Accept-set and public-surface changes the diff implies:
Gates the PR says were not measured locally, read off the head's check-runs:
② Semver level
M1 (must-fix) — The diff narrows what an author can write, and neither the PR body nor the changeset declares it. By AGENTS.md Post-Task Checklist step 3, "a value refused or a requirement tightened is
③ Boundary flags
④ Design judgment
S2 (should-fix) — The save reader marks a reason S1 (should-fix) — Two docblocks in the reviewed files now say the opposite of the code. Otherwise the file holds against the ruling: one predicate (
Implementing files:
S3 (should-fix) — The changeset and the PR's acceptance note say N1 (nit) — N2 (nit) — Analysis gap (c), whether the MCP tool result renders N3 (nit) — The closing line renders with empty holes when the throw gives no top-level Implemented-by: VERDICT: FAIL |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 席位核对Head-sha:
|
…declare the narrowing it brings The save reader now takes a `reasons: [` list only when it is a direct member of the thrown object literal, the one key the run reads; a list nested under `params` is the body's own data, as before (control pins on both save checks). Two docblocks now say what the code does: a reason reaches the wire as the label of a rendered line, and a listed reason is read under every code. The changeset declares the narrowing (`Clause-②: yes (narrowing)`, `Metadata-protocol: narrowed`) with its BREAKING banner, the FROM → TO migration for the three sources now refused, and the ADR-0087 semantic entry it registers. It no longer claims `details.refusals` keeps every sentence: the closing line is only on `userMessage`, which `/data` bounds. Claude-Session: https://claude.ai/code/session_01Utp6CXvMJTCqCs1b69pCH7 Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract reviewServed-tier: Delta review of PR #37395 (card #36877), rework round 1. The earlier record read FAIL at ① Derived judgments
② Semver levelThe declaration is right. What the arm owes, each checked:
③ Boundary flags
④ Design judgment
N4 (nit) — One level down the same class remains: a
N5 (nit) — The note left on #37403 (7181225232) says Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 维护者速读
席位意见:ACCEPT,建议申报收窄。代码确实拒收这三种写法,只写 席位核对Head-sha:
|
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Approval requested (declared narrowing: |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Maintainer ruling recorded · 2026-11-26T05:26Z The fork named in the seat ACCEPT (7181921852) and in the approval request (7181929093) is answered. Who: Bill (os-bill). Where: seat 5's thread, decision card. Words: 「改申报为收窄(narrowed)」, the answer to 「#36877 实现会拒收现有写法,按收窄申报还是维持裁决第5条的「added」?」. The declaration on head |
Requested by Bill · project thread
Fixes #36877
Clause-②: yes (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up #37407
维护者速读
reasons键现在会被读取,三种原来能保存、能运行的写法现在会被拒绝(见下方 Narrowing)。changeset 带 BREAKING 标注、迁移说明和 ADR-0087 登记。What changes
Ruling 7178348458 (option A, 「A 一次抛多条原因逐行翻译」), executed term by term:
scriptaction body may throw{ code, reasons: [{ reason, params? }, …] }beside the existing singlereason/paramsform. One reader,refusalAddressFrom(packages/runtime/src/sandbox/quickjs-runner.ts), reads the address for both run paths: the VM's__errorInfochannel now also carriesreasons(JSON-cloned likeparams) and whether the key was present. Areasonbeside areasonslist, an empty list, or a list that is not{ reason, params? }elements is alistProblem, which is the loud fault.declaredAnswer(hook-refusal-catalogue.ts) checks each listed reason against the entry'sreasons. One undeclared reason makes the whole throw the500fault naming the hook or action, the code and the reason (the existingundeclared…ReasonAtRunsentence). Under a code with noreasons, every listed reason is undeclared. At save,hookRefusalReasonsThrownInalready readreason: 'x'inside an inline list (the regex is unanchored within the throw statement); it now marks such pairslisted: truewhen thereasons: [list is a direct member of the thrown object literal (the one key the run reads, so aparams: { reasons: [ … ] }stays the body's own data), and also reads the assignment forme.reasons = [{ reason: 'x' }]; throw e. Both save checks (HookSchema,ActionSchema) judge a listed pair through one predicate,isUndeclaredThrownReason: a single reason is still read only under a code that declaresreasons, as before; a listed one under every code.paramsthrough the existingownerRefusalMessage.userMessageis the lines joined by\n, then the entry's ownmessageas the last line (holes from the throw's top-levelparams). The rendered lines ride theSandboxErrorasrefusals, and every door answers them asdetails.refusals: [{ reason, message }]: one shape reader,declaredRefusalLines(packages/types/src/thrown-http-error.ts, thecandidatesprecedent), read byresolveThrownHttpError(the/actionsdoor, MCPrun_action, the dispatcher) and bymapDataError'suserMessagerider (the/datadoor). The VM never setsrefusals: only the catalogue does, so a body cannot hand the wire a list it did not render.refusalAddressFromand builds the same error shape (code,status,userMessage,refusals), so the two paths answer byte-identically (pinned below).yes/added) rested on "nothing accepted today is refused"; the diff falsifies that premise, so the PR declares the narrowing instead (contract review M1; zone order, on the seat's recommendation, with the fork on Bill's decision card). If Bill keeps term 5's lines, only the declaration lines, the BREAKING banner, the migration and the semantic entry come out.Narrowing (declared)
Three sources that save and run on
mainare refused at this head:throw { code: 'X', reasons: [{ reason: 'y' }] }whereXdeclares noreasons: refused at save atbody.source(mainskips every reason under such a code). A literalyunder a code that declaresreasonswithout it was already refused.e.code = 'X'; e.reasons = [{ reason: 'y' }]; throw ewithyundeclared: refused at save (mainhas no reader for the assignment form).reasonsproperty of its own (empty, not a list of{ reason, params? }, beside areason, or naming an undeclared reason): the run answers the loud500fault wheremainanswered the declared sentence and status.The changeset carries the BREAKING banner, the FROM → TO migration for each (declare the reason under the code's
reasons, remove the key, or rename the body's own property) and the ADR-0087 dispositionregistered refusal-reasons-list-literal-judged, a new semantic entry (packages/spec/src/migrations/entries/semantic/18.refusal-reasons-list-literal-judged.ts, fence amendment 2, comment 7181270799). No mechanical rewrite: whether areasonskey was meant as the list or as the body's own data is the author's call.The surface was widened by the zone before the edit (claim amendment 7179332961) to
packages/types/src/thrown-http-error.tsandpackages/types/src/data-error-classification.ts: each door buildsdetailsfrom a closed set of fields read there, so term (3) could not reach the wire frompackages/runtime/src/sandbox/**alone.Tests
packages/runtime/src/sandbox/hook-refusal-catalogue.test.ts: the body path (en and zh-CN lines, per-line params, closing line,details.refusalson/dataand throughthrownAnswerOf, thee.reasons = […]form); seven fault cases (undeclared listed reason, listed reason under a code with noreasons, both forms, empty, element withoutreason, non-list, listparams), each a500with nouserMessageand nodetails; the parity pin (body vs in-process handler,JSON.stringifyequal onmapDataErrorandthrownAnswerOf, en and zh-CN) plus the same faults in-process; CONTROL: a single reason carries nodetails.refusalson either path.packages/runtime/src/sandbox/action-refusal-catalogue.test.ts: through the real/actionsdoor, translated lines pluserror.details.refusals, andactionsDoorAnswerOf(the MCP reader) agrees; an undeclared listed reason is the fault naming the action.packages/spec/src/data/hook-refusals.test.ts,packages/spec/src/ui/action-refusals.test.ts: the reader's listed pairs (inline and assignment), what it leaves to run time, the predicate, the save refusal for an undeclared listed reason and for one under a code with noreasons, CONTROL: a single reason under such a code still saves, CONTROL: areasonslist nested underparamsis not a thrown list (the reader reads it as an unlisted pair, and it saves under a code with noreasonson both the hook and the action check).packages/types/src/thrown-http-error.test.ts:declaredRefusalLinesshape reading (five no-list cases, copies onlyreason/message) and both door compositions.Package suites and typecheck (local)
pnpm --filter @objectstack/types test: Test Files 41 passed, Tests 939 passed.pnpm --filter @objectstack/runtime test: Test Files 649 passed, Tests 12051 passed, 25 skipped.pnpm --filter @objectstack/spec test: Test Files 895 passed, Tests 28435 passed, 1 todo.typecheckfor@objectstack/types,@objectstack/runtime,@objectstack/spec: exit 0 (lock VERDICT command-exit 0).e8d60127):src/sandbox/of runtime, 46 files / 529 passed, 2 skipped; runtime typecheck exit 0.Ablation (one, on the behaviour this PR adds)
node scripts/ablation-replace.mjsonhook-refusal-catalogue.ts, the listed-reason checkif (!reasons || !Object.prototype.hasOwnProperty.call(reasons, line.reason)) {replaced byif (/* ABLATED_36877 */ false) {(anchor 1 → 0, blob 5f2aba5d → ae48d69f): 3 failed / 50 passed, the three[#36877]undeclared-reason cases on both paths. Restored: blob equals HEAD (5f2aba5d),git diff HEADempty. The runtime tests import the module fromsrc/, so no rebuild was needed.Ablation (rework: the direct-member bound)
On
hook-refusal-codes.ts,if (!direct) continue;replaced byif (/* ABLATED */ false) continue;(anchor 1): 3 failed / 145 passed inhook-refusals.test.ts+action-refusals.test.ts, exactly the three nested-paramscontrols. Restored from a byte copy;git diff HEADempty.Acceptance notes
/datakeeps boundinguserMessageat 500 characters (rest-server 的 4xx 直通把 ≥500 字符的 message 整条换成 "Request failed" —— #5368 刚写好的过滤器拒收措辞,客户端一个字也收不到(实测) #5423).details.refusalsis not bounded, so each listed reason's line stays whole there; the closing line (the code's ownmessage) is only the last line ofuserMessage, so on a list long enough to be cut,/dataloses it. A client renders the lines fromdetails.refusals(the zone passes this to 控制台:一次拒绝带多条原因时,提示框逐行列出全部原因(接 #36877) #37403).reasonskey a body threw beside a declared code used to be ignored (the card's probe table). It is now answered, or is the loud fault when it is not a readable list. That is the declared narrowing above.actionsDoorAnswerOfcarriesdetails.refusals; whether the MCP tool result rendersdetailswas not re-measured (analysis confidence gap (c)).Verification
Derived gate list (
node scripts/pm/dispatch-gates.mjs --commands, 97 commands) run locally:pnpm check:dispatcher-error-vocabulary: red on the first run (arefusalError(code)helper read as an unresolved code stamp); fixed ine8d60127by building the error inline at both sites as before; re-run exit 0.node scripts/check-plugin-teardown-shape.mjs --self-test(exit 3, its pinned positive control needs an unshallowed clone; it grades the script, which this PR does not touch);pnpm check:dual-build-cjs-loads(exit 3, needs the whole workspace built; CI's Build Core runs it).pnpm --filter @objectstack/spec check:generated:api-surface/andexport-origins/were stale (new exports) and are regenerated in this PR; re-check green.Rework (
4031cd56):check-adr-0087-registration --base origin/main✓ ([BREAKING+bang+clause-②-narrowing+metadata-protocol-narrowed] registered refusal-reasons-list-literal-judged (new here));check-changeset-no-major,check-empty-changeset,check:changeset-gate-self-tests,check:commit-card-trailers,check:spec-changes,check:upgrade-guideexit 0;src/migrations201 passed; the two spec refusal suites 148 passed. CI's check-runs are the authority for every family. The(narrowing)arm owes the full dogfood battery on the final head: on4031cd56,pnpm --filter '@objectstack/dogfood^...' buildthen, under the lock,pnpm --filter @objectstack/dogfood test(no shard, no path): Test Files 487 passed, 3 skipped; Tests 4128 passed, 68 skipped; exit 0. CI on4031cd56: 73 runs, success or skipped, none failed.Two-minute check:
pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/sandbox/hook-refusal-catalogue.test.ts -t 36877— expect every[#36877]case green, including the parity pin.Read first:
packages/runtime/src/sandbox/hook-refusal-catalogue.ts(declaredAnswer, the list branch),packages/runtime/src/sandbox/quickjs-runner.ts(refusalAddressFromand the reject handler's newreasonsclone),packages/types/src/thrown-http-error.ts(declaredRefusalLines).Generated by Claude Code