Skip to content

feat(refusals)!: one refusal names several declared reasons, each in the person's language - #37395

Merged
os-zhuang merged 7 commits into
mainfrom
claude/project-thread-t35ilq
Nov 26, 2026
Merged

os-zhuang merged 7 commits into
mainfrom
claude/project-thread-t35ilq

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread

Fixes #36877

Clause-②: yes (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up #37407

维护者速读

  • 用户能看到什么变化:批量操作(如 HotCRM 的「提交报销」)一次拒绝多条记录时,每条原因都按用户的语言逐行显示,最后一行是总结句。
  • 为什么做:拒绝语目录原来一次只能回一句,中文界面下只能给用户看英文清单;HotCRM 的报销提交卡在这里。
  • 出错会怎样:只影响声明了拒绝语目录、并且一次抛出多条原因的钩子和动作;写错的原因会在保存或运行时被明确拒绝,不会把未翻译的英文漏给用户。
  • 破坏性:这是一次收窄。旧版本里被忽略的 reasons 键现在会被读取,三种原来能保存、能运行的写法现在会被拒绝(见下方 Narrowing)。changeset 带 BREAKING 标注、迁移说明和 ADR-0087 登记。
  • 要你做什么:无(入队前的批准由席位安排)。

What changes

Ruling 7178348458 (option A, 「A 一次抛多条原因逐行翻译」), executed term by term:

  • (1) Throw shape. A hook or script action body may throw { code, reasons: [{ reason, params? }, …] } beside the existing single reason/params form. One reader, refusalAddressFrom (packages/runtime/src/sandbox/quickjs-runner.ts), reads the address for both run paths: the VM's __errorInfo channel now also carries reasons (JSON-cloned like params) and whether the key was present. A reason beside a reasons list, an empty list, or a list that is not { reason, params? } elements is a listProblem, which is the loud fault.
  • (2) Every listed reason checked. declaredAnswer (hook-refusal-catalogue.ts) checks each listed reason against the entry's reasons. One undeclared reason makes the whole throw the 500 fault naming the hook or action, the code and the reason (the existing undeclared…ReasonAtRun sentence). Under a code with no reasons, every listed reason is undeclared. At save, hookRefusalReasonsThrownIn already read reason: 'x' inside an inline list (the regex is unanchored within the throw statement); it now marks such pairs listed: true when the reasons: [ list is a direct member of the thrown object literal (the one key the run reads, so a params: { reasons: [ … ] } stays the body's own data), and also reads the assignment form e.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 declares reasons, as before; a listed one under every code.
  • (3) Rendering and wire. Each line is that reason's sentence, translated and filled from its own params through the existing ownerRefusalMessage. userMessage is the lines joined by \n, then the entry's own message as the last line (holes from the throw's top-level params). The rendered lines ride the SandboxError as refusals, and every door answers them as details.refusals: [{ reason, message }]: one shape reader, declaredRefusalLines (packages/types/src/thrown-http-error.ts, the candidates precedent), read by resolveThrownHttpError (the /actions door, MCP run_action, the dispatcher) and by mapDataError's userMessage rider (the /data door). The VM never sets refusals: only the catalogue does, so a body cannot hand the wire a list it did not render.
  • (4) Parity. The in-process hook handler reads its throw through the same refusalAddressFrom and builds the same error shape (code, status, userMessage, refusals), so the two paths answer byte-identically (pinned below).
  • (5) The catalogue entry schema and the translation keys are unchanged. The ruling's two declaration lines (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 main are refused at this head:

  1. A literal throw { code: 'X', reasons: [{ reason: 'y' }] } where X declares no reasons: refused at save at body.source (main skips every reason under such a code). A literal y under a code that declares reasons without it was already refused.
  2. e.code = 'X'; e.reasons = [{ reason: 'y' }]; throw e with y undeclared: refused at save (main has no reader for the assignment form).
  3. A body that throws a declared code with a reasons property of its own (empty, not a list of { reason, params? }, beside a reason, or naming an undeclared reason): the run answers the loud 500 fault where main answered 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 disposition registered 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 a reasons key 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.ts and packages/types/src/data-error-classification.ts: each door builds details from a closed set of fields read there, so term (3) could not reach the wire from packages/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.refusals on /data and through thrownAnswerOf, the e.reasons = […] form); seven fault cases (undeclared listed reason, listed reason under a code with no reasons, both forms, empty, element without reason, non-list, list params), each a 500 with no userMessage and no details; the parity pin (body vs in-process handler, JSON.stringify equal on mapDataError and thrownAnswerOf, en and zh-CN) plus the same faults in-process; CONTROL: a single reason carries no details.refusals on either path.
  • packages/runtime/src/sandbox/action-refusal-catalogue.test.ts: through the real /actions door, translated lines plus error.details.refusals, and actionsDoorAnswerOf (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 no reasons, CONTROL: a single reason under such a code still saves, CONTROL: a reasons list nested under params is not a thrown list (the reader reads it as an unlisted pair, and it saves under a code with no reasons on both the hook and the action check).
  • packages/types/src/thrown-http-error.test.ts: declaredRefusalLines shape reading (five no-list cases, copies only reason/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.
  • typecheck for @objectstack/types, @objectstack/runtime, @objectstack/spec: exit 0 (lock VERDICT command-exit 0).
  • Re-run after the last source commit (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.mjs on hook-refusal-catalogue.ts, the listed-reason check if (!reasons || !Object.prototype.hasOwnProperty.call(reasons, line.reason)) { replaced by if (/* 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 HEAD empty. The runtime tests import the module from src/, so no rebuild was needed.

Ablation (rework: the direct-member bound)

On hook-refusal-codes.ts, if (!direct) continue; replaced by if (/* ABLATED */ false) continue; (anchor 1): 3 failed / 145 passed in hook-refusals.test.ts + action-refusals.test.ts, exactly the three nested-params controls. Restored from a byte copy; git diff HEAD empty.

Acceptance notes

Verification

Derived gate list (node scripts/pm/dispatch-gates.mjs --commands, 97 commands) run locally:

  • 94 exit 0.
  • pnpm check:dispatcher-error-vocabulary: red on the first run (a refusalError(code) helper read as an unresolved code stamp); fixed in e8d60127 by building the error inline at both sites as before; re-run exit 0.
  • NOT MEASURED, prerequisites of this checkout, not of the diff: 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/ and export-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-guide exit 0; src/migrations 201 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: on 4031cd56, pnpm --filter '@objectstack/dogfood^...' build then, 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 on 4031cd56: 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 (refusalAddressFrom and the reject handler's new reasons clone), packages/types/src/thrown-http-error.ts (declaredRefusalLines).


Generated by Claude Code

… 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>
…he vocabulary scan reads them

Claude-Session: https://claude.ai/code/session_01Utp6CXvMJTCqCs1b69pCH7
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation protocol:data protocol:ui tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

37 anchor(s) derived from 3 changed package(s); no hand-written page names any of them. ⚠️ 2 changed file(s) yielded no anchor (packages/spec/api-surface/data.json, packages/spec/export-origins/data.json), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

What this run could not see
  • 2 changed file(s) yielded no anchor (packages/spec/api-surface/data.json, packages/spec/export-origins/data.json) — pages documenting those are invisible to this run
  • 1 anchor(s) matched too much of the corpus to be a work list: snake_case (literal, 54 pages)
  • 8 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 183 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json ecbe854bda8559069fb228eed1a1564000d2f259 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 06bfab95577408f393fd302c84088f2a15297368 — the merge of head 4031cd56165cdf19f5ea293bfd6038ee4b42ed09 into base ecbe854bda8559069fb228eed1a1564000d2f259, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# 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

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: a2558d1890ebe6f8769ae36a1645fb82b25319b1
Local-runs: none
Scope: packages/spec/src/data/hook-refusal-codes.ts, packages/spec/src/data/hook.zod.ts, packages/spec/src/ui/action.zod.ts + packages/runtime/src/sandbox/hook-refusal-catalogue.ts, packages/runtime/src/sandbox/quickjs-runner.ts, packages/types/src/thrown-http-error.ts, packages/types/src/data-error-classification.ts, packages/spec/api-surface/data.json, packages/spec/export-origins/data.json, .changeset/36877-refusal-reasons-list.md
Security-touching: yes
Rule-change-verified: none

PR #37395, card #36877, ruling 7178348458 (option A). Read: the card body and all seven comments, the PR body, the net diff against main (15 files, +847/−55), the check-runs on the head. Nothing was built or run; the save-reader findings below are read from the source of the diff and of main.

① Derived judgments

Ruling terms, one by one:

  • Term 1 (throw shape, both forms ⇒ fault): right. refusalAddressFrom reads reasons only when the key is present, and a reason beside it is listProblem: 'both', which declaredAnswer turns into the fault before anything renders.
  • Term 2 (every listed reason checked; undeclared literal refused at save; undeclared at run ⇒ the 500 fault naming it): right at run. At save it is met, and it is also where the accept set shrinks (M1) and where the reader over-reads (S2).
  • Term 3 (per-line render, userMessage joined by a line break with the entry's sentence last, details.refusals: [{ reason, message }]): right on both doors. One sentence of the changeset overstates it (S3).
  • Term 4 (one resolver, byte-identical on both run paths): right. Both paths go through refusalAddressFrom and declaredAnswer; the pin compares JSON.stringify of mapDataError and of thrownAnswerOf for the default locale and zh-CN.
  • Term 5 (catalogue schema and translation keys unchanged; Clause-②: yes, Metadata-protocol: added): the schema and keys are unchanged, right. The two declaration lines copy the ruling, and the diff does not bear them out (M1).
  • Term 6 (console): out of this PR, carried by 控制台:一次拒绝带多条原因时,提示框逐行列出全部原因(接 #36877) #37403.

Accept-set and public-surface changes the diff implies:

  • Widened, right: a body may throw { code, reasons: [{ reason, params? }] }; the wire gains details.refusals.
  • Public surface added, right: @objectstack/spec data exports isUndeclaredThrownReason, unreadableHookRefusalListAtRun, unreadableActionRefusalListAtRun, HookRefusalThrownReason, RefusalListProblem; the five rows in api-surface/data.json and export-origins/data.json match them. hookRefusalReasonsThrownIn now returns HookRefusalThrownReason[] (an optional listed added; compatible for a reader of code and reason). @objectstack/types adds declaredRefusalLines and DeclaredRefusalLine. @objectstack/runtime adds no package export; SandboxError gains an optional refusals.
  • Narrowed at save, declared wrong: HookSchema and ActionSchema now refuse sources that parse on main (M1).
  • Changed at run, declared wrong: under a declared code, a thrown reasons key that main ignores (the card's probe table: "ignored — the entry sentence, once") is now answered as a list, or is the 500 fault when it is empty, not a list, not { reason, params? } elements, or beside a reason (M1).

Gates the PR says were not measured locally, read off the head's check-runs:

  • check:dual-build-cjs-loads: Build Core success; its step "Every published require entry point actually loads" concluded success.
  • check-plugin-teardown-shape --self-test: Lint · CI, release & engine gates success; its step "Plugin teardown-shape gate" concluded success (the step is continue-on-error, so the step conclusion was read, not the job's alone).
  • All other runs on the head: success or skipped, none failed. Check Changeset, Auto Label, Check PR Size and PR-body guards each appear twice; the newer run of each governs and reads success, except Auto Label and Check PR Size, whose newer runs are skipped.

② Semver level

minor on @objectstack/spec, @objectstack/runtime and @objectstack/types is the right level for either kind (added or narrowed both take at least minor). The level stands. The declaration lines do not:

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 narrowed", and several kinds resolve "narrowed over semantic over added"; by scripts/pm/clause2-line.mjs, yes (narrowing) is "a diff that widens one surface and narrows another". Three inputs that parse on main are refused at this head:

  1. throw { code: 'X', reasons: [{ reason: 'y' }] } where X declares no reasons. On main the save check skips every reason under such a code (if (!reasons || …) continue). The PR's own tests pin the new refusal (action-refusals.test.ts, "refuses a listed reason under a code that declares no reasons").
  2. e.code = 'X'; e.reasons = [{ reason: 'y' }]; throw e with y undeclared. main has no reader for the assignment form.
  3. The over-read in S2.
    At run, a body that carries a reasons key beside a declared code for any purpose of its own gets a 500 where main answers the declared sentence with its declared status.
    The ruling's term 5 took its two lines from the analysis (7178064820, "Protocol"), which rests them on "nothing accepted today is refused". The diff makes that sentence false, and the PR body says so itself ("Nothing that saves today is refused unless …"). The ruling's premise clause sends a failed premise back as a fork; it does not let the seat or this review keep the line. That the refused shapes were never answered as written is an argument for the ADR-0087 disposition, not for leaving the arm off: the arm exists ([finding] An accept-set narrowing owes a **BREAKING** banner in core but not in platform-objects — and the ADR-0087 classifier reads the banner #16421) because an undeclared narrowing passes every gate.
    Two ways to clear it, both outside this review:
  • Declare it: Clause-②: yes (narrowing) and Metadata-protocol: narrowed at a line's lead in the PR body and the changeset. The arm then owes: a BREAKING banner in the changeset; exactly one ADR-0087 disposition marker there (on a declared narrowing the no-migration-prescription category is refused, check-adr-0087-registration: a changeset declaring Metadata-protocol: narrowed can still take not-required (no-migration-prescription), so a narrowing ships with no upgrade-guide entry (#32345 item 2) #32601); the migration note (FROM a literal reasons list naming a reason the code does not declare, TO declaring the reason under the code's reasons or removing the key; and for the run side, renaming a body's own reasons property); the full dogfood battery pinned to the head in the os-dev-report (it reads "n/a" today, and --land refuses the arm without it); and at the queue, an authorized approval plus a PASS record on this head.
  • Or the maintainer rules, on this question in words, that term 5's lines stand although the save and run sides refuse what main accepts.

③ Boundary flags

  • Open question in the os-dev-report (bare yes or yes (narrowing)): answered. It is a narrowing by the letter of step 3; the dev's option A is not open to the seat, because the ruling's line rests on a premise the diff falsifies. Escalate to the maintainer or declare (M1).
  • Metadata-protocol: added against narrowed: narrowed. The run-side change alone would be semantic; the save-side refusals make it narrowed, which outranks both.
  • Wire shape of details.refusals, security: no leak found. Each element is copied to exactly reason and message. reason is a key the catalogue declares (checked with hasOwnProperty, so no prototype name passes); message is a sentence already inside userMessage. The thrown error's own message stays off the wire (pinned: "internal detail" absent). The VM channel cannot set refusals; only declaredAnswer does. A faulted list answers 500 with no userMessage and no details (pinned, seven cases). Two things to know, neither a leak: declaredRefusalLines recognises by shape, so an in-process handler on a hook with no catalogue that throws userMessage plus a refusals list reaches the wire (host code, which can already set userMessage); and details.refusals has no bound on line count or length where /data bounds userMessage at 500 (that bound is documented as not a leak defence, rest-server 的 4xx 直通把 ≥500 字符的 message 整条换成 "Request failed" —— #5368 刚写好的过滤器拒收措辞,客户端一个字也收不到(实测) #5423).
  • en and zh-CN parity pin: adequate. Body path pinned in both locales with exact strings; the two-path pin is JSON-equal in the default locale and zh-CN on both door compositions; the /actions door is pinned in zh-CN with details.refusals, and the MCP reader agrees. The parity case asserts equality, not content, but the body-path cases beside it pin the content.
  • MCP rendering of details (analysis gap c): not measured, and the report names no carrier. N2.
  • SQL push-down: not applicable; the diff adds no query, id materialisation or in-app join.
  • The brief file handed to this review is the unfilled template (placeholders for the PR, the card and the head; tier TIER_DEFAULT). The head, card and tier were taken from the dispatch and the PR's committed tree, which touches published schema, so the served tier is the contract one.

④ Design judgment

packages/spec/src/data/hook-refusal-codes.ts

S2 (should-fix) — The save reader marks a reason listed wherever reasons: [ appears in the throw statement, at any depth (REASONS_LIST_PROPERTY has no depth check; listedSpans takes every match). throw { code: 'X', params: { reasons: [{ reason: 'late' }] } } under a code that declares no reasons is refused at save, yet at run it is not a list throw at all (the address reads the top-level key only) and is answered as on main. The save refuses what the run answers. Read the list only as a direct member of the thrown object literal, and pin the nested case as a control.

S1 (should-fix) — Two docblocks in the reviewed files now say the opposite of the code. hook-refusal-codes.ts, on HOOK_REFUSAL_REASON_PATTERN: "A reason never reaches the wire — the code does"; details.refusals[].reason now carries it. hook.zod.ts, the block above the refusals check: "under a code that declares none, a thrown reason is not read at all, as before"; a listed reason is now read under every code. The inline comment at the check was updated; the block was not.

Otherwise the file holds against the ruling: one predicate (isUndeclaredThrownReason) serves both save checks, a single reason keeps main's reading, and what cannot be read literally is left to the run.

packages/spec/src/data/hook.zod.ts, packages/spec/src/ui/action.zod.ts: the two checks are the same four lines through the one predicate; the refusal sentence lists none under a code with no reasons. Right, subject to M1 and S1.

Implementing files:

  • hook-refusal-catalogue.ts, quickjs-runner.ts: agree with terms 1 to 4. The list is all-or-nothing; no line renders before every reason is checked.
  • thrown-http-error.ts, data-error-classification.ts: one reader for both doors; details is merged, not replaced.

S3 (should-fix) — The changeset and the PR's acceptance note say details.refusals "keeps every sentence whole" and that a long list "loses nothing". The closing sentence (the entry's own message) is not in details.refusals; it lives only as the last line of userMessage, which /data cuts at 500 characters, so on a hook refusal with a long list the closing line is the first thing lost and is nowhere else on the wire. The shape is the ruling's and stays; correct the sentence, and tell #37403 that the console must take the lines from details.refusals and cannot rely on the closing line on /data.

N1 (nit) — declared-entry.zod.ts's reasons describe still teaches only { code, reason }. Term 5 keeps the schema file unchanged, so the list form is taught nowhere an author reads until #37407 lands.

N2 (nit) — Analysis gap (c), whether the MCP tool result renders details, has no carrier; file one or name it under #37403.

N3 (nit) — The closing line renders with empty holes when the throw gives no top-level params (pinned as Nothing was submitted ( selected).). It is today's behaviour for a single sentence; #37407 should teach it.

Implemented-by: claude/project-thread-t35ilq
Reviewed-by: session_01Utp6CYtTDvfPQDzMbZnN5X

VERDICT: FAIL

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

席位核对

Head-sha: a2558d1890
REWORK — L1, seat repo:objectstack#5. Contract record 7181155005 reads FAIL on one must-fix, the declaration lines. Its three should-fix findings are owed in this PR. The implementation meets ruling terms 1–4, and nothing leaks on the wire.

  1. Shape: open draft against main, 15 files (+847/−55), Fixes #36877. l1-face CLEAN.
  2. M1 goes to the maintainer as a fork, per the ruling's premise clause. Ruling term 5 (7178348458) fixes the declaration as Clause-②: yes and Metadata-protocol: added. Its premise was that nothing accepted today is refused, and the diff falsifies that:
    • (b) a literal list under a code that declares no reasons, and the e.reasons = [...] assignment form with an undeclared reason, both parse on main and are refused at save at this head;
    • (a) a reasons key beside a declared code now faults when malformed.
      Under AGENTS.md step 3 that is narrowed. The seat recommends declaring it: Clause-②: yes (narrowing) and Metadata-protocol: narrowed. The arm then owes:
    • a BREAKING banner;
    • exactly one ADR-0087 marker;
    • a FROM → TO note;
    • dogfood_battery on the final head;
    • the human hand-off at the queue.
      The seat has asked the maintainer. The area proceeds on the recommendation, and the work is undone if the maintainer instead keeps term 5's lines.
  3. Owed in this PR regardless of M1:
    • S1: two docblocks now contradict the code. hook-refusal-codes.ts says "A reason never reaches the wire", and hook.zod.ts says a reason under a code with no reasons "is not read at all, as before". Bring both up to date.
    • S2: the save reader takes reasons: [ at any depth of the throw as a list. throw { code, params: { reasons: [...] } } under a code with no reasons is refused at save, yet at run it is not a list throw. Bound the read to the throw object's top level, pinned by a test.
    • S3: the claim that "details.refusals keeps every sentence whole" is false on a long refusal. The closing sentence lives only in userMessage, which /data cuts at 500 characters. Correct the sentence in the changeset and the PR body, and tell 控制台:一次拒绝带多条原因时,提示框逐行列出全部原因(接 #36877) #37403.
      The same reviewer reads the delta.
  4. Accepted deviations: contract nits N1 (the reasons describe teaches only the single form until skills: data hooks and actions teach the multi-reason refusal throw (after #36877) #37407), N2 (MCP rendering of details has no carrier; the area files one) and N3 (empty holes with no top-level params; skills: data hooks and actions teach the multi-reason refusal throw (after #36877) #37407 teaches it).
  5. Out of scope and where it went: Skills-docs is skills: data hooks and actions teach the multi-reason refusal throw (after #36877) #37407. The console half is 控制台:一次拒绝带多条原因时,提示框逐行列出全部原因(接 #36877) #37403.
  6. Landing terms: a same-head at-tier PASS with M1 settled and S1–S3 closed is owed, then ACCEPT. If declared a narrowing, the PR goes to the human hand-off.

…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>
@github-actions github-actions Bot added size/xl and removed size/l labels Nov 26, 2026
@objectstack-fleet objectstack-fleet Bot changed the title feat(refusals): one refusal names several declared reasons, each in the person's language feat(refusals)!: one refusal names several declared reasons, each in the person's language Nov 26, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 4031cd56165cdf19f5ea293bfd6038ee4b42ed09
Local-runs: none
Scope: packages/spec/src/data/hook-refusal-codes.ts, packages/spec/src/data/hook.zod.ts, packages/spec/src/ui/action.zod.ts, packages/spec/src/migrations/entries/semantic/18.refusal-reasons-list-literal-judged.ts + packages/runtime/src/sandbox/hook-refusal-catalogue.ts, packages/runtime/src/sandbox/quickjs-runner.ts, packages/types/src/thrown-http-error.ts, packages/types/src/data-error-classification.ts, packages/spec/api-surface/data.json, packages/spec/export-origins/data.json, .changeset/36877-refusal-reasons-list.md
Security-touching: yes
Rule-change-verified: none

Delta review of PR #37395 (card #36877), rework round 1. The earlier record read FAIL at a2558d18. Read this round: the delta between that head and this one (7 files, +133/−20), the PR body, the card comments since the first report (fence amendment 7181270799, report 7181853836), the note on #37403 (7181225232), card #37416, and the check-runs on this head. Nothing was built or run; the reader findings are read from the source.

① Derived judgments

② Semver level

The declaration is right. Clause-②: yes (narrowing) and Metadata-protocol: narrowed lead a line in both the PR body and the changeset; the PR title and the changeset title carry !; minor on the three packages is the level a narrowed kind takes.

What the arm owes, each checked:

  • BREAKING banner: present in the changeset, naming the widening and the narrowing apart.
  • ADR-0087 disposition: exactly one marker, registered refusal-reasons-list-literal-judged, backed by the new semantic entry. registered is a category a declared narrowing may hold (check-adr-0087-registration: a changeset declaring Metadata-protocol: narrowed can still take not-required (no-migration-prescription), so a narrowing ships with no upgrade-guide entry (#32345 item 2) #32601). The entry's surface, replacement, reason and acceptanceCriteria describe the three shapes as the code refuses them, and say there is no mechanical rewrite, which is true: the reader cannot tell a list from a body's own property. The file was fenced in before the edit (amendment 7181270799).
  • Migration note: a FROM → TO table of the three shapes with where each is refused, plus the one-line fix. Complete against the code: the two save refusals, and the run fault for an empty list, a non-list, a list beside a reason, or an undeclared listed reason.
  • Dogfood battery: report 7181853836 pins the full battery to this head (487 files passed, exit 0, no shard, no path).
  • Skills-docs: follow-up #37407: present.

③ Boundary flags

  • The maintainer has not answered the fork (declare the narrowing, or keep ruling term 5's yes / added). This record judges the declaration as written on this head, and it is the correct reading of the diff. It does not choose for him. If he keeps term 5 and the lines come out, that is a new head and this record does not cover it.
  • Tier: yes, this now lands like Tier H. Metadata-protocol: narrowed and the (narrowing) arm are each a declared narrowing to the queue guard's fifth leg (governance: the guard scripts join the governed register, .claude/** lands by declared rule-change, and a narrowed spec change lands only by the maintainer #35321), which refuses the PR until both halves are on record: an authorized APPROVED review (or the maintainer's own enqueue) and a PASS record on the current head. The approval is also where the maintainer answers the fork; whoever approves should know the declaration departs from term 5's literal lines.
  • Report open_questions: empty this round. The earlier one is answered by the declaration and escalated by the decision card.
  • Security: nothing new. The delta changes a save reader, docblocks, the changeset and a migration entry; the wire shape judged in the first record is untouched.
  • SQL push-down: not applicable; no query in the delta.

④ Design judgment

packages/spec/src/data/hook-refusal-codes.ts: the direct-member bound holds against the run-time address, which reads the top-level reasons key only. Right.

N4 (nit) — One level down the same class remains: a reason: 'x' literal anywhere inside a listed element counts as listed, so reasons: [{ reason: 'a', params: { reason: 'free_text' } }] judges free_text as a listed reason, while the run treats it as a param. It needs a param literally named reason holding a snake_case literal, and main already reads params: { reason: 'x' } the same way beside a single reason, so it is the reader's standing limit and not new ground. Worth one line in #37407.

packages/spec/src/data/hook.zod.ts, packages/spec/src/ui/action.zod.ts: unchanged in behaviour this round; the docblock now agrees with the check.

packages/spec/src/migrations/entries/semantic/18.refusal-reasons-list-literal-judged.ts: agrees with the code and with the changeset's table. The 18. prefix follows the entries beside it; the fence amendment already notes it must follow main if #37314 moves the protocol version first.

packages/types/src/data-error-classification.ts: docblock only; now accurate.

N5 (nit) — The note left on #37403 (7181225232) says details.refusals "carries every line whole" and "the entry's closing line still renders last". The closing line is not on details.refusals, so on a cut /data answer the console has nothing to render last. The PR body and changeset say this correctly; the note on #37403 should say it the same way.

Implemented-by: claude/project-thread-t35ilq
Reviewed-by: session_01Utp6CYtTDvfPQDzMbZnN5X

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

维护者速读

  • 改了什么:一条 hook/动作的拒绝(refusal)现在可以列出多个已声明的原因(reasons: [...]),每条按用户语言渲染成一行,放在 details.refusals 里。
  • 为什么:卡 refusals: one throw answers one declared sentence — an action that refuses a selection for several reasons at once cannot list them in the person's language (after #34273) #36877。以前一次拒绝只能报一个原因,多条件同时不满足时用户只看到第一条。
  • 风险:属于收窄。三种以前能保存的写法(空列表、非列表、列表与单个 reason 并存或列了未声明的原因)现在保存或运行时报错,已有 BREAKING 横幅、ADR-0087 标记和迁移表;dogfood 全量在现 head 通过(487 个文件)。注意:裁决第 5 条原文写的是 yes / added,本 PR 改为申报收窄,这个分叉你还没在决策卡上回答。
  • 要你做什么:若同意申报收窄,批准即同时回答了决策卡。若要保留第 5 条,告诉席位,专区只撤回申报行、横幅、迁移和条目文件,复核要在新 head 重做。契约复核 PASS 在评论 7181908508,Head-sha 4031cd56165cdf19f5ea293bfd6038ee4b42ed09。

席位意见:ACCEPT,建议申报收窄。代码确实拒收这三种写法,只写 added 会掩盖破坏性变更;收窄仪式齐全,复核找不到误拒。

席位核对

Head-sha: 4031cd56165cdf19f5ea293bfd6038ee4b42ed09
ACCEPT — L1, seat repo:objectstack#5

  1. Shape: open draft against main, 16 files (+965/−60), ! title, Clause-②: yes (narrowing), Metadata-protocol: narrowed. The rework since a2558d18 is 7 files (+133/−20). l1-face flags only dogfood, which is met: card comment 7181853836 records the full battery on this head (487 files passed, exit 0).
  2. Rework closed (delta contract record 7181908508): M1 (the narrowing is declared, with banner, one registered refusal-reasons-list-literal-judged marker backed by its semantic entry under fence amendment 7181270799, and a FROM → TO table of the three shapes), S1 (both docblocks match the code), S2 (reasons: [ is read only as a direct member of the thrown object; three nested-params controls, ablation-checked), S3 (closing-line sentence corrected; 控制台:一次拒绝带多条原因时,提示框逐行列出全部原因(接 #36877) #37403 told in 7181225232), N2 (carrier MCP:一次拒绝带多条原因时,把 details.refusals 逐条转给智能体(接 #36877) #37416).
  3. Gates: check-runs at 4031cd5616: 62 success, 15 expected skip, 0 failed. Dogfood Regression Gate and Governed Surface Queue Guard read success.
  4. Accepted deviations: contract nits N1, N3 and N4 (the reader's standing limit on a reason nested inside a listed element's params) all carried by skills: data hooks and actions teach the multi-reason refusal throw (after #36877) #37407. N5: the note on 控制台:一次拒绝带多条原因时,提示框逐行列出全部原因(接 #36877) #37403 still says the closing line renders on details.refusals; the area corrects that note to match the PR body (comment only, not a code change).
  5. Out of scope and where it went: skills docs to skills: data hooks and actions teach the multi-reason refusal throw (after #36877) #37407; the N2 item to MCP:一次拒绝带多条原因时,把 details.refusals 逐条转给智能体(接 #36877) #37416.
  6. Landing terms: Tier H by the declared-narrowing leg. L2 at CONTRACT_REVIEW_TIER: PASS, comment 7181908508, same head, no must-fix, no should-fix. Security-touching: yes. Waits for the approver, and the approval answers the open fork on ruling term 5 (decision card in the seat thread). If term 5 is kept, the reverted head needs a new record. After approval the seat lands it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Approval requested (declared narrowing: Clause-②: yes (narrowing), Metadata-protocol: narrowed; this departs from ruling term 5's literal added, so the approval also answers that fork). Seat ACCEPT: comment 7181921852. Contract review PASS at CONTRACT_REVIEW_TIER: comment 7181908508, Head-sha 4031cd56165cdf19f5ea293bfd6038ee4b42ed09. dogfood_battery at this head: card comment 7181853836. After approval the seat lands it.

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 26, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 26, 2026 03:41
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit 51b67f1 Nov 26, 2026
87 of 88 checks passed
@os-zhuang
os-zhuang deleted the claude/project-thread-t35ilq branch November 26, 2026 04:45
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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 4031cd56165cdf19f5ea293bfd6038ee4b42ed09 (Clause-②: yes (narrowing), Metadata-protocol: narrowed) stands, and nothing reverts. The contract review PASS (7181908508) and the ACCEPT stay current. The PR still waits for the approver's APPROVED review (Tier H, declared narrowing); after approval the seat lands it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue protocol:data protocol:ui security size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

3 participants