Skip to content

fix(objectql,approvals,audit): rule messages, approval object labels and activity-summary labels read as /meta serves them in a declared sourceLocale - #36464

Merged
objectstack-fleet[bot] merged 8 commits into
mainfrom
claude/issue-35384-reader-labels-translate-object
Nov 22, 2026
Merged

objectstack-fleet[bot] merged 8 commits into
mainfrom
claude/issue-35384-reader-labels-translate-object

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread

Part of #35384 — this PR moves three of the card's readers onto the /meta resolve path. The approval NOTIFICATION subject param stays open: it is resolved per recipient at delivery by service-messaging's general keyed-param path, so it is left for the area to file (see Acceptance notes).

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:应用以英文编写、默认面向中文用户时,英文用户在审批收件箱、审批页、活动记录摘要和自定义校验规则的报错里看到英文原文,不再夹杂默认语言的中文;中文用户看到的不变。
  • 为什么做:这是多语言标签统一的后续:让这三处和对象元数据接口用同一种方式取标签。
  • 出错会怎样:最坏情况是某处标签显示成原文而不是译文,不影响数据和权限,合并后可直接回退。
  • 要你做什么:无

What changes

The #34030 rule, quoted from the card: "resolve the label through translateObject with the same resolve options /meta builds, so t() carries messages only."

  • objectql (validation/rule-validator.ts, authoredRuleMessage): an author-written rule message (objects.OBJECT._validations.RULE.message) now resolves through translatedLabels over ValidationMessageContext.labelTranslation. That is the bundle plus ResolveOptions that the same refusal's field, option and object labels already read (i18n: validation and refusal messages read field, option and object labels through t(), so a declared i18n.sourceLocale request still names the field with the defaultLocale row #34030), so this half adds no copy of the options. The ADR-0029 D9.2a tenant-rewrite check is unchanged. translate (that is, t()) now carries only the built-in messages.
  • plugin-approvals (reader-locale-labels.ts, readerLabelsFor().objectLabel): the object label resolves through translateObject over every locale the service holds, with the metadata route's options: the negotiated reader locale, the declared fallback chain, and sourceLocale else defaultLocale. This one change covers the inbox row, the request page, the generic data door's request rows and the two lifecycle refusals that name an object. Flow, step and position labels and the catalog sentences stay on t().
  • plugin-audit (activity-summary-message.ts): readerSummaryLocale hands the composer the object definition that translateObject put in the reader's language. The object, field and select-option labels are read off that definition and no longer come from t() keys. The writer's stored sentence is unchanged, because its locale already reads only authored labels.
  • A service that cannot hand its translations over (no getLocales() / getTranslations()) no longer gets these labels translated through t(): the authored text stands. Every service the platform ships implements both.

Tests

  • objectql engine-label-source-locale.test.ts: new top-level describe for the authored rule message under sourceLocale: 'en' / defaultLocale: 'zh-CN'. An en write reads the authored sentence. Controls: a zh-CN write reads the zh-CN row, and with no sourceLocale an en write walks to the zh-CN row.
  • objectql validation/rule-validator.test.ts (i18n: three authored display surfaces have no bundle key at all (bulk-action defs, custom validation messages, dataset labels) #14253 and D9.2a describes) moved from translate doubles to labelTranslation. The first case wires a t() decoy beside it, so a regression back to t() turns it red.
  • objectql engine-validation-locale-negotiation.test.ts and engine-validation-tenant-rewrite.test.ts: the served-adapter doubles gain getTranslations / getFallbackLocale, which FileI18nAdapter has. The three t()-locale probes in the negotiation suite now trip a built-in max_length message, the sentence the t() bridge still carries.
  • plugin-approvals reader-locale-labels.test.ts and plugin-audit activity-summary-message.test.ts: a new [#35384] describe in each. Each covers the real in-memory service and the served-adapter shape, and asserts that t() itself answers the zh-CN row at the same service, so the defect's precondition is measured and not assumed. Also covered: the two controls, a t()-only service, and a throwing getTranslations.
  • /meta's half of the same scenario is pinned in packages/rest/src/meta-i18n-declared-fallback-chain.test.ts §6.

Acceptance notes

Verification

Two-minute check: pnpm --filter @objectstack/plugin-approvals exec vitest run --maxWorkers=2 src/reader-locale-labels.test.ts. Expect every case to pass, including [#35384] … an en reader picks no defaultLocale row.

Read first:

  1. packages/plugins/plugin-audit/src/activity-summary-message.ts, the readerSummaryLocale / translatedObjectDef hunk (the reader's definitions are now the translated ones).
  2. packages/objectql/src/validation/rule-validator.ts, the authoredRuleMessage hunk.
  3. packages/plugins/plugin-approvals/src/reader-locale-labels.ts, the objectLabel hunk.
Test readings (b815112 unless stated; fix round at final head 67d23af first)
  • Fix round at 67d23af (CI Test Core 6/10 red on b815112: 4 cases in packages/services/service-automation/src/flow-write-refusal-locale.integration.test.ts, whose i18n double held the rule message only as a t() key, so the bundle read now returned the authored English). The double's zh-CN bundle gains objects.crm_deal._validations.amount_not_negative.message. It is a fixture change of spelling only: no assertion changed and nothing was skipped. In that file, Tests 8 passed (8). @objectstack/service-automation 290/290 files, 4222/4222 tests. @objectstack/plugin-approvals 126/126 files, 1853/1853. @objectstack/plugin-audit 109/109 files, 1800/1800. Lock VERDICT command-exit 0. overlap-check at 67d23af is clean. A sweep of the other tests that combine validations, an i18n service and a non-en locale found no further consumer.
  • objectql pnpm --filter @objectstack/objectql test at 8be4929 (objectql is unchanged after it): Test Files 628 passed (628), Tests 14286 passed (14286); lock VERDICT command-exit 0.
  • plugin-audit pnpm --filter @objectstack/plugin-audit test at b61713e: 107/109 files, 1798/1800 tests. Two failures: the new pin's expected list wording, and the bare-string option case (triaged below). After the fix, those two files at b815112: Tests 31 passed (31).
  • plugin-approvals pnpm --filter @objectstack/plugin-approvals test at b61713e: 125/126 files, 1846/1853 tests. Seven failures, all in record-lock-user-facing-message.test.ts, whose doubles answered labels through t() only. After those doubles gained getTranslations, that file and reader-locale-labels.test.ts at b815112: Tests 41 passed (41).
  • typecheck at b815112: objectql exit 0, plugin-audit exit 0, plugin-approvals exit 0. At b61713e approvals failed with TS2339 on the label-only doc literal; fixed with an ObjectLike annotation.
  • Fixture triage: the bare-string option options: ['p1', 'p2'] is not a SelectOptionSchema (strict object with label). translateObject, and so /meta, serves it as written. The plugin-audit: select option labels in sys_activity.summary are never localized — the same defect class as #7230, one line over in displayFieldValue #7289 case now pins p1 as /meta serves it, where it used to pin the t() row.
Reverse verification (each fixed source file put back to origin/main, its pins run, then restored)

At b61713e, under one lock call, the scratch script used git restore --source=BASE (tree only), checked the BASE blob hash on disk, then git checkout HEAD -- and checked the HEAD blob hash. Pins resolve src/ directly, so no dist step is involved.

  • rule-validator.ts at BASE: engine-label-source-locale.test.ts 1 failed / 8 (an en write reads the authored English sentence).
  • reader-locale-labels.ts at BASE: reader-locale-labels.test.ts 4 failed / 22 (both en reader picks no defaultLocale row cases, the inbox-row case, and the t()-only case).
  • activity-summary-message.ts at BASE: activity-summary-message.test.ts 4 failed / 18 (both en reader cases, the t()-only case, and the throwing-translations case).
  • Controls stayed green on every leg. After restore, git diff HEAD was empty.
Gates

node scripts/pm/dispatch-gates.mjs --commands derived 74 families; reconciliation with --ran reported 74 derived, 74 run.

  • 70 exit 0 at b61713e. Re-run at b815112, exit 0: check:type-check-debt (a PREREQUISITE exit 3 on the first pass, while a sibling build held dist), check:type-check-coverage, check:cross-package-test-inputs, check:test-source-alias, check:undeclared-dep-imports, check:nul-bytes, check:engine-double-contract, check:doc-authoring, check:issue-citations.
  • NOT MEASURED locally, left to CI: check:i18n (needs the built CLI closure), check:dual-build-cjs-loads (needs a full build), and check-plugin-teardown-shape --self-test (needs a commit this shallow clone does not have).
  • overlap-check --branch=HEAD: clean against origin/main and feat(audit): the activity stream shows each changed field's old → new values by default, served only for fields the reader may read #36399.

Generated by Claude Code

…le message through translateObject (wip)

Claude-Session: https://claude.ai/code/session_01QsR2jTyyBmoPBsURQjeJGq
Co-authored-by: Claude <noreply@anthropic.com>
…h labelTranslation; sourceLocale pin

Claude-Session: https://claude.ai/code/session_01QsR2jTyyBmoPBsURQjeJGq
Co-authored-by: Claude <noreply@anthropic.com>
…abels through translateObject

Claude-Session: https://claude.ai/code/session_01QsR2jTyyBmoPBsURQjeJGq
Co-authored-by: Claude <noreply@anthropic.com>
…s through translateObject

Claude-Session: https://claude.ai/code/session_01QsR2jTyyBmoPBsURQjeJGq
Co-authored-by: Claude <noreply@anthropic.com>
…tring option reads as /meta serves it

Claude-Session: https://claude.ai/code/session_01QsR2jTyyBmoPBsURQjeJGq
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l 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 22, 2026
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/objectql, @objectstack/plugin-approvals, @objectstack/plugin-audit, touching 31 documentable anchor(s).

16 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 9abc732132a2f723627d585b049e2cc10869db19.

⛔ 5 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 2 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 68 of 251 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 — 32 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 9abc732132a2f723627d585b049e2cc10869db19 → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 9abc732132a2f723627d585b049e2cc10869db19

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

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 9abc732132a2f723627d585b049e2cc10869db19 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…age over through its translations

Claude-Session: https://claude.ai/code/session_01QsR2jTyyBmoPBsURQjeJGq
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jTyyBmoPBsURQjeJGq

Final green head · 2026-11-22T13:32Z
Head-sha: 67d23afa2c0c9d8093db67494616964f9210498e
CI on this head: 39 success, 18 skipped, 0 failing or pending; mergeable clean. This round fixed the Test Core 6/10 red on b815112. In service-automation/src/flow-write-refusal-locale.integration.test.ts, the i18n double's zh-CN bundle now carries the rule message. It had held it only as a t() key, so authoredRuleMessage now reads it through translateObject. This is a fixture change of spelling only: no assertion changed and nothing was skipped. Dev delta: #35384 comment 7079786052.
Declarations: Clause-②: no · Metadata-protocol: none · packages/spec/src/** untouched.
Scope: Part of #35384. The notification subject param in service-messaging stays open, and the card's remainder is released to the queue on merge (follow-ups #36466, #36467).
Review: L1 owed (+629/−97, 13 files), requested from the L1 thread via the seat. No L2 is owed.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jSpi3g1dQNTvN6zEuH

席位核对

L1 (L1-e) on head 67d23afa2c0c9d8093db67494616964f9210498e, card #35384 (first stage): ACCEPT, with one landing condition (body only). No contract face is touched, so no L2 is owed by the face. The seat's own L2 call stands as made.

Landing condition. Both new readers hand translateObject the metadata route's resolve options but not its packaged base.

  • plugin-approvals objectLabel passes { name } alone. plugin-audit translatedObjectDef passes the served definition without packagedBase.
  • The meta door passes packagedObjectBaseOf(p, 'object', name), so for a renamed object (a served label that diverged from the packaged one) it serves the rename. These two readers serve the catalog's translation of the old label instead.
  • This is not a regression: t('objects.<o>.label') did the same before.
  • Two new docblocks overclaim it: "resolved as /meta resolves it" in reader-locale-labels.ts and "put in its language … as /meta" in activity-summary-message.ts. The changeset is scoped correctly ("with the resolve options the metadata route builds").
  • Before landing, file a card for "approval object label and activity-summary labels ignore the packaged base: a renamed object reads the translation of its old label", or fold it into the i18n: approval and audit texts still read object and option labels through t(), so a declared i18n.sourceLocale reader is shown the defaultLocale row (follow-up to #34030) #35384 remainder already routed in the body. Name it there. Qualifying the two docblocks is a nit, with no new head owed for it.
  • For reference, fix(share-links): the share page names the object by its label and leaves off hidden fields #36460 threaded the base through getPackagedObjectBase for the share-link label. The same read would close this.

Read

  • Shape (l1-face.mjs --pr 36464): open, draft, base main, Part of #35384, Clause-②: no, Metadata-protocol: none, mergeable clean. Gates at this head: 39 success, 18 expected skip, 0 failed.
    • The face flags changeset for @objectstack/service-automation. That touch is one *.integration.test.ts, and the build entry is src/index.ts (root tsup.config.ts) with files: ['dist', …], so nothing ships and no entry is owed.
  • Part of is right. This stage moves three of the card's readers. The approval notification subject param stays open: it is resolved per recipient at delivery through t(), and the producer holds no locale. The Acceptance notes route it, with the flow, step and position labels, as the remainder. rest: /meta does not negotiate the request locale, so en-US reads the default locale while other readers read en #36466 (meta door locale negotiation) and spec: one exported builder for the translateObject options /meta uses, instead of nine inline copies #36467 (one exported options builder) are filed.
  • objectql rule message. authoredRuleMessage first keeps an authored message that diverged from the packaged rule (scalarOverridesPackagedBase), unchanged. Otherwise it resolves { name, validations: [{ name, message }] } through translatedLabels over labelTranslation, the same bundle and options the refusal's field and object labels use (i18n: validation and refusal messages read field, option and object labels through t(), so a declared i18n.sourceLocale request still names the field with the defaultLocale row #34030), with no second copy. The t() key path is gone. The translator throwing still leaves a 400, not a 500.
  • Approvals and audit. The options match metaTranslateOptions: the negotiated locale, the declared fallback, and sourceLocale else defaultLocale. Each getter is feature-detected, and the build runs once per read and is memoised per object.
    • Audit: the labels are read off the translated definition (objectLabelIn, fieldLabelForSummary, optionLabelOn). t() keeps only messages.*.
    • The writer's stored sentence is unchanged: storedSummaryLocale reads authored definitions with translate: () => undefined, as before.
    • A throwing service leaves the authored labels.
  • Changeset, checked sentence by sentence. It is true, including the stated narrowing: "an i18n service that cannot hand its translations over … no longer has these labels and rule messages translated through t()". Every shipped service implements both getters.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jTyyBmoPBsURQjeJGq

Landing · 2026-11-22T15:40Z · head 44c8fc39f4c0a3bbed44d384b86345590bb6fd11 · L1-e ACCEPT 7081082388 at 67d23afa2c (no L2 owed)

probe reading
check-governed-merges.mjs --pr 36464 NOT governed · 726 changed lines ≤ 3000
K 15 at the ACCEPT head, so the area merged origin/main (clean, no regen deferred). Every PR file is byte-identical to 67d23afa2c, so the ACCEPT stands. landing-k.mjs now reads K = 5.
checks on head 37 success, 16 skipped, 0 failing · mergeable clean
landing condition (L1) the packaged-base gap of the approvals and audit readers is folded into the #35384 remainder (seat ruling), and named in the Acceptance notes

Ready + auto-merge in this stroke. The PR says Part of #35384, so the card stays open; on merge its remainder is released to pm:queue.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 22, 2026 15:40
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit 6d0089c Nov 22, 2026
54 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35384-reader-labels-translate-object branch November 22, 2026 16:30
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
…es before it picks a pack (objectstack-ai#36561)

<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi92ncfFpPUpTD8314otX5oaG)_

Fixes objectstack-ai#36466
Clause-②: no
Metadata-protocol: none

## 维护者速读

-
用户能看到什么变化:应用以英文编写、默认面向中文用户、并持有英文语言包时,浏览器语言为美式英语等地区写法的用户,在对象元数据接口里看到的对象名称由中文变为英文原文,和同一请求下保存报错里的名称一致;没有对应语言包的语言仍按默认语言显示。
- 为什么做:多语言标签统一的后续:让元数据接口和服务端各处读者用同一种方式把地区语言写法对到已有语言包。
- 出错会怎样:最坏情况是某个地区语言写法的用户看到的对象名称语言不对,不影响数据和权限,合并后可直接回退。
- 要你做什么:无

## What changes

The card's ruling, quoted: "Make the `/meta` read
(`packages/rest/src/meta-item-read-gate.ts`) negotiate the request tag
the way the other readers do before it picks a pack. No spec change."

- `metaTranslateOptions` (the `ResolveOptions` every metadata-document
translation builds) now carries `locale` as the request tag negotiated
against the locales the i18n service reports: `resolveBundleLocale`
(`@objectstack/spec/system`, the platform's one locale ladder) over
`getLocales()`. That is the question objectql's
`negotiatedMessageLocale` and plugin-approvals' `negotiatedReaderLocale`
already ask, over the same set. Neither of those is importable from
`@objectstack/rest` without a new export (objectql does not export it;
plugin-approvals is downstream), so a private helper beside it
(`negotiatedTranslationLocale`) repeats only the offered-set plumbing
and calls the shared rule. It adds no second rule and no new export.
- The tag passes through untouched when there is nothing to negotiate
against: no service, no `getLocales`, a throwing, empty or non-array
answer, or no match. So a locale the deployment holds no pack for still
walks the declared chain to the default locale.
- Reach: `metaTranslateOptions` is the one builder, so the item read and
the list read on both transports (`RestServer` and the runtime
dispatcher, which share `translateMetaDocument` / `translateMetaList`),
the view container, the stale-plural rule, the `GET /meta` types listing
and the public form's object labels (`translateOptionsFor` delegates
here) all read the negotiated tag. The doc locale collapse
(`resolveDocLocale`) and `extractLocale`'s other callers (export, import
template) are untouched.
- No `packages/spec` change.

## Tests

New top-level describe `objectstack-ai#36466 §7` in
`packages/rest/src/meta-i18n-declared-fallback-chain.test.ts`, the
shared harness of the `/meta` i18n pins (§6 is this deployment's
`sourceLocale` case). The fixture is `sourceLocale: 'en'`,
`defaultLocale: 'zh-CN'`, the chain collapsed to `zh-CN`, a `zh-CN`
pack, and an `en` pack that holds no `account` rows.

- Card pin 1: an `en-US` request with only an `en` pack reads `Account`
from `/meta` (item read, list read, and bare `en` agree).
- Card pin 2: a request for a locale with no pack at all (`fr-FR`), and
a header-less request, still read the default locale (`客户`).
- Control: with no `en` locale held, `en-US` has nothing to negotiate to
and walks to `客户`; `zh` still reads the `zh-CN` pack.
- Acceptance parity: for `en-US` and `fr-FR`, `/meta`'s label and the
label objectql's `DELETE_RESTRICTED` (code and status asserted) names on
the same i18n service are the same (`Account` and `客户`), and the other
one is absent.
- Cached arm (`getMetaItemCached`, the default door): `en-US` is served
`Account` and `en` the same body; the `en-US` validator revalidates its
own request (`304`); sent with `zh-CN` or `fr-FR` it answers `200` with
`客户`, never a `304` for the English body.

## Acceptance notes

- **Cache key (measured, unchanged here).** The cached arm's validator
is the protocol's hash of the untranslated document folded with the tag
the request SENT (`extractLocale`, `meta-item-read-routes.ts`, objectstack-ai#1319).
Translation runs after it with the negotiated tag. So within a running
server each sent tag maps to one body: `en-US` and `en` get separate
validators over identical bodies (fewer shared `304`s, never a wrong
one), and a validator never crosses languages (pinned above). Keying the
validator on the negotiated tag would need `meta-item-read-routes.ts`,
outside this card's file surface, so it is raised as a question in the
report. Not pinned, because it is already true of any pack edit: the
validator hashes no translation input, so a client that cached an
`en-US` body before this deploy can be answered `304` on the old `客户`
body until the document changes.
- **plugin-security does not negotiate (measured; the card's premise
holds for objectql and the objectstack-ai#36464 readers only).** Reading taken with a
scratch copy of `controlled-by-parent-master-edit-user-message.test.ts`
(deleted, not committed) on an i18n service with `sourceLocale: 'en'`,
`defaultLocale`/fallback `zh-CN` and an `en` pack: the master-detail
refusal's `userMessage` names the master `Contract` for `en`, `合同` for
`en-US`, and `Contract` for `fr-FR`. `denialLocaleOf` returns the raw
request tag and `denialLabels` hands it to `translateObject` as written.
So after this PR, `/meta` (`Contract`) and plugin-security (`合同`) still
disagree for `en-US`, and for `fr-FR` (`/meta` serves `合同`,
plugin-security falls back to an `en` sentence naming `Contract`). This
is reported for the seat to file, not fixed here.
- The public form and the `GET /meta` types listing negotiate too,
because they read the same builder. That is the same defect class on the
same function; no pin was added for them.

## Verification

Two-minute check: `pnpm --filter @objectstack/rest exec vitest run
--maxWorkers=2 src/meta-i18n-declared-fallback-chain.test.ts`. Expect 30
passed, including `objectstack-ai#36466 §7 … an en-US request with only an en pack
reads Account`.

Read first:
1. `packages/rest/src/meta-item-read-gate.ts`, the
`metaTranslateOptions` hunk (`locale:
negotiatedTranslationLocale(service, locale)`) and the new helper below
it.
2. `packages/rest/src/meta-i18n-declared-fallback-chain.test.ts`, the
`objectstack-ai#36466 §7` describe (the parity and cached-arm cases).

<details><summary>Test readings (head 5555e3e)</summary>

- `pnpm --filter @objectstack/rest test && pnpm --filter
@objectstack/rest typecheck` under the verify lock: Test Files 427
passed (427), Tests 8788 passed, 351 skipped (9139); `tsc --noEmit` and
`check:test-typecheck` OK (0 files in debt). Lock VERDICT command-exit
0.
- New describe alone: Test Files 1 passed (1), Tests 30 passed (30).
Lock VERDICT command-exit 0.
- Dependency closure built first: `pnpm --workspace-concurrency=2
--filter '@objectstack/rest^...' build`, lock VERDICT command-exit 0.
The parity case reads `@objectstack/objectql` from that build.

</details>

<details><summary>Ablation (fix committed first)</summary>

`node scripts/ablation-replace.mjs --file
packages/rest/src/meta-item-read-gate.ts --anchor 'locale:
negotiatedTranslationLocale(service, locale),' --replacement 'locale, /*
ABLATION-36466 */' -- …vitest run …
meta-i18n-declared-fallback-chain.test.ts`: anchor 1 to 0, marker 0 to
1, blob 3b1e091 to e2c5192f903c. The test imports
`./rest-server.js` from source, so no dist step is involved. Result: 3
failed, 27 passed. Red: `an en-US request with only an en pack reads
Account`, `for the same request, /meta and objectql name the object with
the same label`, and the cached-arm case. The no-pack, no-en and `zh`
controls stayed green. Restore: blob equals HEAD (3b1e091), and
`git diff HEAD` is empty.

</details>

<details><summary>Gates</summary>

Derived with `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` at 5555e3e: 69 commands (3 changed
paths). Each was run with stdin closed and its exit captured before any
pipe.
- 69 of 69 exit 0. Two needed a second pass. `check:type-check-debt` hit
the per-command 420 s cap (exit 124) on the first pass; re-run alone, it
reported `OK — 0 ledger entr(ies) re-measured … 0 raw tsc error(s)`,
exit 0. `check:dual-build-cjs-loads` exited 3 (PREREQUISITE NOT MET, no
full build); after `pnpm turbo run build --concurrency=2
--filter='!@objectstack/docs'` (lock VERDICT command-exit 0, 120/120
tasks) it reported `124 published require entry point(s) across 72
package(s) load`, exit 0.
- `--ran` reconciliation: `69 derived famil(ies) accounted for — 69 run,
0 NOT-MEASURED`.
- `node scripts/pm/overlap-check.mjs --branch=HEAD`: `VERDICT clean exit
0` (merges cleanly with origin/main d463c46; no open PR head shares a
file).
- CI at 5555e3e: all 53 check-runs completed, each success or
skipped. Among them: Lint & Repo Gates, TypeScript Type Check, Test Core
(10/10), Build Core, Governed Surface Queue Guard, Live E2E UI, Test UI,
Dogfood Regression Gate, Check Changeset.

</details>

---

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01ADHkmRB34k9WUWeGpRnVNm

<!-- signed: repo:objectstack#2 · os-steve ·
session_01ADHkmRB34k9WUWeGpRnVNm -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
… read as /meta serves them (objectstack-ai#36620)

<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9DD8XEF1VwrqXiQzo8zQCjY)_
Fixes objectstack-ai#35384
Clause-②: yes (widening)
Metadata-protocol: none
Skills-docs: none — Metadata-protocol is none and there is no
(narrowing) arm; no skills/** file teaches either label reading

## 维护者速读

-
用户能看到什么变化:在「编写语言与默认语言不同」的部署里(例如英文编写、用户默认中文),英文读者在审批收件箱和审批页上看到的审批步骤名,以及英文收件人收到的审批通知里的对象名,改为作者原文,不再混入中文;对象在代码里改过名的,通知里显示新名。
- 为什么做:这是「审批与审计文案按元数据接口同一方式取标签」那张卡的最后两项,前两批已合并,本次合并后该卡关闭。
-
出错会怎样:只影响审批步骤名和通知里的对象名这两处显示文字,取不到时退回原先存下的文字,不会让审批或通知失败;改动可整体撤回,已存的通知照旧显示。
- 要你做什么:无。

## What changes

The rule this card carries (from objectstack-ai#34030): "resolve the label through
`translateObject` with the same resolve options `/meta` builds, so `t()`
carries messages only". This PR delivers the card's two remaining items
(items 2 and 3 landed in objectstack-ai#36464 and objectstack-ai#36598).

**1. Approval notification object label (service-messaging,
plugin-approvals).**
- `NotificationTextKeys.params` accepts a new value, `{ object:
'OBJECT_API_NAME', fallback }` (`NotificationObjectLabelParam`, exported
from `@objectstack/service-messaging`). `renderWith` resolves it through
`translateObject` (`@objectstack/spec/system`) over the object's served
definition (`getSchema`) and its packaged base
(`registry.getPackagedObjectBase`), both read off the data engine the
renderer already holds. The resolve options are `/meta`'s: the
recipient's negotiated locale, the declared fallback chain, and the
declared `sourceLocale` else `defaultLocale`, inlined as
`reader-locale-labels.ts` does (one exported builder is objectstack-ai#36467).
`fallback` is delivered when nothing resolves.
- The inline fan-out, the dispatcher (claimed rows and digests) and the
inbox reader (`renderForReader`) all go through `renderWith`, so all
four paths resolve the label the same way.
- Widening, not replacement: `{ key, fallback }` is still accepted and
still renders through `t()`, so stored outbox and inbox rows render
exactly as before. The closed-shape validator (`problemOf`) admits the
new shape and refuses a mixed one, a missing `fallback`, or a name that
is not an object API name. The name shape is one segment of the existing
catalog-key shape, so every object a `{ key: 'objects.OBJECT.label' }`
param could name, the typed param can name too.
- plugin-approvals `subjectParams` now emits `{ object: objectName,
fallback }`.

**2. Approval step label (spec, plugin-approvals).**
- New spec export `resolveFlowApprovalStepLabel(bundle, flowName,
nodeId, literal?, opts?)` in
`packages/spec/src/system/i18n-resolver.ts`. It is the one reading of
`flows.FLOW.approvals.NODE_ID.label`, using the same locale chain and
the same bundle-then-literal order as `resolveFlowScreenTitle`.
- `reader-locale-labels.ts` `stepLabel` resolves through it with the
`/meta` resolve options it already builds for the flow, object and
position labels. No key is asked of `t()` any more.
- `translateFlow` is unchanged and stays unregistered in
`translateMetadataDocument`.
- Liveness `flows.approvals.label` evidence is re-anchored on the spec
resolver.

### Export choice (seat ruling, premise measured)

The seat ruled: overlay the step label inside `translateFlow` if the
step-label read points already hold or read the flow document; otherwise
use `resolveFlowApprovalStepLabel`. Measured at `aff34baea`:

- `reader-locale-labels.ts:405-410` (`localizeRequestLabels`) has only
`process_name` and `current_step` from the stored row. No flow document
is in hand. It is called for every row of a list read
(`approval-service.ts:10921`, `listRequests`), for the single read
(`:11205`), and by the generic data door
(`reader-locale-labels-middleware.ts:104`). Getting a document there
would add one flow read per row.
- `flowLabel` (`reader-locale-labels.ts:359`) does not read the flow
document. It hands `translateFlow` a stub, `{ name: flowName }`. So do
the other `translateFlow` callers in the tree:
`ui/packages/app-shell/src/views/FlowRunner.tsx:445` and
`ui/packages/plugin-detail/src/stageChangeStarts.tsx:106` both pass `{
name, label }`.
- Only the single-read enrichment holds the document
(`approval-service.ts:11340` `requestFlow`, used by `attachFlowSteps`
`:11350` and `attachFlowRoute` `:11407`).

The premise does not hold at the main read point, so this PR takes
`resolveFlowApprovalStepLabel`. `translateFlow` and its docblock are
untouched, so no client-visible change.

The param's member is `object`, by seat ruling (card comment
7091274184), and the type name stays `NotificationObjectLabelParam`.
Three reasons:
- The member holds the object's API name, not a label.
- In the spec, the word `object` always means an object's API name.
- The sibling `{ key, fallback }` is also named for what it holds.

The first round built it as `objectLabel` and round 2 renamed it. The
mixed shape `{ object, fallback, key }` is still refused.

### Tests changed (forced)

- `plugin-approvals/src/reader-locale-labels.test.ts`: two pins that
drove the step label through a `t()`-only double were re-triaged onto
`getTranslations`. One is "negotiates through `resolveBundleLocale`…"
and the other is "asks the service once per read, and never through
t()". The `objectstack-ai#35384` flow/position sourceLocale describe now also covers
the step label.
- `plugin-approvals/src/no-approver-note.test.ts`: its local renderer
narrows the widened `ApprovalTextParam` union. TS2339 came from
`check:test-typecheck`, and no assertion changed.

## Tests

<details><summary>Readings</summary>

- New pins: spec `i18n-resolver.test.ts` describe
`resolveFlowApprovalStepLabel` (5 cases: locale + `zh` ladder, declared
chain, authored locale sourceLocale en / default zh-CN, literal and
empty-bundle fallbacks, own keys). service-messaging
`keyed-notification-text.integration.test.ts` describe `objectstack-ai#35384` (7 cases
on a real ObjectQL + SqlDriver: precondition, inline fan-out, SQL outbox
+ dispatcher, renamed packaged object with `/meta`'s
`translateMetadataDocument` as oracle, inbox reader en / en-US / zh-CN,
`t()`-only service, closed shape). plugin-approvals
`approval-notification-keyed-text.integration.test.ts` describe
`[objectstack-ai#35384]` (real ApprovalService plus real MessagingService: an en
approver reads `Deal`, a zh-CN approver reads `商机`, a renamed object
reads its rename).
- Full suites on `2dfa8720` (the code head; the later merge of
`origin/main` touched no file in these packages):
`@objectstack/service-messaging` Test Files 80 passed (80), Tests 1084
passed (1084); `@objectstack/plugin-approvals` Test Files 127 passed
(127), Tests 1883 passed (1883); `@objectstack/spec` (on `9d5362af`,
spec unchanged after) Test Files 880 passed (880), Tests 28058 passed, 1
todo. Typecheck of all three packages, including spec's
`check:test-typecheck` and approvals' `check:test-typecheck`: exit 0.
- Round 2, the rename of the member to `object`, at `cfce553f`: `pnpm
exec turbo run build` of both closures (40/40 tasks), then the typecheck
of service-messaging and plugin-approvals (including
`check:test-typecheck`) exited 0. `@objectstack/service-messaging` Test
Files 80 passed (80), Tests 1084 passed (1084).
`@objectstack/plugin-approvals` Test Files 127 passed (127), Tests 1883
passed (1883). The closed-shape pin still refuses `{ object, fallback,
key }`. Spec is unchanged in round 2.
- Ablation (round 1; one lock call each, `scripts/ablation-replace.mjs`
plus a trap restore; every subject resolves from `src/`, so there is no
dist leg; each leg's anchor went x1 to x0 and was restored with blob
equal to HEAD and `git diff HEAD` empty):
- Leg 1a, messaging object label read through `t()`: 5 failed / 7 of the
`objectstack-ai#35384` describe.
- Leg 1b, no `packagedBase`: 1 failed / 7 (the rename case). The first
attempt was refused by the tool as a no-op (the replacement text already
existed elsewhere), so it was re-run with a distinct replacement.
  - Leg 2, approvals `stepLabel` back on `t()`: 5 failed / 37.
- Leg 3, spec resolver walking the declared chain for the authored
locale: 1 failed / 5.
- Leg 4, approvals `subjectParams` back to `{ key }`: 2 failed / 8 (both
end-to-end `[objectstack-ai#35384]` cases).

</details>

## Acceptance notes

- Version skew: an older `service-messaging` refuses `{ object, fallback
}` at `emit()`. Both packages are in the changeset `fixed` group, and
the changeset says to upgrade them together.
- A `t()`-only i18n double (no `getTranslations`) now gets the
`fallback` for the typed param, not the `t()` row.
`II18nService.getTranslations` is a required member, so every served
service hands its translations over.
- Other producers that name an object through `{ key:
'objects.OBJECT.label' }` keep the `t()` reading until they adopt the
typed param. Only plugin-approvals emits it today (`git grep
objectLabelKey` under packages/services and packages/plugins).

- CI on the round-1 head `0b91c34b`: Test UI, Lint & Repo Gates and
TypeScript Type Check read red, and none of them is a test or type
failure. Run 45109434849 concluded `cancelled` at 04:07:57Z because the
push of `cfce553f` (committed 04:07:17Z; its CI run 45109928513 was
created at 04:07:32Z) superseded it. Every Test UI, Test Core, Lint and
Type Check lane on `0b91c34b` concluded `cancelled` between 04:07:33Z
and 04:07:57Z. The three rollups only report that: Test UI logged "the
Test UI shards concluded 'cancelled'", Lint & Repo Gates logged "lint
lane ... concluded `cancelled`" for four lanes, and TypeScript Type
Check logged "type-check lane ... concluded `cancelled`" for three
lanes, with no `error TS` line. Nothing under `ui/**` or `examples/**`
consumes `NotificationTextParam`, `ApprovalTextParam` or the stored
`keyed_text` (`git grep`). The only in-repo narrowing site was
`no-approver-note.test.ts`, fixed in round 1.

## Verification

Read first:
`packages/services/service-messaging/src/notification-text.ts`
(`renderWith` and the private `objectLabel` resolver; risk: the
validator's new branch), `packages/spec/src/system/i18n-resolver.ts`
(`resolveFlowApprovalStepLabel`),
`packages/plugins/plugin-approvals/src/reader-locale-labels.ts`
(`stepLabel`).

Two-minute check: `pnpm --filter @objectstack/service-messaging exec
vitest run src/keyed-notification-text.integration.test.ts -t 35384`
should show 7 passed. The en recipient reads `Your Opportunity D_1
awaits approval.`, and the renamed object reads `Deal`.

https://claude.ai/code/session_01ADHkmQNmyLgnBbCoc2iFjL
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- signed: repo:objectstack#2 · os-steve ·
session_01ADHkmQNmyLgnBbCoc2iFjL -->

---------

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/l 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.

2 participants