Repository navigation
Description
What
Since #34273 a type: 'script' action can declare a refusals catalogue, and the server answers a refusal in the request's Accept-Language. That works — but one throw answers exactly one declared sentence: one code, at most one reason, one flat params object.
An action that checks a whole selection and refuses all-or-nothing has several things to say at once — one sentence per offending record, each with its own reason and its own values. That answer cannot be expressed through the catalogue, so such an action has to choose between a list in the author's language and a single reason in the person's language.
The resolver is shared with hooks (resolveSandboxedRefusal), so a hook that wants to name several reasons in one refusal meets the same limit. Only the action side was measured.
Where we hit it
HotCRM 6.6.0, crm_expense.submit_for_reimbursement and submit_trip_for_reimbursement (one shared script body). A person selects expenses and submits them; when some cannot go, nothing is submitted and the answer lists why, today as English literals:
Expense Taxi 12 is already on an expense report.
Expense Hotel 7 is already approved.
Travel request TR-00001 is not approved yet. Only an approved travel request can be reported against.
2 selected expenses are not yours, or no longer exist.
Nothing was submitted.
In a zh-CN console the person reads this in English (objectstack-ai/hotcrm#2759). Moving it into refusals is not possible without either dropping the list or leaving it untranslated.
Measured on 18.6.0
Booted stack through @objectstack/verify, POST /api/v1/actions/crm_expense/submit_for_reimbursement, once with accept-language: en and once with zh-CN. Probe catalogue on the action, with zh-CN rows under objects.crm_expense._actions.submit_for_reimbursement.refusals.…:
refusals: {
PROBE_PLAIN: { message: 'Probe plain sentence.' },
PROBE: {
message: 'Probe entry {{ name }} x{{ count }}.',
status: 409,
params: ['name', 'count'],
reasons: {
on_report: { message: 'Expense {{ name }} is already on an expense report ({{ count | number }}).' },
approved: { message: 'Expense {{ name }} is already approved.' },
},
},
},The body throws an Error carrying |
Answer |
|---|---|
{ code: 'PROBE_PLAIN' } |
400, declaredCode: PROBE_PLAIN; Probe plain sentence. / 探针:普通句子。 — works |
{ code: 'PROBE', reason: 'on_report', params: { name: 'Taxi 12', count: 3 } } |
409; Expense Taxi 12 is already on an expense report (3). / 费用 Taxi 12 已在报销单上(3)。 — works |
params.name = ['Taxi 12', 'Hotel 7'] |
the array is rendered as JSON: Expense ["Taxi 12","Hotel 7"] is already on an expense report (2). |
reason: ['on_report', 'approved'] |
ignored — the entry sentence, once |
reasons: [ … ] |
ignored — the entry sentence, once |
refusals: [ { code, reason, params }, … ] |
ignored — the entry sentence with empty holes: Probe entry x. |
params: [ { … }, { … } ] |
ignored — holes empty |
an undeclared reason or code (computed at run), no code with its own userMessage, a plain Error, an AggregateError |
500 INTERNAL_ERROR |
a declared code plus its own userMessage and status |
both ignored; the catalogue sentence and status answer |
In source (@objectstack/runtime readRefusalAddress / declaredAnswer): the address read off the error is reason only when it is a non-empty string and params only when it is a non-array object. The template dialect's formatters (upper lower trim number currency percent date datetime truncate default json) have no list or repeat construct, so "one line per record" cannot be written inside one declared sentence either.
Expected
One refusal can name several declared reasons, each with its own params, and the answer carries each one's sentence in the person's language, in the order thrown. For example a throw carrying, under one declared code, an ordered list of { reason, params } — every reason checked against the catalogue as a single reason is today (refused at save when written literally, a fault at run otherwise), each rendered from its translated sentence, the entry's own message available as the closing line (Nothing was submitted.). How the list is shaped on the wire and in the console is yours to rule; the app only needs each declared sentence to arrive translated.
A list formatter in the template would cover the simplest case (the same sentence over several names) but not this one, where the lines have different reasons.
Workaround
None that keeps the rule that no hook or action composes language itself. Once refusals is declared, text outside the catalogue never reaches the person (the rows above), which is the right contract — and the reason the app cannot bridge this. Pre-rendering the lines into a string param leaves the list in the author's language inside a translated frame; refusing on the first problem alone drops the list the person relies on. HotCRM leaves these sentences in English and waits: objectstack-ai/hotcrm#2759 is blocked by this card.
Activity
objectstack-fleet commentedon Nov 24, 2026
triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE
Triage: lands in
area:ux·domain:server·priority:p2· Feature ·pm:queue· size M.area:i18nis not a North Star area. The p2 grade was set by a person, and it stands.Rationale: this is a new capability, one refusal naming several declared reasons, each translated. That makes it a Feature. Its purpose is that the person reads every reason in their language, so it sits with the i18n experience work in
area:ux. It is the refusal-side twin of #36853, which needs a list-shaped keyed param inservice-messagingfor approval notices. The claiming seat should look at both together. objectstack-ai/hotcrm#2759 is blocked by this card.objectstack-fleet commentedon Nov 25, 2026
repo:objectstack#5 · os-bill · session_01Utp6Ca6EBDpTBZk8v46Jjv
Decision inbox · 2026-11-25T23:33Z · zone o5-U (seat repo:objectstack#5)
refusalsanswer (new throw shape, new wire shape), so the route is a product/contract choice the seat may not take (SKILL.md, escalation: a real split on public contract shape that no existing text settles).service-messaging) as the twin; the ruling should say whether one list shape serves both.pm:queue→needs-user-decision. The options, recommendation and four-axis analysis follow from a decision thread (fable); the maintainer rules on this card.objectstack-fleet commentedon Nov 25, 2026
repo:objectstack#5 · os-bill · session_01Utp6CaacEFVpyQ6C5mcRQs
Decision analysis · 2026-11-25T23:47Z · decision thread for zone o5-U (inbox 7177747783)
维护者速读
Background
Since #34273 (PR #34719) an action may declare a
refusalscatalogue and the server answers a declared code in the caller's locale; since #33214 (PR #33641) an entry may hold several sentences keyed byreason, each withparams. The throw address is onereasonstring and one non-arrayparamsobject (SandboxRefusalAddress), anddeclaredAnswerpicks exactly one sentence. An all-or-nothing selection check has one sentence per offending record with different reasons, so it cannot be expressed. HotCRM 6.6.0crm_expense.submit_for_reimbursementkeeps English literals (hotcrm#2759 blocked on this card). The resolver is shared with hooks (resolveSandboxedRefusal,resolveInProcessHookRefusal), so any ruling reaches both.Governing text
packages/spec/src/data/hook.zod.tsdocblock (ruling 6431311681 letter A): "A hook's refusal catalogue names every refusal its code may throw. The runtime answers a declared code with the declared message in the caller's locale; it refuses a code the catalogue does not declare, loudly." —grep -n "ruling 6431311681" packages/spec/src/data/hook.zod.tspackages/spec/src/data/declared-entry.zod.tsreasonsdescribe: "Further sentences under this same code, keyed by the snake_case reason the hook throws beside the code ({ code, reason }): { message }. The wire code and status stay this entry's. A reason not declared here is refused loudly." —grep -n "Further sentences under this same code" packages/spec/src/data/declared-entry.zod.tserror.codeclosed at every door,declaredCodethe open sibling,userMessagethe sentence for the person;ApiErrorSchema.details: z.unknown()"Additional error context (e.g. field validation errors)" —grep -n "declaredCode\|details:" packages/spec/src/api/contract.zod.tsgrep -n "speaks the customer's language" docs/NORTH-STAR.mdProtocol
The catalogue entry schema (
message,status,reasons,params) does not change and no translation key changes. What widens is what a body may throw (the address) and what the wire answer carries.Metadata-protocol: added(the body's throw shape is authored metadata; nothing accepted today is refused).Premises (each with a re-check)
reasononly as a non-empty string andparamsonly as a non-array object —sed -n 2683,2700p packages/runtime/src/sandbox/quickjs-runner.tsdeclaredAnswerrenders one sentence per throw —sed -n 383,413p packages/runtime/src/sandbox/hook-refusal-catalogue.tssed -n 2270,2282p packages/formula/src/validate.tsuserMessage: stringanddetails: unknown; the console shows a refusal's first sentence with the rest behind "More" —grep -n "userMessage\|details:" packages/spec/src/api/contract.zod.ts; sed -n 10,20p ui/packages/app-shell/src/components/RefusalMessage.tsxNotificationTextRendererresolves a keyed param witht(key, locale)and no params —grep -n "t(key" packages/services/service-messaging/src/notification-text.tsdeclaredAnswerand are pinned byte-identical (PR feat(spec,runtime): hook refusals on handler hooks, with declared reasons and params #33641) —grep -n "declaredAnswer(" packages/runtime/src/sandbox/hook-refusal-catalogue.tsThe question in one sentence
When an action refuses a whole selection for several different reasons, the person reads either one translated sentence or an English list; nothing lets every reason arrive in their language.
Options × real cost × workload
{ code, reasons: [{ reason, params? }, …] }. Each reason is checked against the catalogue exactly as a single reason is today (undeclared literal refused at save; undeclared at run ⇒ 500 fault for the whole throw). Each sentence renders translated;userMessageis the sentences joined by newline, with the entry's ownmessageas the closing line when a list was thrown;details.refusals: [{ reason, message }]carries the list structured. Console renders a multi-lineuserMessageas a list. Hooks get it through the shared resolver.{{ names | list }}) only.Business translation: A = a validation result is a list of findings (as a bulk save returns per-record errors on every mainstream platform); B = a nicer sentence for one kind of problem; C = one problem at a time, more round trips; D = a Chinese UI that speaks English in its most frequent batch action.
Four axes (business stance)
errors[]are modelled elsewhere. A is an array of what already exists (declared reasons + params), under the existingdetailschannel; B invents a second expressive channel inside sentences; C/D leave a hole every batch action falls into.params: { lines: '…English…' }and the English ships silently inside a translated frame. With B/C the AI keeps writingthrow new Error(list). A is the loud option.details). B adds grammar that does not close the case.os-decision-facets
① Long-term fit: A reuses declared reasons/params and the existing
detailschannel; no new concept, one shape widened (list of what exists).② Business pull: HotCRM 6.6.0 expense submit, hotcrm#2759 blocked; every all-or-nothing batch action has the same shape.
③ AI-error-proofing: every line stays catalogue-declared, undeclared ⇒ save refusal / loud 500; the alternative is English inside a translated frame, silently.
④ Startup focus: no new key, no new translation key, no gate; B would add template grammar without closing the card.
Prior rulings read: refusal · refusals · 36853 · multi-reason → 0 hits in coordinator/rulings.md and decisions/待决汇总.md; ADR-0112 amendment (declaredCode/userMessage) read; rulings 6431311681 A and 6879477573 A read in hook.zod.ts; thread: none.
Recommendation: A
Self-check: 只看①选 A;②③④ 是否翻转:否。
Confidence gaps: (a) hotcrm's action source is not in this container; the five lines are taken from the card's probe table on 18.6.0. (b) The console half (list rendering) has no measured precedent; it is a small change to
RefusalMessage. (c) Whether MCP's refusal envelope relaysdetailsis not re-measured here; the dev checks it on claim.Not taken: B does not cover different reasons in one answer; C trades the list the person relies on for round trips; D breaks the one rule that makes translation possible.
Twin #36853
Different layer (notification text,
service-messagingkeyed params), different card (Bug, pm:queue, Blocked-by #36846). It stays its own card. Shared only in principle: both join a list per locale; if the dev of either finds a reusable per-locale list join in@objectstack/speci18n helpers, both use it. Not a requirement of this ruling.Execution after the ruling (A)
domain:server, size L,mode:subagentor thread by the runbook). Dispatch premise: the dev re-runs premises 1–6 first; a failed premise reports a fork.reasons: [{ reason, params? }]beside the existingreason/paramsform; both on one throw ⇒ fault; (b)declaredAnswerchecks every listed reason against the entry; one undeclared ⇒ the whole throw is the loud fault, naming the reason; (c) each sentence renders translated and param-filled as today;userMessage= lines joined by\n, the entry'smessageappended as the last line only when a list was thrown;details.refusals: [{ reason, message }]; (d) the spec literal reader (hookRefusalReasonsThrownInand the action twin) reads reasons inside an array literal too; lint unchanged otherwise; (e) parity pin: sandboxed body and in-process handler answer byte-identical for a list throw (PR feat(spec,runtime): hook refusals on handler hooks, with declared reasons and params #33641 pattern); (f)Clause-②: yes,Metadata-protocol: added,Skills-docs:follow-up forskills/objectstack-data/references/data-hooks.mdandskills/objectstack-ui/rules/actions.md.domain:ui, size S):RefusalMessagerenders a multi-lineuserMessageas a list in the same alert box (first line no longer hides the rest behind "More").objectstack-fleet commentedon Nov 26, 2026
repo:objectstack#5 · os-bill · session_01Utp6CaacEFVpyQ6C5mcRQs
Ruled: 2026-11-26T00:03Z · option A — one throw carries an ordered list of declared reasons, each translated.
reasonsdescribe; ADR-0112 amendment (declaredCode/userMessage/details).{ code, reasons: [{ reason, params? }, …] }beside the existing singlereason/paramsform; both on one throw ⇒ fault. (2) Every listed reason is checked against the entry: an undeclared literal is refused at save, an undeclared reason at run makes the whole throw the loud 500 fault naming it. (3) Each sentence renders translated and param-filled as today;userMessage= the lines joined by\n, the entry's ownmessageappended as the last line only when a list was thrown;details.refusals: [{ reason, message }]carries the list structured. (4) Hooks share it through the one resolver; sandboxed body and in-process handler answer byte-identical (parity pin). (5) Catalogue schema and translation keys unchanged;Clause-②: yes,Metadata-protocol: added,Skills-docs:follow-up owed. (6) Console: a ui follow-up card under this one renders a multi-lineuserMessageas a list in the alert box.needs-user-decision→pm:queuein this write; zone o5-U (seat repo:objectstack#5) claims.objectstack-fleet commentedon Nov 26, 2026
repo:objectstack#5 · os-bill · session_01Utp6Ca6EBDpTBZk8v46Jjv
Claim: PM loop round 1 · zone o5-U (area:ux p1/p2; the maintainer, verbatim, 2026-11-25T23:27Z project thread: 「再开两个专区,接ai ux 的 p1 p2 任务」) · 2026-11-26T00:57Z
Session:
session_01Utp6Ca6EBDpTBZk8v46JjvThread session:
session_01Utp6CXvMJTCqCs1b69pCH7Account:
os-billArea: o5-U
Branch:
claude/project-thread-t35ilqWorktree:
objectstack-issue-36877Domain:
domain:serverSeat:
repo:objectstack#5File surface:
packages/runtime/src/sandbox/**(address reader,hook-refusal-catalogue.tsdeclaredAnswer, the in-process twin), the spec literal readershookRefusalReasonsThrownInand the action twin (packages/spec/src/data/hook.zod.ts,hook-refusal-codes.ts,packages/spec/src/ui/action.zod.ts) with their tests, liveness rows and regenerated spec artifacts, parity pins, root.changeset/. Notui/**(ruling term 6 card), notservice-messaging(#36853), notskills/**, not the catalogue schema. Stop on breach and report.Container & model:
L,mode:thread,model: default — dispatch-gates --tier: "no path-derived mandate"(served claude-opus-5-5 per the thread's first report),effort: highClause-②: yes
Metadata-protocol: added
Responsibility: n/a — not a defect card
Thread-read: 7178348458
Premise: holds as ruled — premises 1–6 of the analysis 7178064820 carry re-check commands; the thread re-runs them before writing, a failed one is a fork (ruling 7178348458)
Serial constraints cleared: no open PR touches
packages/runtime/src/sandbox/**or the named spec readers at claim; twin #36853 stays separate (ruling)Pre-claim lane:
domain:server(packages/runtime) plus the spec literal readers, kept in lane per area-lease 留道; L2 contract review owed (Clause-② yes)Pre-claim deps: none
Prior rulings read: ruling 7178348458 (option A, Bill 2026-11-26T00:01Z); governing text hook.zod.ts docblock (rulings 6431311681 A, 6879477573 A), declared-entry.zod.ts
reasons, ADR-0112 amendmentSkills-docs: follow-up owed — skills/objectstack-data/references/data-hooks.md, skills/objectstack-ui/rules/actions.md (filed by the zone before ACCEPT)
objectstack-fleet commentedon Nov 26, 2026
repo:objectstack#5 · os-bill · session_01Utp6Ca6EBDpTBZk8v46Jjv
Claim amendment · 2026-11-26T00:59Z · zone o5-U · #36877 (claim 7179289156)
File surface widened:
packages/types/src/thrown-http-error.ts(resolveThrownHttpError),packages/types/src/data-error-classification.ts(mapDataError/withDeclaredUserMessage), one shape reader for arefusalslist of{ reason, message }besideuserMessage(thecandidatesprecedent), and their tests.Why: ruling 7178348458 term (3) puts
details.refusalson the wire; each door buildsdetailsfrom a closed set of fields read in@objectstack/types, so the term cannot be met frompackages/runtime/src/sandbox/**alone (card thread reading, premises 1–6 re-run ond558de0a). Same lane (domain:servercoverstypes); no new error code; no spec schema change. No open PR touches either file at this amendment.