Repository navigation
Commit 1fef2ed
docs(skills): the objectstack-i18n entry file becomes a router (#38663)
<!-- claude-projects-attribution: {"github_login":"os-warren"} -->
_Requested by **Warren** · [project
thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ89no8UMVXrh61ZoSoTF3Qhw)_
Part of #34770
Clause-②: no
Metadata-protocol: none
`Part of`, not the closing form: the catalog-size line of the card's
Done-when is not met by this PR. This is PR 3 of the per-skill split,
under dispatch order 7265010468 and claim 7264988593.
## 维护者速读
- 用户能看到什么变化:用户无感。发给 AI 的「多语言翻译」技能说明,入口文件从约 25 KB 缩到 9
KB:入口只留开工前三项检查、一段可照抄的翻译包示例、一张「每种界面文字该写在哪个键下」的路径清单、七个「能通过检查却翻不出来」的坑,以及其余内容去哪里查的指路表。
- 为什么做:这是「技能目录瘦身」的第六份(界面、数据、自动化、平台、跨大版本升级五份已完成)。入口文件每次都整份装进 AI
的上下文,越长越贵,也越容易漏读。
- 出错会怎样:只动教 AI 的文字,没有产品行为变化;风险是 AI
少读一段后答错。改动前后都跑了评测:十六道题里,改动后通过四十二次(每题三遍共四十八次),改动前是三十八次;仍不过的两题里,一题在改动前的文字上就三遍都不过,另一题两边都时过时不过,没有哪一题是改动后才每遍都不过的。可整笔撤回。
- 要你做的:无。席位核对与合约审查通过后,会按治理规则请审批人批准。
## Rulings this executes
- **Card Scope** (decision record on the card, S3 = A): the entry file
holds first checks, at most about 8 traps and a routing list; 6–9 KB,
hard cap 500 lines; restated option lists and key tables go behind a
pointer; no trap is removed until a publish-time check covers it or it
stays inline.
- **7128031203** fork 4 = A: ratchet rows are pinned at the measurement
with zero headroom, and the sum of ceilings does not rise. Here no row
rises and none is added.
- **7168461386** = A: text an eval shows the entry lost goes back into
the entry. Used twice in this PR (see Eval parity).
- **Seat order for this PR** (7265010468): same shape as PR 2; the cut,
not the move, lowers the catalog total; no new file under `skills/` (a
new file needs a new ratchet row, which stays with a human).
- **Ruling record 7249189592**, the parity rule: a case whose result
flips between runs on both trees is unstable on both and does not block;
a case that fails on every run of the head while `main` passes is a
regression.
## What changes
**The entry file becomes a router.** `skills/objectstack-i18n/SKILL.md`:
25,285 → 8,996 bytes, 504 → 160 lines, 6,315 → 2,243 tokens. Frontmatter
(description, triggers) is byte-identical. It now holds:
- `## First checks`, three: read the stack's `i18n` block, its
`translations` and the contract before writing a key; which of
`defaultLocale`, `sourceLocale`, `supportedLocales` and `fallbackLocale`
is which, with the English-source, Chinese-audience declaration; verify
with `os i18n check` and `os validate`.
- `## A bundle`: one type-checked example (two locales, one object with
a field, an option and an action, one message, the stack registration)
and one paragraph on the `translation` metadata item.
- `## Key map`: every group and every key as one path listing, then six
notes for the placements a path cannot show (child-object keys, a form's
own heading, table columns beside `fields` with one worked example,
parent-side related lists, report blocks and book groups, flow steps).
- `## Traps`, seven, each a bundle that parses and ships and then
translates nothing or the wrong text: an option key is the stored
`value`; double braces only, no ICU MessageFormat; `os i18n extract`
writes `objects` and `globalActions` only unless told otherwise;
coverage is not freshness; a generated module is an `objects` subtree
and `withSourceFallback` needs the source-hashes companion;
server-written text is in the organization's language; an app-authored
refusal has no `en` floor.
- `## Where to go`: four rows (the contract, the service contract, the
published i18n standard page, the sibling skills).
**No text moved.** This skill has no hand-written reference file
(`references/_index.md` is generated), and a new file needs a new
ratchet row. So what left the entry was cut, each behind what now
answers it:
| Old entry section | Now |
|:--|:--|
| Translation Configuration, Stack-Level I18n Config | First check 2
keeps the four properties and the worked declaration. Cut: the property
table and the three refused alias spellings (the contract's strict shape
refuses each and names `sourceLocale`); one sentence on the language of
validation, delete-restriction and permission-denial messages (platform
behaviour, nothing for a bundle author to write). |
| Authoring Translation Bundles | `## A bundle`. The two long examples
become one that shows each nesting level once. |
| Object-Level Translation Structure | `## Key map`: the same keys as
paths. Cut: the condition on each key (which declaration it needs),
which the contract carries in the key's `.describe()` text and `os
validate` reports as `translation-target-unknown`, an error; the glosses
on top-level groups; the four-line sample block, of which the
table-column line stays as code and the inline-title and report-block
lines as paths. |
| Naming Conventions | Cut. First check 1 says a key must match a
declared name; a key that does not is `translation-target-unknown`. |
| File Organization Strategies | Cut. `## A bundle` keeps the one fact
that bites: nothing loads a directory. |
| Authoring at Runtime: the `translation` Item | Kept, one paragraph
under `## A bundle`. |
| Message Interpolation | Trap 2. |
| Translation Coverage | First check 3 and trap 4. Cut: the other flags
(each command's `--help` lists them) and the coverage and diff shapes
(the contract). |
| Integration with II18nService | Routing row 2, which still names the
three optional methods no adapter ships. Cut: the method list, the
locale ladder (routing row 3), the registration paragraph and the three
REST routes. |
| Server-Composed User Text | Traps 6 and 7 keep the app-authored half.
Cut: the paragraph on sentences the platform composes itself. |
| Translation Workflow Best Practices | Traps 3 and 5. |
| Shipped examples | Cut. |
| Common Pitfalls (the retired `o.*` shape) | Cut.
`defineTranslationBundle` and the metadata save both refuse the retired
keys and answer with the key to write. |
| Verify your work, References, See Also | First check 3 and the routing
table. |
**Sizes** (bytes · lines · ratchet tokens):
| | before (`f5da514b`) | after (`06c77b1b`) |
|:--|--:|--:|
| `SKILL.md` (entry) | 25,285 · 504 · 6,315 | 8,996 · 160 · 2,243 |
| `skills/objectstack-i18n/**` (4 files) | 44,121 · 746 | 27,832 · 402 |
| all 14 `SKILL.md` together | 196,948 · 3,750 | 180,659 · 3,406 |
| whole `skills/` tree (115 files) | 1,231,233 | 1,214,944 |
| whole tree without `evals/` (73 files) | 872,024 | 855,735 |
| ratchet: authored tokens = sum of all ceilings | 200,348 | 196,276 |
| ratchet: bundle total, tokens | 305,013 | 300,941 |
**Budget reading:** the entry is 8,996 B, inside the card's 6–9 KB line,
and 160 lines against the 500-line cap. The whole catalog is 16,289
bytes smaller, all of it cut.
**Ratchet row** (`scripts/check-skills-token-ratchet.mjs`), pinned AT
its measurement, zero headroom: `skills/objectstack-i18n/SKILL.md` 6315
→ 2243 (−4,072). It is the skill's only row. The sum of all ceilings
goes 200,348 → 196,276.
## Tests
### Eval parity
Judged by ruling record 7249189592. **No case fails on every run of the
head while `main` passes.** On `1235a12d`, the last head a full round
ran on, the with-skill arm passes 42 of 48 turns against 38 of 48 on
`main`'s text; two cases fail there, case 5 (fails on `main` in every
run alike) and case 12 (flips on both trees). The review-round head
`06c77b1b` changes two sentences of the entry; the four cases those
sentences bear on were read again on it.
Skill evals, both arms, one command line for every round (`skill-evals
--skills objectstack-i18n --repeats 3 --model sonnet --effort medium
--concurrency 4`; the extra readings add `--case` and change
`--repeats`; CLI 2.1.332, subscription login). 16 behaviour cases in
`evals/bundles-locales-coverage.json` and 7 trigger cases in
`evals/triggers.json`, both untouched.
| reading | tree | with-skill | no-skill | with-skill cases below 3/3 |
|:--|:--|--:|--:|:--|
| before round | `f5da514b` | 38/48 | 1/48 | 5 (0/3) · 9 (1/3) · 11
(1/3) · 12 (1/3) · 16 (2/3) |
| first router head | `d27a5088` | 36/48 | 2/48 | 3 (1/3) · 5 (0/3) · 10
(2/3) · 11 (0/3) · 12 (0/3) |
| second head | `878eb3ea` | 34/48 | 3/48 | 4 (1/3) · 5 (0/3) · 9 (1/3)
· 10 (2/3) · 11 (1/3) · 12 (0/3) · 16 (2/3) |
| second head, cases 3, 10, 11, 12, four repeats | `878eb3ea` | 10/16 |
0/16 | 11 (2/4) · 12 (0/4) |
| **third head, full round** | `1235a12d` | **42/48** | 1/48 | 5 (0/3) ·
12 (0/3) |
| third head, cases 3, 4, 11, 12, three repeats | `1235a12d` | 8/12 |
0/12 | 11 (1/3) · 12 (1/3) |
| review-round head, cases 6, 10, 12, 16, three repeats | `06c77b1b` |
9/12 | 0/12 | 12 (0/3) |
| review-round head, case 12, eight repeats | `06c77b1b` | 2/8 | 0/8 |
12 (2/8) |
Trigger cases, every full round on every tree: loaded when it should
15/15, left alone when it should not 6/6.
- **Case 12** (which key carries a result table's column headers) passes
1 of 3 on `main`, 1 of 6 on `1235a12d` and 2 of 11 on `06c77b1b`: it
flips on both trees. Each failing answer, on both trees, gives the right
key path and the right code and fails on a literal: most warn against
the wrong nesting by quoting it ("don't nest it as `error: { message
}`"), which is the literal the case forbids; a few spell the path with
its placeholders and so omit the literal `resultDialog.columns.rows`.
Before the worked example went back in (below) the head read 0 of 16.
- **Case 11** (English source, Chinese audience) passes 1 of 3 on `main`
and 4 of 6 on `1235a12d`. The failing answer gives the right declaration
and adds "don't set `defaultLocale: 'en'`", the literal the case
forbids.
- **Case 5** (extract ran, check still reports app keys missing) fails
in every reading on both trees: the answer gives the `--no-objects-only`
course and omits the literal `--strict`, which the entry carries on both
trees.
- **Case 3** (relabel in Studio with no redeploy) was a real loss on the
first head: 3/3 on `main`, 1/3 on `d27a5088`, where the entry named
`defineTranslation` only inside a parenthesis and two answers showed the
item as a bare object. The sentence is an instruction again ("author
with `defineTranslation`"): 7 of 7 on the second head, 6 of 6 on the
third.
- **Cases 4, 9, 10 and 16** each missed single runs on one tree or both
(4: 1/3 on the second head, 3/3 on `main` and 6/6 on the third head; 9
and 16: below 3/3 on `main` itself; 10: a heading "No title:" in a
correct answer matched the forbidden literal `title:`). All four are 3/3
on the third head; cases 6, 10 and 16 are 3/3 on the review-round head.
Two restorations under ruling 7168461386 came out of these rounds: the
`defineTranslation` sentence (case 3), and the one worked table-column
example the original file carried, `resultDialog: { columns: { rows: {
email: '邮箱', 'error.message': '原因' } } }` (case 12). Both are paid
inside the entry.
<details><summary>Round records</summary>
- Before round on `f5da514b`: 117 of 117 turns, 5.7 min.
- Round on `d27a5088`: 117 of 117 turns, 5.9 min.
- Round on `878eb3ea`: 117 of 117 turns, 6.5 min. Extra readings on it:
32 of 32 turns, 1.6 min.
- Round on `1235a12d`: 117 of 117 turns, 6.1 min. Extra readings on it:
24 of 24 turns, 1.3 min.
- Readings on `06c77b1b`: cases 6, 10, 12, 16, 24 of 24 turns, 1.3 min;
case 12 alone, 16 of 16 turns.
- Two probes on the working tree, between `878eb3ea` and `1235a12d`, 24
turns each. Without the table-column example: case 12 0/6, case 4 5/6.
With it (the text that became `1235a12d`, less four small edits
elsewhere in the file): case 12 3/6, case 10 5/6.
- Every `must_contain` literal of the 16 cases that the entry carried
before, it still carries (70 literals read; 58 carried before and after,
0 lost; 12 appear in neither tree and come from the prompts).
</details>
### Other tests
On `1235a12d` and again on `06c77b1b`, under the verify lock (`VERDICT
command-exit 0` each), the same counts both times:
- `pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2
scripts/platform-catalog.test.ts scripts/skill-map-guards.test.ts` (the
suite that names the ratchet script, and the one that names this skill):
`Test Files 2 passed (2)`, `Tests 57 passed (57)`.
- `pnpm --filter create-objectstack exec vitest run --maxWorkers=2
src/created-summary.test.ts` (it names the skill in its catalog list):
`Test Files 1 passed (1)`, `Tests 12 passed (12)`.
No ablation: the diff changes prose and one ledger, no tested behaviour.
No test in the repository reads this entry's prose.
## Acceptance notes
Open question for the seat or the approver:
- **The key map stays inline** (3.4 KB of the entry's 9.0 KB) and is not
cut to a pointer at the contract. The order's shape line says key tables
go behind a pointer to the contract or the generated reference. Here the
generated reference lists files, not keys; the contract is 3,340 lines;
eleven of the sixteen eval cases ask which key carries a text; and the
eval sandbox, like an MCP-only session, has no `node_modules` to read.
So the section became a path listing (8.3 KB to 3.4 KB) and stayed. If a
hand-written reference file is wanted instead, it needs a new ratchet
row, which the standing ruling leaves to a human; the map then moves
there verbatim and the entry drops to about 5.6 KB.
Decided here (small, no shipped behaviour), each open to reversal in
review:
- **"Every trap stays inline unless a publish-time check covers it" was
read as: a bundle that parses, ships and then translates nothing or the
wrong text stays inline.** Inline: the seven traps and the six placement
notes. Cut to the contract, each loud when hit: a retired key, a
misspelled alias, a key under a parent that does not declare it
(`defineTranslationBundle` refuses the first two with the key to write;
`os validate` reports the third as `translation-target-unknown`, an
error).
- **The option-key trap stays inline although a check names it**:
`translation-option-key-unknown` is a warning, so the bundle ships.
- **Paid inside the entry for the two restorations and a truthful
routing row**: the `pluralLabel` line of the example (the key is in the
map), the words "(deep-merge)", "optional," and "forever", and "refusal
guidance" shortened to "refusals".
- **Review round on `06c77b1b`** (contract review 7266118883: PASS, S1,
N1, N2). S1, fixed: the key map's opening sentence gave `{path}`,
`{column_path}` and `{list}` each "a plain string" value; the contract
holds a string under `fields.{path}` and `{column_path}` only, an object
with `label` under `_relatedLists.{list}` and a column map under
`columns.{path}`. The sentence now reads "`fields.{path}` and
`{column_path}` hold plain strings". N2, fixed: the first placement note
names `lookup` beside `master_detail`, as the contract does for both
`inlineTitle` and `relatedListTitle`. Both are paid inside the entry,
8,998 to 8,996 B, the row unchanged at 2243: the routing table's last
row names the sibling skills with shorter glosses, and two traps are a
few words shorter. N1, left: `bulkActions.{def}`, a dataset member and a
report block's `description` still stop above their leaf keys. Naming
them costs about 70 bytes the entry does not have, each miss is refused
loudly or reported by `os i18n check`, and routing row 1 sends them to
the contract. The changeset no longer says the map names every key and
every group; it says where the map stops.
- **Routing row 3 names only what its page holds** (locale resolution
and fallback). The first head promised routes and coverage shapes there;
the page has neither. The coverage shapes are in the contract (row 1).
The three `/api/v1/i18n` routes are not linked from the entry: a bundle
author writes none of them, and a second link did not fit. The changeset
names the page that documents them.
- **Section anchors of the entry changed.** The changeset lists every
anchor that left `SKILL.md`. No file in this repository links one of
them.
- **Footer form**: this body ends with the single block AGENTS.md
prescribes for a PR body, not the two-line form the launching thread's
reminder proposed, because a stacked two-line block is measured to store
as three attribution blocks.
Noted, not changed:
- The literals of eval cases 5, 10, 11 and 12 fail correct answers
(above). Case 12 forbids `error: {`, which a warning quotes; its sibling
case 10 forbids the code form `verdict: { summary: '`, which a warning
does not match. That is a reading of the eval file; the parity rule
treats the cases as fixed, so this PR does not touch them.
- The commit message of `1235a12d` says "twenty-two readings"; the count
is 16 (3 on `d27a5088`, 7 on `878eb3ea`, 6 on the first probe). The
branch is not rewritten for it; the squash takes this body.
- The version PR #38192 touches the entry's stamp line; `overlap-check`
reads it as merging cleanly.
## Verification
Read first, by risk:
1. `skills/objectstack-i18n/SKILL.md`, the whole file: is anything a
model needs before opening the contract missing? The risk hunks are `##
Key map` (the listing and its six notes replace an 8 KB table) and `##
Traps`.
2. `.changeset/34770-i18n-skill-router.md`: the "what left, and what
answers it now" list is the record of every cut.
3. `scripts/check-skills-token-ratchet.mjs`: the one `objectstack-i18n`
row.
Two-minute check: `node scripts/check-skills-token-ratchet.mjs` prints
`ratcheted (authored) 196276 / 196276 (+0)` and
`skills/objectstack-i18n/SKILL.md 2243 / 2243 (+0)`; `wc -c
skills/objectstack-i18n/SKILL.md` prints 8996.
Gates, local, each exit code captured before any pipe. The whole derived
list ran on `1235a12d`; `06c77b1b` differs from it by six lines of the
entry, two comment lines of the ratchet row and one paragraph of the
changeset, so the families that read those were run again on it.
<details><summary>On `06c77b1b`: the families the review round reaches,
all exit 0</summary>
- `node scripts/check-skills-token-ratchet.mjs`: `ratcheted (authored)
196276 / 196276 (+0)`, `skills/objectstack-i18n/SKILL.md 2243 / 2243
(+0)`; its `--self-test` exit 0.
- `pnpm check:skill-links`: `290 relative link(s) in 76 published skill
file(s) resolve; 161 fragment(s) name a real heading under GitHub's slug
rule.`
- `pnpm check:doc-anchors`: `1178 internal #fragment link(s) across 366
source file(s) all resolve to a real heading`.
- `pnpm check:skill-identifier-liveness`, `check:skill-compatibility`,
`check:nul-bytes`, `check:role-word`, `check:corpus-claim-drift`,
`check:published-readme-links`, spec `check:skill-docs`: exit 0.
- `check-changeset-no-major`, `check-empty-changeset`,
`check-adr-0087-registration`, `check:changeset-gate-self-tests`,
`check-platform-checklist --changed-from origin/main` (nothing judged):
exit 0.
- `node scripts/pm/overlap-check.mjs`: `VERDICT clean exit 0` before the
push.
- Not run again: spec `check:skill-examples` (no code block changed).
</details>
On `1235a12d`:
<details><summary>Derived families: 69 derived, 68 run green, 1 NOT
MEASURED</summary>
- Reconciliation: `✓ dispatch-gates --ran: 69 derived famil(ies)
accounted for — 68 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit
3).`
- NOT MEASURED: `pnpm check:dual-build-cjs-loads`, exit 3, `Run pnpm
build first. ⛔ This is NOT a pass: nothing was measured.` It reads every
package's built `dist/`, and this container holds no full build. The
diff touches no package source; CI's run is the reading.
- `pnpm check:dts-closure` is recorded from its second run. Its first
run, in the list, exited 1 naming missing declaration files while a
package build of this session was rewriting those `dist/` folders; run
again with no build in flight it exits 0: `47 built package(s) swept -
189/189 declared declaration file(s) present`.
- `node scripts/check-skills-token-ratchet.mjs`: `✓
check-skills-token-ratchet: 61 authored bundle file(s) within their
ceilings; 11 generator-owned file(s) and 42 eval fixture(s) measured,
not ratcheted.` (`ratcheted (authored) 196276 / 196276 (+0)`, `bundle
total 300941`); its `--self-test`: `111 cases pass`.
- `pnpm check:skill-links`: `290 relative link(s) in 76 published skill
file(s) resolve; 161 fragment(s) name a real heading under GitHub's slug
rule.`
- `pnpm check:skill-identifier-liveness`: `Leg 1: 540 citation(s) over
76 published file(s) ...; Leg 2: 11 registered exhaustive section(s), 0
ledgered gap(s).`
- `pnpm --filter @objectstack/spec run check:skill-docs`: `Skill docs in
sync`.
- `pnpm check:skill-compatibility`, `check:skill-frame-sync`,
`check:role-word`, `check:corpus-claim-drift`, `check:doc-authoring`,
`check:published-files`: exit 0. `pnpm check:nul-bytes`: `no raw ASCII
control bytes`.
- The changeset gates (`check-changeset-no-major`,
`check-empty-changeset`, `check-adr-0087-registration`,
`check:changeset-gate-self-tests`): exit 0. `pnpm
check:pm-dispatch-gates` (fast tier): exit 0.
</details>
<details><summary>Beside the derived list, all exit 0</summary>
- `pnpm --filter @objectstack/spec run check:skill-examples`: `351 prose
examples type-check across 3 surface(s)`. The entry's one example is
among them. Its first run exited 3 (a client package was not built); it
was run again after that build.
- `pnpm --filter @objectstack/spec run check:skill-refs`: `10 generated
files in sync with packages/spec`.
- `pnpm --filter @objectstack/spec run check:skill-served-sections`: `24
served section(s), each heading exactly once in its file` (the hosted
door serves no section of this skill).
- `pnpm check:doc-anchors`: `1178 internal #fragment link(s) across 366
source file(s) all resolve to a real heading`.
- `pnpm check:published-readme-links`: `564 outbound link(s) across 168
published markdown file(s)`, `99 docs-site page(s) resolved`.
- `pnpm check:skill-top-level-keys`: exit 0.
- `node scripts/check-platform-checklist.mjs --changed-from
origin/main`: `0 anchored files in the change set — nothing judged.`
- `node scripts/pm/overlap-check.mjs`: `VERDICT clean exit 0` before
each push.
- The body gates on this text (`check-closing-keyword-parity --body`,
`check-partof-closing-keyword`): exit 0.
</details>
Base: the branch is cut from `f5da514b`; `main` has moved nine commits
since (to `74a15cb7`), none touching `skills/`, the ratchet script or
the translation contract, and was not merged in. CI on the head is the
seat's reading.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01JQwxbaa1vPDVusyBxyGMG6)_
<!-- signed: repo:objectstack#2 · os-warren ·
session_01JQwxbaa1vPDVusyBxyGMG6 -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 945334e commit 1fef2ed
3 files changed
Lines changed: 154 additions & 464 deletions
File tree
- .changeset
- scripts
- skills/objectstack-i18n
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
987 | 987 | | |
988 | 988 | | |
989 | 989 | | |
990 | | - | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
991 | 1003 | | |
992 | 1004 | | |
993 | 1005 | | |
| |||
0 commit comments