Repository navigation
Commit 95f818d
fix(spec): a translation item is named in snake_case, the locale tag goes in
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBGfQhhK2rkH91cc4DbNzUXk)_
Fixes #26128
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:翻译条目 `name` 的说明改为 snake_case(如 `zh_cn`),语言标签写在 `locale`;不再建议用
`zh-CN` 作条目名。保存门与读侧回退行为不变。
- 为什么改:旧说明叫作者用 `zh-CN` 命名,而保存门的条目名语法拒收它(400
INVALID_REQUEST),照规范写的作者第一次保存必失败。
- 风险与回滚:仅文案与一条门禁测试,无接受集变化;回滚即 revert 本 PR。
- 先看:`packages/spec/src/system/translation.zod.ts`(name 的 describe
与上方注释)、`packages/metadata-protocol/src/protocol.item-name-grammar.test.ts`(新增
#26128
段)、`packages/core/src/fallbacks/authored-translation-sync.ts`(跳过警告文案)。
- 两分钟验证:`pnpm --filter @objectstack/metadata-protocol exec vitest run
src/protocol.item-name-grammar.test.ts`,预期 27/27 通过,其中 `zh-CN`
被拒、`zh_cn` + `locale: 'zh-CN'` 保存成功。
- 需要你做的:无,席位落地。
## What changes
- `TranslationItemSchema.name` describe: `Item name — snake_case like
every metadata item (e.g. \`zh_cn\`); the BCP-47 tag goes in
\`locale\``. The comment above it now says the same and that the
tag-shaped `row.name` fallback covers only rows stored before `locale`
became required.
- `content/docs/references/system/translation.mdx`: the generated `name`
row, regenerated with `gen:schema` + `gen:docs`.
- `authored-translation-sync.ts`: the no-locale skip warning now says
`set the top-level 'locale' to its BCP-47 tag, e.g. 'zh-CN'` instead of
suggesting the item be named after the tag. Behaviour unchanged (the
existing test matches `no resolvable locale`).
- Door pin (`protocol.item-name-grammar.test.ts`): `saveMetaItem` of
type `translation` named `zh-CN` is refused with `code:
INVALID_REQUEST`, `status: 400` and the grammar message, persisting
nothing; `zh_cn` with `locale: 'zh-CN'` saves and keeps the tag in
`locale`.
- `refuseUngrammaticalMetaItemName` and the read-side fallback are
untouched.
- Docs, skills and examples grep (`conventionally the locale`, `name the
item after`, a `name: 'zh-CN'` translation item): no hits outside the
files above.
- Changeset: `'@objectstack/spec': patch`, `'@objectstack/core': patch`
(the sync warn text).
- `packages/objectql/src/protocol-publish-canonical-fold.test.ts` (about
line 269): the test-helper comment now says the name is snake_case
(`zh_cn`) with the tag in `locale`; its fixture already used `zh_cn`.
Added in patch round r1 (claim surface amended 15:13Z).
## Tests
Tests ran on `33a1af012`; head `f308adfc4` is that commit plus a merge
of `origin/main` (`a485b5a3e`) that touches none of these files.
- `metadata-protocol` `protocol.item-name-grammar.test.ts`: 27/27 (25
existing + 2 new).
- `spec` `src/system/translation.test.ts`: 182/182. `core`
`src/fallbacks`: 67/67. `service-i18n` `authored-translations.test.ts`:
16/16.
- `metadata-protocol` full suite: 269 files passed, 3 skipped; 21582
tests passed, 19 skipped.
- r1, on `ad3a211fe`: `objectql`
`protocol-publish-canonical-fold.test.ts` 10/10.
## Acceptance notes
- `packages/spec/src/system/translation.test.ts` (about line 757) parses
a schema-level item named `zh-CN`; the schema does not constrain `name`,
so this stays valid at the schema and is not a door fixture. Left as is.
## Verification
- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack`: 106 derived families, run serially on
`33a1af012`. 102 exited 0 on the first pass; 4 exited 3 (prerequisite:
built output) and exited 0 after a full `pnpm turbo run build`
(`check:skill-examples`, `check:dual-build-cjs-loads`,
`check:i18n-walk-parity`, `check:lean-entry-closure`).
- `--ran` reconciliation: `106 derived famil(ies) accounted for — 106
run, 0 NOT-MEASURED`. The derived list on head `f308adfc4` is
byte-identical to the one on `33a1af012`.
- After the `os-regen-merge.sh` merge, on `f308adfc4`: spec build +
`gen:schema` + `gen:docs` left the tree clean; `check:generated`,
`check:docs`, `check:authorable-surface` exit 0.
- r1, head `ad3a211fe` (comment + changeset only): the derived list grew
to 107 (`check-engine-split-ratio.mjs --self-test` added). The 23
families reading the changeset, objectql tests or repo-wide text were
re-run on `ad3a211fe`, all exit 0; `--ran` over the merged record: `107
derived famil(ies) accounted for — 107 run, 0 NOT-MEASURED`.
- Full dogfood: not owed (no `!` in the title, no narrowing arm).
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzhKYT8L13Bgj8icT3i)_
---------
Co-authored-by: Claude <noreply@anthropic.com>locale (#26769)1 parent e9e344a commit 95f818d
6 files changed
Lines changed: 50 additions & 10 deletions
File tree
- .changeset
- content/docs/references/system
- packages
- core/src/fallbacks
- metadata-protocol/src
- objectql/src
- spec/src/system
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
746 | 746 | | |
747 | 747 | | |
748 | 748 | | |
749 | | - | |
| 749 | + | |
750 | 750 | | |
751 | 751 | | |
752 | 752 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
| 195 | + | |
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
268 | | - | |
269 | | - | |
| 268 | + | |
| 269 | + | |
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2267 | 2267 | | |
2268 | 2268 | | |
2269 | 2269 | | |
2270 | | - | |
2271 | | - | |
2272 | | - | |
2273 | | - | |
2274 | | - | |
2275 | | - | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
2276 | 2279 | | |
2277 | 2280 | | |
2278 | 2281 | | |
| |||
0 commit comments