Repository navigation
Commit ee2ffca
fix(lint,rest)!: i18n extract/check expect the _relatedLists keys os validate accepts under a .custom arrangement, and the object read translates a tab title the arrangement sets (#38085)
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU
<!-- claude-projects-attribution: {"github_login":"os-tesla"} -->
_Requested by **Tesla** · [project
thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoPitZDb578jbruHjEfhUY3D)_
Fixes #37622
Clause-②: yes (narrowing)
Metadata-protocol: none
Skills-docs: follow-up #38128
## 维护者速读
- 定制包改过或新加了相关列表标签页标题时,翻译键命令和校验现在给出一样的结论;记录页上这类标题也会按定制包自己的译文显示,以前一直显示原文。
- 替给客户定制包做翻译的人解决两件事:覆盖率检查要求一个校验会拒收的键,永远过不了;定制包里新写的标签页标题翻了也不显示。
- 用 `--strict`
跑覆盖率检查的项目,可能新报缺少定制包标签页标题的译文,补上即可。显示侧最坏是某个标签页标题换成了定制包的译文。都可以直接撤回。
- 这是收窄,需要审批人批准;契约审核在 7ddcc64 上通过,没有必须改或应该改的项。d830f5af 只合入了 main,本 PR
自己的改动没有变。
## What changes
**`os i18n extract` / `os i18n check` agree with `os validate` (card
item 1).**
- New `packages/lint/src/related-list-titles.ts`: the ONE fold of an
object's record-page tab titles as the registry serves them. It runs the
owner's `relatedLists` first, then every list placement, then the paired
`.custom` arrangement. Each arrangement entry replaces every entry it
covers (`relatedListNameCovers`), in two passes per arrangement. It
answers `labels` (list → served label + the layer that wrote it),
`names`, `hidden` and `stripped`. The logic was lifted unchanged from
`validate-translation-references.ts`, where it lived inline.
- `validate-translation-references.ts` reads that fold. The rule's
verdicts are unchanged; the 36595 pins and the full lint suite pass as
before.
- `i18n-walk.ts` `pushRelatedListLabels` (the walker behind
`collectExpectedEntries`, which both CLI commands call) reads the same
fold over the stack's `objectExtensions`:
- no key over a list the arrangement hides, names bare or re-states
without a `label`;
- one key, carrying the arrangement's text, over a list the arrangement
labels;
- still no key for a label only a code extender's `place` entry gives.
The rule accepts that key, but the registry does not apply a placement
on a target with no `relatedLists`, or on a list the owner already
names.
- It lives beside `object-graph.ts`, not in it. That file's receivers
are tabled by the security-posture rule's key-read meta-test, which this
fold is no part of.
- `packages/cli` is unchanged.
**The object read translates a tab title the arrangement sets (card item
2, seat route R1).**
- `packages/rest/src/meta-item-read-gate.ts`, new
`objectPairRelatedListsBundleOf`. It is used by both `/meta/object`
reads, `translateMetaDocument` (by name) and `translateMetaList` (list).
- An object still answers no `servedOverrideBaseOf` (ADR-0146 D10,
unchanged). Instead, the read takes the pair of the base the object's
packaged base ships in (`packagedBase._packageId`, the base
`withoutStaleObjectPlural` already reads) and calls
`getPairTranslationBundle` through the same per-page memo.
- Only the `objects.OBJECT._relatedLists` subtree of each locale is
handed on, as the existing `pairBundle` option.
- The pair is asked only when the served object carries a tab title that
diverges from the packaged base (`hasRelatedListTitleOffBase`, the
divergence `translateObjectRelatedLists` judges a title by). An object
list where no arrangement changed a tab title pays no new translation
read, which keeps the ADR-0090 D10 statement budget pinned by
`packages/runtime/src/mcp-list-objects-statements.pin.test.ts`.
- A tab title that diverges from the packaged base now reads the pair's
translation, then keeps its own text. On such an object, a title equal
to the owner's reads the pair's translation first, then the
deployment's, interleaved by locale, as the spec's `labelCatalogs`
already orders it. On an object where no title diverges, every title
reads the deployment catalog, as before; that catalog already holds the
pair's share.
- Every other string of the object keeps the ranking it had. A slice
that answers nothing for an object string reads exactly as no
`pairBundle`; the scope pin below holds this.
- No new export and no new option: `TranslateDocumentOptions` and
`packages/spec/src/system/i18n-resolver.ts` are untouched.
**Review follow-ups N2–N4.**
- N2: a pin for `{ list: 'event.related_to', hidden: true }` beside a
bare `'event'` (both orders). The wrong test comment that said the
schema refuses that shape is removed.
- N3/N4:
- The two `translation-target-unknown` hints now name the list the key
addresses (`{ list: 'LIST', label }`) instead of "the owner's `label`".
- The stripped message says "replaces the entry that labelled it".
- The ledger entry
`translation-related-list-key-under-arrangement-refused`: its `surface`
says "the owner or a list placement labels". Its `replacement` no longer
claims a translated title needs the owner's label, which this PR makes
false.
- `content/docs/protocol/kernel/i18n-standard.mdx`: the `_relatedLists`
row says the same.
-
`packages/objectql/src/registry-related-lists-label-translation-36528.test.ts`:
the header now says how the REST read builds the pair bundle, instead of
claiming it did when it did not.
Changeset: `@objectstack/lint`, `@objectstack/rest` and
`@objectstack/spec` patch, with the BREAKING note for the coverage
gate's expected key set and an ADR-0087 `not-required
(no-migration-prescription)` disposition.
## Tests
- `packages/lint/src/i18n-related-lists-arrangement-36595.test.ts` (the
existing harness):
- New top-level `describe` "collectExpectedEntries — _relatedLists agree
with the rule". Over nine arrangements, every key the extractor
scaffolds is translated and judged by `validateTranslationReferences`,
and none is refused.
- The scaffolded keys and their source text are pinned per arrangement.
- A placement-only label is not asked for and is still accepted.
- The N2 pin. The no-label hint assertion now expects `{ list:
'contact', label }`.
- `packages/rest/src/meta-object-related-list-pair-i18n.test.ts` (new;
the real `SchemaRegistry` / protocol / `RestServer` harness of
`meta-object-extension-plural-label.test.ts`, pair `translation` rows
read through `getPairTranslationBundle`), on both `/meta/object` reads:
- The pair translates a relabelled tab and a newly titled one in
`zh-CN`; `en`, which the pair does not translate, keeps the
arrangement's text.
- A title the pair does not translate keeps its own text, never the
base's translation of another string.
- Scope: an extension's renamed object `label` is NOT translated by the
pair's `label` row, while its tab title is.
- Controls: with no arrangement, and with one that keeps the owner's
title. The deployment translation serves, and the pair's own translation
serves first where it ships one.
- Statement budget: the pair's catalog is asked 0 times for an object
with no arrangement or one that keeps the owner's title, and more than 0
times for one that relabels.
- `packages/cli/test/i18n-coverage.test.ts`: two cases, the zh keys `os
i18n check` expects under an arrangement, and a control.
<details><summary>Readings (branch cut from origin/main 815e882,
origin/main merged at d830f5a; head d830f5a)</summary>
- Premise, at 815e882, two throwaway probes (deleted):
- `collectExpectedEntries` scaffolded `_relatedLists.crm_task` and
`.crm_note` over lists the arrangement hid or named bare, and
`validateTranslationReferences` refused both as `error`. It did not
scaffold `.crm_call`, which the arrangement labelled and the rule
accepts.
- Real `translateMetaDocument` and `translateMetaList` served `['Notes',
'任务']`: the arrangement's `Notes` was untranslated, though the pair
ships `笔记`. `servedOverrideBaseOf('object', served)` returned
`undefined`, and the pair bundle was asked 0 times.
- Ablation through `scripts/ablation-replace.mjs` on the committed head,
each restore `blob == HEAD` and `git diff HEAD` empty:
- by-name arm `?? objectPairRelatedListsBundleOf(…)` removed:
`meta-object-related-list-pair-i18n.test.ts` `Tests 3 failed | 2 passed
(5)` (at 48c654c, before the sixth pin);
- list arm removed: `3 failed | 2 passed (5)` (same);
- slice replaced by the whole pair bundle: `1 failed` (the D10 scope
pin);
- at 7ddcc64, the `hasRelatedListTitleOffBase` gate removed: `1 failed
| 5 passed (6)` (the statement-budget pin);
- `foldRelatedListExtensions` removed from `pushRelatedListLabels`:
`i18n-related-lists-arrangement-36595.test.ts` `2 failed | 9 passed
(11)`;
- the `layer === 'place'` skip removed: `1 failed | 10 passed (11)`.
- The subjects resolve from `src/` (relative imports), so no build was
needed.
- Full package suites, under `os-verify-lock.sh`:
- `@objectstack/lint`: `Test Files 243 passed (243)`, `Tests 9816 passed
(9816)`;
- `@objectstack/rest` at 7ddcc64: `Test Files 439 passed (439)`, `Tests
9288 passed | 376 skipped (9664)`;
- `@objectstack/runtime` `src/mcp-list-objects-statements.pin.test.ts`
at 7ddcc64: `Tests 20 passed (20)`. At fe0f53e it failed 1 of 20 (memo
`list_objects` 31 statements at 150 objects against a bound of 24), and
with the pair arm ablated it passed 20 of 20. That failure was this
PR's, and 7ddcc64 fixes it;
- `@objectstack/cli` `test/i18n-coverage.test.ts`: `Tests 32 passed
(32)`.
- `turbo build --force` of the lint, rest and objectql closures (dts
included): 32/32. `typecheck` exit 0 for `@objectstack/lint`,
`@objectstack/rest`, `@objectstack/spec` and `@objectstack/objectql`.
`@objectstack/spec check:generated`: "All 14 generated artifacts are up
to date".
- `eslint` on the nine changed `.ts`: exit 0.
`check-adr-0087-registration --base origin/main`: registered,
`not-required (no-migration-prescription)`.
- Derived local gate set, `dispatch-gates --ran` at fe0f53e: 129
derived, 127 run, all exit 0. 2 are NOT MEASURED:
`check-plugin-teardown-shape --self-test` (its fixture commit is outside
the shallow clone) and `check:dual-build-cjs-loads` (needs a full `pnpm
build`). 7ddcc64 changes only
`packages/rest/src/meta-item-read-gate.ts` and its new test. At 7ddcc64
these were re-run: the rest suite above, rest `tsc --noEmit` exit 0,
`eslint` on the two files exit 0, and `check-engine-double-contract`
exit 0. `fe0f53eb` added the new pin's `findOne` row to
`scripts/engine-double-contract.pinned.json`; its absence was the
engine-double-contract red at 48c654c.
- Head d830f5a merges `origin/main` into 7ddcc64. The merge had no
conflicts. `git diff 7ddcc64 d830f5a` over this PR's own files is
empty, so the net diff is unchanged; the code readings above at 7ddcc64
stand for it.
- CI on d830f5a: 70 check runs, 60 success, 10 skipped, 0 failed, 0
pending. `Lint UI` is skipped because the diff has no `ui/` path.
</details>
## Acceptance notes
- A label only a code extender's `place` entry gives is accepted by
`translation-target-unknown` but not scaffolded by `os i18n extract`.
This is deliberate, and it is the harmless direction: the registry does
not apply a placement on a target with no `relatedLists` or on a list
the owner already names, so asking for it could ask for a string no
screen shows. Whether the rule should refuse those keys is a separate
narrowing, not taken here.
- The public form route (`form-routes.ts`) still translates its object
with no pair bundle. A public form renders no record-page tabs, so the
gap does not reach a screen; its comment stays true.
- The pair's tab-title translations also outrank a tenant overlay's own
tab label (a `sys_metadata` object row that relabels a tab). This is the
ruled order of ruling record 6631250894: a pair translation, then the
override's own text.
- Skills: `skills/objectstack-i18n/SKILL.md` (the `_relatedLists` row)
and `skills/objectstack-data/rules/relationships.md` (line 359) still
say the remedy is to re-state the entry "with the owner's own `label`".
That is still correct but no longer the only way, because the object
read now translates any arrangement label through the pair. The
follow-up is filed as #38128; see `Skills-docs:` above.
- Dogfood battery (`(narrowing)` arm and `!` title), `pnpm --filter
@objectstack/dogfood test` under `os-verify-lock` on the landing head
d830f5a. It ran after `pnpm install --frozen-lockfile` and a build of
the dogfood closure (`@objectstack/dogfood^...`, `@objectstack/cli`,
`@objectstack/client-react`), because the merge brought in main's
lockfile and version moves. Result: `VERDICT command-exit 0` (held the
lock 2166s, shared-box seconds), `Test Files 490 passed | 3 skipped
(493)`, `Tests 4144 passed | 68 skipped (4212)`. The same battery read
the same counts at 7ddcc64 and at fe0f53e.
## Verification
Read first (by risk):
1. `packages/rest/src/meta-item-read-gate.ts`:
`objectPairRelatedListsBundleOf` and its two call sites. This is the
served-read change: check that only the `_relatedLists` subtree is
handed on.
2. `packages/lint/src/related-list-titles.ts`: the fold, lifted from the
rule. Diff it against the removed block of
`validate-translation-references.ts`.
3. `packages/lint/src/i18n-walk.ts`: `pushRelatedListLabels`, and which
layer it skips.
Two-minute check: `pnpm --filter @objectstack/rest exec vitest run
src/meta-object-related-list-pair-i18n.test.ts` should show 6 passing.
Delete the `?? (await objectPairRelatedListsBundleOf(…))` arm of the
by-name read and the same command should show the by-name pins failing.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L9qibw44Q7BwdAY1RmfR73
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L9qibw44Q7BwdAY1RmfR73)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 7605e0c commit ee2ffca
12 files changed
Lines changed: 691 additions & 129 deletions
File tree
- .changeset
- content/docs/protocol/kernel
- packages
- cli/test
- lint/src
- objectql/src
- rest/src
- spec/src/migrations/entries/semantic
- scripts
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1174 | 1174 | | |
1175 | 1175 | | |
1176 | 1176 | | |
1177 | | - | |
| 1177 | + | |
1178 | 1178 | | |
1179 | 1179 | | |
1180 | 1180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
518 | 518 | | |
519 | 519 | | |
520 | 520 | | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
53 | | - | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
78 | | - | |
79 | | - | |
80 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
81 | 95 | | |
82 | 96 | | |
83 | 97 | | |
| |||
115 | 129 | | |
116 | 130 | | |
117 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
92 | 96 | | |
93 | 97 | | |
94 | 98 | | |
| |||
202 | 206 | | |
203 | 207 | | |
204 | 208 | | |
| 209 | + | |
| 210 | + | |
205 | 211 | | |
206 | 212 | | |
207 | 213 | | |
| |||
1047 | 1053 | | |
1048 | 1054 | | |
1049 | 1055 | | |
1050 | | - | |
1051 | | - | |
1052 | | - | |
1053 | | - | |
1054 | | - | |
1055 | | - | |
1056 | | - | |
1057 | | - | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
1058 | 1072 | | |
1059 | | - | |
1060 | | - | |
1061 | | - | |
1062 | | - | |
1063 | | - | |
1064 | | - | |
1065 | | - | |
1066 | | - | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
1067 | 1084 | | |
1068 | 1085 | | |
1069 | 1086 | | |
| |||
1580 | 1597 | | |
1581 | 1598 | | |
1582 | 1599 | | |
| 1600 | + | |
| 1601 | + | |
1583 | 1602 | | |
1584 | 1603 | | |
1585 | 1604 | | |
| |||
1710 | 1729 | | |
1711 | 1730 | | |
1712 | 1731 | | |
1713 | | - | |
| 1732 | + | |
| 1733 | + | |
1714 | 1734 | | |
1715 | 1735 | | |
1716 | 1736 | | |
1717 | | - | |
| 1737 | + | |
1718 | 1738 | | |
1719 | 1739 | | |
1720 | 1740 | | |
| |||
0 commit comments