Repository navigation
Commit d4b2a75
feat(spec): a named import mapping's label is translatable at mappings.NAME.label (#34976)
Fixes #34939
Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: follow-up owed — #34962 (skills/objectstack-i18n/SKILL.md
group list)
Claim: issuecomment-6956466284, seat amendment issuecomment-6957676841
(route A: label only, packaged-base guard in, description out). This PR
is part (1) of the card. Parts (2) and (3), the import wizard's mapping
step and preview, are in the UI-half PR #34961. Both are needed to close
the card's three symptoms.
## 维护者速读
- **改了什么:** 翻译包新增 `mappings` 分组,只有一个键 `mappings.NAME.label`。`GET
/meta/mapping`(列表与单条)按读者语言返回已命名导入映射的标签。`os i18n extract` / `os i18n
check` / `os validate`、Studio 翻译预览与翻译表都认识这个分组。
- **为什么改:** zh-CN
组织里,导入向导按标签列出已保存映射,但标签是映射上的纯字符串,翻译包里没有对应的键,所以每种语言都显示作者原文(如 `Inquiry feed
(marketing CSV)`)。
- **风险与回滚:** 纯加宽:新增可选分组与新翻译器,原来能解析的都照常通过。覆盖包里被改过的标签按 ADR-0146 D2 判定,与
book/page 相同。回滚即还原本 PR。`packages/metadata-protocol/src/protocol.ts` 在
main 上恰好处于门面行数上限 11705。按席位裁决(路线 B),把 page/dataset/app/book/mapping 五个
packaged-base 访问器的注释合并为一份共享契约,逐条保留原有陈述,文件现为 11704
行,`check:facade-delegation-only` 通过,未改上限台账。
- **先看:** `packages/spec/src/system/translation.zod.ts`(`mappings`
分组与拒收文案),`packages/spec/src/system/i18n-resolver.ts` 的
`translateMapping`(D2 标签顺序),`packages/rest/src/meta-item-read-gate.ts` 的
`PACKAGED_BASE_ACCESSORS` 新行。
- **两分钟验证:** `pnpm --filter @objectstack/runtime exec vitest run
src/domains/meta-list-projection-parity.test.ts`,预期 1365/1365 通过,其中
zh-CN 读 `/meta/mappings` 得到 `线索导入`,en-US 得到 `Lead feed`。
- **需要你做的:** 无,席位落地。
## What changes
- **`@objectstack/spec`**
- New optional translation group `mappings` (keyed by mapping `name`,
one key `label`) on `TranslationDataSchema`,
`PlatformTranslationDataSchema`, `ServedTranslationDataSchema` and
`TranslationItemSchema`.
- The group is a strict object. `description` and `fieldMapping` are
refused with guidance that names where to translate instead (a target
field's label is `objects.OBJECT.fields.FIELD.label`). The singular
`mapping` and the label aliases `name` / `title` are refused with the
declared spelling named. The group counts in the refusal texts moved
from sixteen to seventeen (application) and from seventeen to eighteen
(platform).
- New `translateMapping`, registered in `METADATA_DOCUMENT_TRANSLATORS`.
`TRANSLATABLE_METADATA_TYPES` is derived from that table, so `GET
/meta/mapping` (list and item) is localized at the REST boundary with no
further wiring. The label follows the ADR-0146 D2 order (`labelCatalogs`
/ `valueOverridesPackagedBase`), like `translateBook`.
- `MappingSchema.label`'s `.describe` names the translation key.
- Generated files are regenerated: authorable surface (build-written),
api-surface, export-origins, the references docs, the liveness ledger
(`mappings` live, with its `label` child) and the strictness-ledger
counts.
- **`@objectstack/metadata-protocol` / `@objectstack/rest`:** `mapping`
joins `PackagedArtifactBaseType`. `getPackagedMappingBase` is on the
protocol, forwarding to the facet. A `['mapping',
'getPackagedMappingBase']` row goes in `PACKAGED_BASE_ACCESSORS`. A
`.custom` override's label is therefore judged against the shipped base,
not read as override-authored.
- **`@objectstack/lint`:**
- The i18n walk emits `mappings.NAME.label` (source `mapping`).
- `validate-translation-references` resolves `mappings.NAME` against the
stack's mappings and sibling packages' mappings. An unknown name is
`translation-target-unknown` with the nearest name suggested.
- The rule explanation names the group.
- **`@objectstack/cli`:** `os i18n check` reports gaps as
`i18n/missing-mapping`. `--help` names "import mappings".
- **`@object-ui/app-shell` / `@object-ui/i18n`:**
- The translation preview shows the group as Import Mappings (导入映射).
- The Studio translation table walks `mapping` items.
- `spec-translations` namespaces the group.
- **Showcase:** zh-CN translates `showcase_inquiry_feed`, the one
mapping any example authors.
- **Docs:** `i18n-standard.mdx` (group list and count),
`ui/translations.mdx` (a row, and the resolved-types list),
`import-mappings.mdx` (the `label` row names the key).
- **Platform checklist** (`docs/qa/platform-checklist/areas/i18n.json`,
the file added in L1 round 1): item `i18n.surface-matrix` moves to
revision 16.
- `acceptance[7].clause` now counts eighteen platform groups, seventeen
per-app groups and seventeen scored groups, and names `mappings` in the
list. Before, a tester would have scored the showcase's
`mappings.showcase_inquiry_feed` as outside the vocabulary.
- The `appTranslationDataShape` source line names all seventeen app
groups. It used to say fifteen and leave out `hooks`, which was stale
before this PR.
- The history entry records a count-and-list correction with no change
to the clause's meaning.
## Tests
- `packages/spec/src/system/i18n-mapping.test.ts` (new):
- all four doors accept the group;
- the face is closed;
- the aliases are refused;
- the `description` / `fieldMapping` guidance is shown;
- `translateMapping` is registered;
- zh-CN reads the translation and en-US gets the same reference back;
- the locale ladder and fallback chain apply;
- an empty label is not a translation;
- the input is not mutated.
- `i18n-resolver.test.ts`: a `mapping` row in the ADR-0146 D2 precedence
table (now "all nine types").
- REST: the accessor pin and a `mapping` precedence row. objectql: the
bare-slot envelope test's label-order types gain `mapping`.
- Runtime: the meta list projection parity census carries `mapping` /
`mappings`. Over HTTP, zh-CN `/meta/mappings` serves `线索导入` and en-US
`/meta/mapping` serves `Lead feed`. The item read is pinned too.
- Lint: the walk emits the key from the label only, never from the field
mapping. `validate-translation-references` covers four cases: a clean
name, an orphan with a suggestion, a report name under `mappings`, and a
sibling-declared name.
- CLI, `test/i18n-mapping-walk.test.ts` (new): the extract keys, a
schema-valid scaffold, and a gap reported as `source: 'mapping'`.
- UI: the preview category tests (one entry per group; the coverage
denominator goes from 2/16 to 2/17) and the translation table's
list-read count (15).
- Ablation, two legs, each through `scripts/ablation-replace.mjs`
(anchor hit 1/1; restore proven as blob == HEAD and an empty `git diff
HEAD`):
- dropping `mapping: translateMapping` from the dispatch table fails 9
tests and passes 541 (`i18n-mapping` and the D2 rows);
- dropping the `mappings` row from the orphan table fails 2 tests and
passes 252.
## Acceptance notes
- **The facade line ceiling is paid inside `protocol.ts` (seat ruling,
route B).** The per-accessor docblocks of `getPackagedPageBase`,
`getPackagedDatasetBase`, `getPackagedAppBase`, `getPackagedBookBase`
and the new `getPackagedMappingBase` are folded into one shared contract
on `getPackagedPageBase`. That contract names all five accessors. The
other four each carry a one-line pointer to it. `protocol.ts` is now
11704 lines against its ceiling of 11705, with the forwarder in.
`scripts/facade-delegation-registry.json` is untouched. Where each
folded statement now lives:
| Statement (before the fold) | Was on | Now in the shared docblock |
|:---|:---|:---|
| `[#30062]`; the PACKAGED (code-layer) declaration a code package
ships, before a `.custom` pair's declared override replaces it (ADR-0146
D2) | page (each of dataset, app, book carried `[#30062]`) | opening
sentence, for all five |
| the page is the twin of `getPackagedDashboardBase`, answered the same
way | page | "the page is the twin of `getPackagedDashboardBase`" |
| dataset, app and book are twins of `getPackagedPageBase`, and mapping
of `getPackagedBookBase`, answered the same way | dataset, app, book,
mapping | "the other four are twins of the page (and of each other), all
answered the same way" |
| the fact the translator (`@objectstack/spec/system`) compares against
as its `packagedBase`; the catalog is the packaged translation of
exactly this body, so it may only replace a string the served item still
carries unchanged (ruling record 6631250894: pair, then the override's
own label, then the base's translation) | page | shared paragraph, for
all five |
| `translatePage`, `pages.NAME` | page | page bullet |
| measured: the `crm_welcome` override labelled `OVpage` was served, and
zh-CN got the base's `欢迎页` | page | page bullet |
| a page has no extension fold, so the artifact item IS the packaged
declaration | page | page bullet (page only) |
| `translateDataset`, each string of `datasets.NAME` (label,
description, dimension and measure labels) | dataset | dataset bullet |
| same reason as the page: a pair's dataset override kept the base's
translated label and measure labels over its own | dataset | dataset
bullet |
| `translateApp`, each string of `apps.NAME` (label, description and
navigation labels, a node judged against the base's node of the same
`id`) | app | app bullet |
| `translateBook`, each string of `books.NAME` (label, description and
group labels, a group judged against the base's group of the same `key`)
| book | book bullet |
| `translateMapping` compares the served label (`mappings.NAME.label`,
ADR-0146 D2) | mapping | mapping bullet (with #34939); ADR-0146 D2 is in
the opening sentence |
| shadow-immune for the dashboard's reason: served from its row, never
as the artifact, so the body is the base's own | page | closing
paragraph, for all five |
| returns `undefined` for an item no code package ships, an unknown or
empty name, or a registry double without the lookup, which the
translator reads as the catalog applying unchanged ("the same
uncertainties" for the other four) | page, with the others pointing to
it | closing paragraph, for all five |
- `description` stays out (seat ruling): `MappingSchema` declares none.
- **Other spelled group counts and lists.** At `f23f65d8c8` the tree was
grepped over `docs/qa`, `content/docs`, `scripts`, `packages`, `ui`,
`examples` and `skills`. Every spelled translation-group count or list
either is correct (`i18n-standard.mdx`, `translation.zod.ts`) or was
fixed above (`i18n.json`). Two places were left alone:
- `scripts/check-i18n-walk-parity.mjs`'s `RECORDED_*` arrays are a
declared sample, not a source of truth;
- `skills/objectstack-i18n/SKILL.md` stays with #34962.
- The changeset's Clause-② line now names
`ObjectStackProtocolImplementation.getPackagedMappingBase` (L1 N1).
- `skills/**` is untouched. The group list in
`skills/objectstack-i18n/SKILL.md` is owed on #34962.
## Verification
The PR head is `f23f65d8c8`. It is a merge of `origin/main`
(`fb5c42d10c`; none of the 24 files it brings overlaps this PR's source,
and `protocol.ts` stays at 11704 lines) on top of `32942ddd5c`, which
carries the checklist correction and the changeset wording.
<details><summary>At f23f65d, L1 round 1</summary>
- `pnpm check:platform-checklist`: exit 0 (16 areas, 433 items).
- `node scripts/pm/check-governed-merges.mjs --pr 34976`: NOT governed
(0 of 42 paths hit the register), 704 changed lines (+615 / -89), under
the 3000 threshold.
- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` re-derived the same 139 commands, and all
ran again at this head.
- Reconciliation, `--ran` with exit codes: 139 derived, 138 run, 1
NOT-MEASURED, 0 UNRUN. Every run family exited 0, including
`check:facade-delegation-only`, `check:i18n-coverage` and
`check:platform-checklist`. NOT MEASURED: `check:dual-build-cjs-loads`,
exit 3 (whole-workspace `dist/` prerequisite). CI runs it.
- After the merge, under the verify lock: the two preview pins plus
`packages/i18n/`, Test Files 104 passed (104), Tests 1959 passed, 13
skipped.
</details>
The previous round's head, `ab48a19f39`, adds the docblock fold on top
of `9d26d5a770`. The fold changes comments only, in
`packages/metadata-protocol/src/protocol.ts`.
<details><summary>At ab48a19, after the fold</summary>
- `pnpm check:facade-delegation-only`: exit 0. `protocol.ts` is 11704
lines against a ceiling of 11705, with 322 delegations and 1 named
exception.
- `pnpm --filter @objectstack/metadata-protocol typecheck`: exit 0,
after building its dependency closure. `pnpm --filter
@objectstack/metadata-protocol build`: exit 0.
- The two suites that call the packaged-base accessors, under the verify
lock:
- rest `meta-dashboard-view-i18n-explicit-override`: Tests 114 passed
(114);
- objectql `protocol-custom-override-bare-slot-envelope`: Tests 114
passed (114).
- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` re-derived the same 139 commands, and all
ran again at this head.
- Reconciliation, `--ran` with exit codes: 139 derived, 138 run, 1
NOT-MEASURED, 0 UNRUN. Every run family exited 0, including
`check:i18n`, `check:i18n-coverage`, `check:i18n-walk-parity`,
`check:skill-examples` and `check:doc-formula-expressions`.
- NOT MEASURED: `pnpm check:dual-build-cjs-loads`, exit 3 (PREREQUISITE
NOT MET). It reads every package's `dist/`, and this checkout did not
build the whole workspace. CI runs it.
</details>
<details><summary>At 9d26d5a, before the fold (unchanged by
it)</summary>
- `@objectstack/spec`, the `i18n-mapping`, `i18n-resolver` and
translation suites (4 files): Tests 792 passed.
- At `e2ac16438e`:
- lint `i18n-walk`, `validate-translation-references` and
`rule-explanations`: Tests 274 passed (274);
- runtime `meta-list-projection-parity`: Tests 1365 passed (1365).
- CLI unit tier at `0663ffad1f`: Test Files 4 passed (4), Tests 27
passed (27). The integration tier is left to CI.
- UI:
- app-shell previews plus `translationTable.test.ts`: Tests 1809 passed
(1809);
- `packages/i18n/`: Tests 1896 passed, 13 skipped;
- the two edited preview pins at `3a7c72e8a0`: Tests 63 passed (63).
- Typecheck, exit 0 for each: `@objectstack/lint`, `@objectstack/cli`,
`@objectstack/rest`, and `@object-ui/i18n` / `@object-ui/app-shell`
`type-check`.
- Every other CI family is left to this PR's check runs.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzgwLiKcfujYUug7sPs)_
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzgwLiKcfujYUug7sPs -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 743308b commit d4b2a75
42 files changed
Lines changed: 615 additions & 89 deletions
File tree
- .changeset
- content/docs
- data-modeling
- protocol/kernel
- references
- api
- data
- system
- ui
- docs
- audits/2026-07-unknown-key-strictness-ledger.counts
- qa/platform-checklist/areas
- examples/app-showcase/src/system/translations
- packages
- cli
- src/utils
- test
- lint/src
- metadata-protocol/src
- objectql/src
- rest/src
- runtime/src/domains
- spec
- api-surface
- authorable-surface
- export-origins
- liveness
- state-counts
- src
- data
- system
- scripts/fixtures/i18n-walk-parity
- ui/packages
- app-shell/src/views
- metadata-admin/previews
- studio-design
- i18n/src
- namespaces/studio
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
496 | | - | |
| 496 | + | |
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
| |||
582 | 582 | | |
583 | 583 | | |
584 | 584 | | |
585 | | - | |
| 585 | + | |
586 | 586 | | |
587 | 587 | | |
588 | 588 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1882 | 1882 | | |
1883 | 1883 | | |
1884 | 1884 | | |
| 1885 | + | |
1885 | 1886 | | |
1886 | 1887 | | |
1887 | 1888 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| 198 | + | |
198 | 199 | | |
199 | 200 | | |
200 | 201 | | |
| |||
326 | 327 | | |
327 | 328 | | |
328 | 329 | | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
329 | 336 | | |
330 | 337 | | |
331 | 338 | | |
| |||
377 | 384 | | |
378 | 385 | | |
379 | 386 | | |
| 387 | + | |
380 | 388 | | |
381 | 389 | | |
382 | 390 | | |
| |||
507 | 515 | | |
508 | 516 | | |
509 | 517 | | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
510 | 524 | | |
511 | 525 | | |
512 | 526 | | |
| |||
621 | 635 | | |
622 | 636 | | |
623 | 637 | | |
| 638 | + | |
624 | 639 | | |
625 | 640 | | |
626 | 641 | | |
| |||
751 | 766 | | |
752 | 767 | | |
753 | 768 | | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
754 | 775 | | |
755 | 776 | | |
756 | 777 | | |
| |||
823 | 844 | | |
824 | 845 | | |
825 | 846 | | |
| 847 | + | |
826 | 848 | | |
827 | 849 | | |
828 | 850 | | |
| |||
964 | 986 | | |
965 | 987 | | |
966 | 988 | | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
967 | 995 | | |
968 | 996 | | |
969 | 997 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
106 | | - | |
| 107 | + | |
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
0 commit comments