Skip to content

feat(rest): the cross-object batch refusal names the failing operation, and a multi-pick related-list add names that record - #35811

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-35726-batch-op-index
Nov 20, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-35726-batch-op-index

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Fixes #35726
Part of #35601

Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:在记录页的相关子表里一次挑选多条添加、其中一条被拒绝时,红色提示会先写出那一条的名称,再写原因;全部成功时界面与之前完全一样。
  • 为什么做:属于「记录页」改进专题,补完「一次添加多条要么全成要么全不成,失败时说清是哪一条」这项要求,之前只转述服务器原话,校验类错误说不出是哪一条。
  • 出错会怎样:只在失败的回复里多带一个「第几条、哪个对象」的信息,成功回复和全成全不成的行为不变;最坏情况是提示里不显示名称,可直接撤回。
  • 要你做什么:无。

What changes

Server (@objectstack/rest, batch-routes.ts). A refusal of the cross-object POST {basePath}/batch now carries failedOperation: { index, object } beside error / code / userMessage when ONE op is the cause:

  • an update / delete op refused up front for naming no row (400 VALIDATION_FAILED, the requires an id refusal);
  • an op that throws while the transaction runs: the engine's refusal of that op (404 RECORD_NOT_FOUND, 400 VALIDATION_FAILED from a validation rule or a required field, 409 RESOURCE_CONFLICT), an unresolved $ref (400 BATCH_UNRESOLVED_REF), or a fault.

It is absent on a refusal of the request as a whole (schema VALIDATION_FAILED, BATCH_NOT_ATOMIC, BATCH_TOO_LARGE, the 501 NOT_IMPLEMENTED no-transaction answers), on the two object-level gates (API exposure and the API-key management rule, judged once per object and action, so no single op is the cause), and on a failure after the last op ran (the commit). The in-transaction case goes through the shared error door unchanged (handleRouteError): a thin response wrapper adds the one key to the body the door wrote, so status, code, sentence and details.candidates are the door's.

Unchanged: the success body, the all-or-none outcome (ADR-0119 D4, ADR-0035 section 5), the #14147 option C create routing and the A-prime update-response comment blocks (no line in either was edited), every other route.

Spec. No spec edit. The cross-object batch's refusal envelope is not declared in packages/spec: CrossObjectBatchResponseSchema declares the success body only, the error-code ledger declares codes, not body keys, and the route ledger row named /batch (DEFAULT_BATCH_ROUTES) is the per-object /data/:object/batch door. Declaring a new refusal schema would be a new export, which this card did not rule on (see Acceptance notes).

Client pass-through. No client edit. @objectstack/client already hands a flat refusal body with no details of its own over as err.details, and ObjectStackAdapter.batchTransaction rethrows that error as it is, so the key reaches the console as err.details.failedOperation.

Console (@object-ui/plugin-detail, RelatedList.tsx handleAddRecords only). The add keeps the picked record behind each op, index-aligned with the ops it sends (a pick with no value is skipped, so pick index and op index can differ). On a refusal whose failedOperation.index falls inside the ops sent, the inline error reads LABEL: REASON, where LABEL is the record's value in the picker's display field (add.picker.labelField, else name, as the picker shows it; the picked id when that is empty) and REASON is today's message. Without such an index the inline error is the server's reason alone, as before.

Why

PR #35725 made a multi-pick related-list add one atomic batch: all rows or none. Its refusal then repeated the server's sentence, which names the record for a not-found or permission refusal but only the field for a validation refusal, so a reader of a three-pick add could not tell which pick failed.

Tests

  • packages/rest/src/cross-object-batch-failed-operation.test.ts (new, real ObjectQL + SQLite SqlDriver + real protocol + real route): 3 ops whose 2nd addresses no row answers 404 RECORD_NOT_FOUND with failedOperation: { index: 1, object: 'fop_beta' } and both tables empty; 3 ops whose 2nd misses a required field answers 400 VALIDATION_FAILED with index 1 and both tables empty. CONTROLS: a committing 3-op batch has no failedOperation; atomic: false (BATCH_NOT_ATOMIC) names no op. The route has no non-atomic run to pin: atomic: false is refused before any op runs.
  • packages/rest/src/rest-batch-blank-id.test.ts: the exact-body pins of the missing-id refusal now carry failedOperation, index 0 for a one-op batch and index 1 for the create-then-blank-update batch.
  • packages/rest/src/rest-batch-endpoint.test.ts: the package-scoped 409 exact-body pins carry failedOperation: { index: 0, object: 'account' } beside details.candidates.
  • ui/packages/plugin-detail/src/__tests__/RelatedList.enlargedToolbar-27524.test.tsx: a 3-pick add whose refusal names op 1 shows Bravo: Field 'title' is required (not Alpha, not Charlie), sends one batch and does not re-read the list. CONTROLS: no failedOperation, and an index outside the ops sent, each show the server message alone.

Every reading below was taken in this worktree on objectstack-ai/objectstack, branch base 1e018d6ed.

rest: targeted batch files, full package suite, typecheck
  • pnpm --filter @objectstack/rest exec vitest run --maxWorkers=2 over the six cross-object batch files (new file, blank-id, no-rollback driver, exposure, API-key credential, request refusal fields): Test Files 6 passed (6), Tests 49 passed (49), lock VERDICT command-exit 0.
  • Full vitest run --project local --maxWorkers=2 at c6fe2c39 (before the package-scoped pins were updated): Test Files 1 failed | 422 passed (423), Tests 9 failed | 8623 passed | 351 skipped; the 9 were exactly the package-scoped exact-body pins in rest-batch-endpoint.test.ts, which this PR updates. After the update: rest-batch-endpoint + new file + blank-id Test Files 3 passed (3), Tests 56 passed (56).
  • Full suite on the final head: at d6b03538, vitest run --project local --maxWorkers=2: Test Files 423 passed (423), Tests 8632 passed | 351 skipped (8983), lock VERDICT command-exit 0.
  • pnpm --filter @objectstack/rest typecheck (tsc + check:test-typecheck): VERDICT command-exit 0, 0 file(s) / 0 error(s) in the test-typecheck debt.
plugin-detail: target file, full package, type-check
  • pnpm --dir ui exec vitest run --maxWorkers=1 packages/plugin-detail/src/__tests__/RelatedList.enlargedToolbar-27524.test.tsx: Test Files 1 passed (1), Tests 16 passed (16) (13 before, 3 new).
  • pnpm --dir ui exec vitest run --maxWorkers=1 packages/plugin-detail/: Test Files 391 passed | 1 skipped (392), Tests 3568 passed | 18 skipped (3586), lock VERDICT command-exit 0.
  • pnpm --filter @object-ui/plugin-detail type-check (after building its dependency closure): VERDICT command-exit 0.
Ablations (scripts/ablation-replace.mjs, one per pin, each restored)

Both subjects resolve from source (the rest test imports ./rest-server, the UI test imports ../RelatedList), so no dist/ leg applies.

  • Server: anchor failedOperation = { index, object: op.object }; replaced with a comment, anchor 1 -> 0, blob f321bb114e1e -> c9a261104266. Run: Tests 2 failed | 2 passed (4), the two index-1 cases red, both controls green. Restore: blob == HEAD (f321bb114e1e) and git diff HEAD is empty.
  • UI: anchor const failedIndex = err?.details?.failedOperation?.index; replaced with const failedIndex: unknown = undefined;, blob acdaba8815ce -> 11bd61acb2ea. Run: Tests 1 failed | 15 passed (16), the naming case red, both controls green. Restore: blob == HEAD (acdaba8815ce) and git diff HEAD is empty.
Gates (dispatch-gates --commands, narrowed by this diff)
  • 72 derived families; 70 exit 0; 2 exit 3 PREREQUISITE NOT MET, read as NOT MEASURED: node scripts/check-plugin-teardown-shape.mjs --self-test (the shallow clone cannot reach its pinned positive-control commit) and pnpm check:dual-build-cjs-loads (reads built output of every package; this worktree built only the two closures). CI runs both.
  • pnpm check:route-envelope exit 0 (the batch module's dialect counts did not move), pnpm check:doc-authoring exit 0, pnpm check:type-check-debt exit 0, pnpm --dir ui exec vitest run scripts/ Tests 5092 passed | 2 skipped.
  • dispatch-gates --ran reconciliation: 72 derived, 70 run, 2 NOT-MEASURED, 0 UNRUN (the 2 derived from a recorded exit 3).
  • node scripts/check-platform-checklist.mjs --changed-from origin/main: OK, 0 anchors lost. check-nul-bytes exit 0.

Acceptance notes

  • The object-level refusals (API exposure 405 / 403 OBJECT_API_DISABLED, the API-key management 403) carry no failedOperation. They are judged once per object and action, so naming the first op would make the related-list add name one picked record for a refusal that holds for every pick; and batch-op-exposure-object-read.test.ts pins the exposure body equal to the bulk data door's.
  • A refusal that carries its own details (the package-scoped 409 with details.candidates) keeps failedOperation on the body, but @objectstack/client exposes only that details as err.details, so the console shows the reason alone there. Reaching it would take a client-side read of the raw body, which the client does not keep; not done here.
  • The refusal envelope of this route is undeclared in packages/spec (see What changes). Declaring a CrossObjectBatchErrorSchema would be a new public export and a contract decision, so it is reported, not done.
  • ObjectStackAdapter.batchTransaction on a backend that does NOT declare capabilities.transactionalBatch treats a 404 as "no batch endpoint" and falls back to the non-atomic emulation, so on such a backend a 404 RECORD_NOT_FOUND refusal is read as a missing endpoint and the ops are replayed through that emulation, which carries no failedOperation. Documented legacy behaviour for pre-capability backends; not changed.
  • origin/main was not merged before opening: it moved 187 files past the base, none of them a file this diff touches (batch-routes.ts, the three rest test files, RelatedList.tsx, its test). The PR CI runs on the merge ref.

Verification

Read first, by risk:

  1. packages/rest/src/batch-routes.ts: namingFailedOperation and the two failedOperation assignments in runOps (set per op, cleared after the loop).
  2. ui/packages/plugin-detail/src/RelatedList.tsx: handleAddRecords, the opPicks alignment and the catch block.
  3. packages/rest/src/cross-object-batch-failed-operation.test.ts.

Two-minute check: pnpm --filter @objectstack/rest exec vitest run src/cross-object-batch-failed-operation.test.ts prints Tests 4 passed (4).

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes. (No formatter ran; pnpm lint is CI's run.)
  • 4. One issue, one branch off an up-to-date main, one pull request. (Branched off main at 1e018d6ed; not re-merged before opening, see Acceptance notes.)
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (Not touched.)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

Generated by Claude Code

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

3 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • 1 anchor(s) matched too much of the corpus to be a work list: VALIDATION_FAILED (literal, 50 pages)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 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; 123 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 — 19 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 7878cf0557737ecfde78dfa9cff7a1046a289a4a → packageMentionDocs.

Which tree this was computed on

This run read content/docs from d9e6d20f4a8e07a7f6fa9b4ab0f52c41151bc992 — the merge of head d6b03538fc4843e560c83ded2038f5c9fd938bc2 into base 7878cf0557737ecfde78dfa9cff7a1046a289a4a, 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 d9e6d20f4a8e07a7f6fa9b4ab0f52c41151bc992 && git checkout d9e6d20f4a8e07a7f6fa9b4ab0f52c41151bc992
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 7878cf0557737ecfde78dfa9cff7a1046a289a4a d6b03538fc4843e560c83ded2038f5c9fd938bc2 && git checkout -B drift-repro 7878cf0557737ecfde78dfa9cff7a1046a289a4a && git merge --no-ff d6b03538fc4843e560c83ded2038f5c9fd938bc2

node scripts/docs-audit/affected-docs.mjs --json 7878cf0557737ecfde78dfa9cff7a1046a289a4a

⚠️ 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_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

  • 相关子表一次选多条添加、其中一条被服务器拒绝时,提示现在会写出是哪一条(用选择框里显示的名称),后面跟服务器给的原因。
  • 服务器的批量接口在拒绝时多带一个字段,说明是第几个操作、哪个对象出的错;成功时的返回不变,仍然全成或全不成。
  • 整批一起被拒的情况(例如对象级的权限或请求本身有问题)不指向某一条,提示保持原样。
  • 这是接口上的一处只增不减的变化,需要席位做一次接口层面的复核后再合并。
  • 席位意见:通过;转席位做接口复核,复核通过后分区转为正式再合并。

席位核对

ACCEPT · head d6b03538fc · Fixes #35726 (under #35601, seat ruling 07:43Z) · K=11 · merge-tree vs origin/main clean · governed: no · +272/−12, 7 files · CI 56 success, 12 skipped; the one failure is PR-body guards run 136196481799 (09:16:48Z), superseded by a success of the same check, 136199328673 (09:22:22Z) · draft · 2026-11-20T09:41Z

Routing: Clause-②: yes (widening) (the REST refusal body gains an optional key) → L2 at CONTRACT_REVIEW_TIER by the seat, then the area lands it.

Checked:

  • Server: failedOperation is set at the top of each op inside runOps and cleared once every op ran, so a commit-time failure names no op; the engine's up-front no-rollback 501 is raised before runOps and names none either. The blank-id refusal names its index directly. Object-level gates (exposure, API-key rule) and request-level refusals carry none, as the JSDoc says. The ⛔ rulings at ~463 (finding: the insert-path readonly strip is a protocol-boundary guard only — engine.insert applies none of it, and create_record's onFieldsDropped channel can never fire for a readonly drop #14147 C) and ~495 (A-prime) are untouched; only the failedOperation = line lands beside the loop head.
  • namingFailedOperation: wraps only status() and json() and adds the key to an object body; handleRouteError calls exactly res.status(s).json(body) (error-response.ts), so the status, code and sentence stay the door's. Absent an op, it returns res itself.
  • No disclosure: index and object are the caller's own request's; the refusal sentence is unchanged, so a not-found or permission refusal reveals nothing it did not before.
  • Client: the console adapter rethrows the SDK error as is on a declared atomic backend, so err.details.failedOperation reaches handleAddRecords. opPicks is pushed only beside an op (after the pickedId == null skip), so the indices line up; the label is the picker's display field, else the id; no index → the reason alone, as before.
  • Surface: all 7 files inside claim 7035582958. The spec declares only the batch SUCCESS body (CrossObjectBatchResponseSchema); no refusal envelope is declared anywhere, so the claim's "if one exists" leaves nothing to edit.

For the L2 (ux-2's two questions):

  • (1) Declare the refusal envelope in packages/spec: I agree with A, no. No other refusal detail on this route is declared, and declaring one key alone would make a partial contract.
  • (2) The 409 package-scoped path: I agree with A, accept. It refuses the batch as a whole and has no per-op cause. Note that if a 409 is raised from inside an op, the wrapper will still add the index, which is correct.

Required before landing:

  • R1. L2 by the seat, then mark the PR ready.

No other item.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ

Seat contract note — PASS · head d6b03538fc4843e560c83ded2038f5c9fd938bc2 · 2026-11-20T09:43Z

  • Face: reviewFace finds no contract face on this file list (no packages/spec), so no isolated L2 record is owed. The seat read the Clause-②: yes (widening) itself because the REST refusal body gains a key.
  • The widening: failedOperation: { index, object } is added to a refused cross-object batch's body only when one op is the cause. index and object echo the caller's own request, so they disclose nothing the caller did not send. The success body and the all-or-none outcome are unchanged (ADR-0119 D4). The changeset says when the key is present and when it is absent, and that matches the code: it is set per op inside the transaction, cleared after the last op, and stamped up front on the no-row refusal.
  • Mechanism: namingFailedOperation wraps res only for status().json(), which is the only way handleRouteError writes (error-response.ts), so nothing else on res is shadowed.
  • Rulings: (1) A: the envelope stays undeclared in packages/spec, since no other refusal detail on this route is declared and declaring one key alone would make a partial contract. (2) A: the package-scoped 409 refuses the batch as a whole and names no record.
  • Landing: not governed, under 3,000 lines, K = 11, L1-a ACCEPT 7036225777. The owning area (ux-2) lands it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ

Landing · area ux-2 · 2026-11-20T09:44Z

reading value
L1-a ACCEPT comment 7036225777 at d6b03538fc (= current head)
Seat contract note PASS 7036271782 (Clause-② yes, widening; rulings (1) A envelope stays undeclared in packages/spec, (2) A package-scoped 409 names no record)
CI green at d6b03538fc; the one red PR-body guard run 136196481799 was superseded by success 136199328673 on the same head; K = 11 (< 15)
check-governed-merges --pr 35811 NOT governed; +272 / −12 ≤ 3000

State: draft → ready + auto-merge (merge queue). Fixes #35726; #35601 is closed out by ux-2 after this lands.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 20, 2026 09:44
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit a8126d2 Nov 20, 2026
69 of 70 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35726-batch-op-index branch November 20, 2026 10:09
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…t submitter notice read in the reader's language (objectstack-ai#36846)

<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwB9Gqqp1VYZwEqbXEm1YsTjU)_

Fixes objectstack-ai#36463

Clause-②: yes (widening)
Metadata-protocol: none

repo:objectstack#3 · os-support-ai · session_01WGufziH9MVhWYLVCiw5eXB

## 维护者速读
-
用户能看到什么变化:提交人自己点「批准」被拒时,审批详情页和审批中心弹出的提示改用用户自己的语言(中文用户整句都是中文);没人能审批时发给提交人的通知,即使列了好几个岗位,也整句按收件人的语言显示。
- 为什么做:属于「审批收尾」这一组工作,补上上一轮留下的两处英文残留。
- 出错会怎样:只影响这两句提示的文字,审批是否被拒、拒绝的规则和已保存的审计记录都不变,可以直接撤回。
- 要你做的:无。

## Widened door response (Clause-②)

The approvals routes (`packages/rest/src/approvals-routes.ts`, all nine
that share `handleApprovalError`) now carry a marked `userMessage` at
the top level of their flat `{ code, error }` refusal body on any mapped
row whose thrown error is marked, the same member objectstack-ai#34619 added for
`RESUME_FAILED` on this door and that `ApiErrorSchema` already declares
and `@objectstack/client` already lifts. Producers today: the two
self-approve decide refusals, both on the `403 FORBIDDEN` row
(`excludeSubmitter`, and the override self-approve kept under maintainer
ruling 2026-11-17 option B). The member is absent when no producer
marked one, so every other refusal body is byte-identical. Additive, so
`yes (widening)`, patch, `Metadata-protocol: none` (precedents objectstack-ai#34619,
objectstack-ai#35811; L1 S1 7122520696).

## Census

- **The console reader that shows a decide refusal.** Two places:
- The request page's Approve button is the declared `type: 'api'` action
`approval_approve`. Its failure text is read by `refusalEnvelopeMessage`
in `ui/packages/app-shell/src/utils/flowResponse.ts`, through
`apiActionRefusalResult`. Both callers use it: the `apiHandler` in
`useConsoleActionRuntime` and the one in `RecordDetailView`. Before this
PR it read only `error.userMessage` of the ADR-0112 envelope. The
approvals door answers the flat `{ code, error }` body, so the toast
showed the English `error`.
- The Approval Center's inline Approve: `humanizeError` in
`ui/apps/console/src/pages/system/ApprovalsInboxPage.tsx`, called by
`inlineApprove`. It answered every `FORBIDDEN` with the generic "You are
not allowed to perform this action.", so the remedy was lost.
- **Which channel was reused.** A producer marks `userMessage` on the
thrown error. The plugin already does this in `lockedError`
(`lifecycle-hooks.ts`) and `snapshotQueryRefusal`
(`payload-predicate-guard.ts`). The approvals mapper carries it at the
top level of its flat body, the member its `RESUME_FAILED` stranded
envelope already uses for `userMessage`. `@objectstack/client` lifts
`userMessage` from that member too (`errorBody?.userMessage ??
errorBody?.error?.userMessage`). Where this differs from the dispatch:
the `declaredUserMessage` block around `recognisedRefusal` relays an
engine resume refusal. It is not a producer of approvals' own refusal
text, so it was not the pattern used here.
- **The two refusals.** Both `excludeSubmitter` and the override
self-approve now throw through one local helper, `refuseOwnApproval`. It
keeps the `message` byte for byte (the existing English pins are
unchanged and green) and sets `userMessage` from
`submitterRefusalUserMessage` (`no-approver-note.ts`). That text uses
the decider's `readerLabels(context).sentence`, with the position labels
from the same `notePositionLabels` read. If the decider asked in no
language, or the pack lacks one of the sentences, the whole text is
English and names no user id. It is never half one language and half the
other.
- **The submitter notice.** The messaging layer renders at delivery, per
recipient (`NotificationTextRenderer.render`). It resolves a keyed param
with `t(key, locale)` and no params, so a hole holds one text or one
hole-free key. One list param cannot carry translated clauses, and the
plugin cannot compose a list per reader, because the emit does not know
the recipient's locale. This falsifies the dispatch's
flatten-into-one-param route as stated. The route taken flattens the
list into the **sentence** instead. `approvalNoApproverHoldingSlots2` to
`…Slots8` are derived in every pack from that pack's own
`approvalNoApproverHolding`, `approvalNoApproverSlot` and
`approvalNoApproverSlotSeparator`. Each slot is a keyed `typeN` /
`valueN` pair, the single-slot shape repeated. Nothing is translated
twice, the messaging contract does not move, and the notice reads
exactly what the timeline reads for the same slate (pinned for every
pack and every size 2 to 8).
- **The timeline overlay** (`localizeRoutingNotes`) uses the same
`noApproverWho` composition, through `noApproverNoteText(note,
labels.sentence, …)`. It already renders any number of slots in the
reader's language and is not touched.

## What changes

- `packages/plugins/plugin-approvals/src/translations/messages.ts`:
- five authored sentences, `approvalDecideRefusedSubmitterExcluded`,
`…OverrideOwnRequest`, `…AnotherApprover`, `…OverrideAnotherApprover`
and `…OverrideWithdraw`, in all eleven packs;
- the derived `approvalNoApproverHoldingSlotsN` sentences, built in
`slotListSentences` and added to every shipped locale by
`withSlotLists`;
  - `NO_APPROVER_NOTICE_MAX_SLOTS = 8`.
- `no-approver-note.ts`: `noApproverNotice` spells 2 to 8 slots inline
(shared `slotParams`). It adds `submitterRefusalUserMessage`.
- `approval-service.ts`: the two decide refusals go through
`refuseOwnApproval`. Behaviour is unchanged: both still refuse, with the
same English `message`.
- `packages/rest/src/approvals-routes.ts`: `handleApprovalError` adds
`userMessage` (read once through `declaredUserMessage`) to every mapped
row when the producer marked one. An unmarked refusal gets exactly the
body it had before.
- `ui/packages/app-shell/src/utils/flowResponse.ts`:
`refusalBodyUserMessage` reads the envelope's `error.userMessage`, else
a flat body's top-level `userMessage`. These are the two members the
client lifts, through one predicate.
- `ui/apps/console/src/pages/system/ApprovalsInboxPage.tsx`:
`humanizeError` shows a marked refusal first.
- Changeset `.changeset/36463-no-approver-text-in-reader-language.md`,
patch for `@objectstack/plugin-approvals`, `@objectstack/rest`,
`@object-ui/console` and `@object-ui/app-shell` (private, inert).

Prior rulings that govern the edited lines (check-prior-rulings over the
touched files; quoted as they stand in the tree):
- `[Maintainer ruling 2026-11-17, option B]` on the override refusal:
"The objectstack-ai#3424 override never approves a request its actor submitted,
whatever `excludeSubmitter` says." Kept exactly. Only the language of
its text changes.
- `ApiErrorSchema.userMessage`
(`packages/spec/src/api/contract.zod.ts`), "ruling record 6819749037,
option C: text addressed to the end user comes back in the request's
language, composed where it is produced". The `userMessage` is composed
in the service, in the decider's language, with `en` as the last rung.
- The mapper's `[objectstack-ai#13807, maintainer ruling 2026-09-04 batch objectstack-ai#37]`
stranded envelope and the code-anchored prefix strip ("converged here by
the 2026-08-31 ruling") are not changed. The stranded spread still comes
last.

## First reads (by risk)

1. `packages/plugins/plugin-approvals/src/no-approver-note.ts`:
`submitterRefusalUserMessage` (the all-or-nothing English fallback) and
the multi-slot arm of `noApproverNotice`.
2. `packages/plugins/plugin-approvals/src/translations/messages.ts`:
`slotListSentences`, and the change of `enMessages` into the authored
set plus the derived set.
3. `ui/packages/app-shell/src/utils/flowResponse.ts`:
`refusalBodyUserMessage`. It is shared by every `type: 'api'` action, so
the top-level read is gated by the same `declaredUserMessage` predicate.

## Tests

- `no-approver-note.test.ts`:
  - the two-slot keyed shape;
- zh-CN delivery is entirely Chinese, with each position by its pack
label or else as stored;
  - every pack and every size 2 to 8 equals the timeline's sentence;
  - 9 slots keep one English `who`;
  - both refusals are entirely Chinese in zh-CN;
  - every pack composes every refusal with no hole left;
- English when there is no reader language, and the whole text is
English when a pack lacks any one sentence.
- `exclude-submitter.integration.test.ts`: each refusal carries the
zh-CN `userMessage` while its `message` keeps the English byte for byte;
a decider with no locale gets English that names no id; the control
(another approver on the slate) gets the English "another approver"
text.
- `admin-rescue-named-slate.integration.test.ts`: a two-slot submitter
notice goes through the real `NotificationTextRenderer`, entirely
Chinese in zh-CN, in Japanese for ja-JP, and with the English literal
body unchanged.
- `rest-approvals-wire-codes.test.ts`: `403 FORBIDDEN` with
`userMessage` at the top level, `ApiErrorSchema` parse green; control:
unmarked and blank markings add no member.
- `flowLaunch.preDispatchRefusal-36390.test.tsx`: a flat approvals
refusal's top-level `userMessage` is the toast, through a real
`ActionRunner`; control: an unmarked or blank one shows the `error`.
- `ApprovalsInboxPage.inlineActionsVisible-34587.test.tsx`: the inline
Approve's failure toast is the marked text; control: the generic line.

## Acceptance notes

- **Slates of more than 8 slots.** The notice still names their slots in
English inside the recipient's sentence, as every multi-slot notice did
before this PR. Naming any number of slots would need a list-shaped
keyed param in `@objectstack/service-messaging`, which is outside this
card's surface. 8 is a declared constant, and the derived sentences cost
one bundle entry per size per pack.
- **A deployment override** of `messages.approvalNoApproverHolding` does
not reach the derived `…SlotsN` sentences. Those are their own catalog
keys and can be overridden the same way.
- **The Approval Center's bulk approve** still reports failures by
record title only. It shows no reason for any refusal, as before.

## Verification

Two-minute check: `pnpm --filter @objectstack/plugin-approvals exec
vitest run --maxWorkers=2 src/no-approver-note.test.ts`. Expect every
test to pass, including "a zh-CN decider reads each refusal entirely in
Chinese, the position by its label".

<details><summary>Local readings at 869d5de</summary>

- Dependency closure build (`@objectstack/plugin-approvals^...`,
`@objectstack/rest^...`): lock VERDICT command-exit 0.
- `pnpm --filter @objectstack/plugin-approvals --filter
@objectstack/rest typecheck`: VERDICT command-exit 0 (both include
`check:test-typecheck`).
- Full `@objectstack/plugin-approvals` vitest: Test Files 127 passed
(127), Tests 1899 passed (1899).
- Full `@objectstack/rest` vitest: Test Files 433 passed (433), Tests
9114 passed, 376 skipped (9490).
- UI: `pnpm --dir ui exec vitest run` on the two touched UI test files:
Test Files 2 passed, Tests 17 passed. `pnpm --dir ui exec vitest run
scripts/`: Test Files 172 passed, 2 skipped (174). `pnpm
check:new-line-citations` (ui): 0 new, exit 0.
- `pnpm check:i18n`: OK, 10 packages, all bundles in sync, exit 0 (after
its declared prerequisite build).
- Derived gate list (`dispatch-gates.mjs --commands`, 78 commands): 76
exit 0, 2 exit 3 (PREREQUISITE NOT MET, so NOT MEASURED):
`check-plugin-teardown-shape --self-test` (shallow checkout) and
`check:dual-build-cjs-loads` (needs a full workspace build). `--ran`
with exit codes: "78 derived famil(ies) accounted for — 76 run, 2
NOT-MEASURED (2 DERIVED from a recorded exit 3)".
- NOT MEASURED: `type-check` of `@object-ui/app-shell` and
`@object-ui/console`. Locally every error is TS2307 module-not-found for
unbuilt `@object-ui/*` declarations, with none in the touched files. CI
`Type Check UI` is the reading.
- Ablations, each through `scripts/ablation-replace.mjs` with the
restore proven by `git diff HEAD` empty and blob equal to HEAD:
- the mapper's `userMessage` spread deleted: `rest-approvals-wire-codes`
1 failed / 15 passed;
- the service's `err.userMessage` assignment voided: `exclude-submitter`
2 failed / 23 passed.
- `overlap-check --branch=HEAD`: VERDICT clean exit 0.

</details>

---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufziH9MVhWYLVCiw5eXB)_

<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufziH9MVhWYLVCiw5eXB -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
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 size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rest: the cross-object batch refusal names the failing operation's index, so a multi-pick related-list add can say which record failed

2 participants