Skip to content

Commit 254f2ec

Browse files
docs(skills): teach the five-step locale ladder resolveLocaleAmong runs (#30700)
<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} --> _Requested by **Elon** · [project thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DAi5Z7YR39qhBJcWtjJwHtT)_ Fixes #30603 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:`objectstack-i18n` 技能里讲内存兜底语言匹配顺序的那一句,从旧的四步改成代码实际跑的五步,并点名 `resolveLocaleAmong`,给出 `zh-TW` → `zh-Hant` 的例子。 - 为什么改:PR #30601 让两个服务端解析器共用 `resolveLocaleAmong`,在大小写不敏感和基础语言之间加了“平台语言表”一步;旧句子会让 AI 以为 `zh-TW` 落到第一个注册的 `zh-*`(可能是简体)。 - 风险与回滚:只改一句文档加一个 changeset,不动代码;回滚即 revert 本 PR。 - 先看:`skills/objectstack-i18n/SKILL.md` 第 376–379 行那一处 hunk。 - 两分钟验证:`node scripts/check-skills-token-ratchet.mjs | grep objectstack-i18n/SKILL`,预期 5718 tokens(上限 6333,未抬上限)。 - 需要你做的:Tier H(`skills/**`),请在席位契约复核通过后审批合并。 ## What changes `skills/objectstack-i18n/SKILL.md`: the sentence on the in-memory fallback's locale matching now names the ladder `resolveLocaleAmong` (`@objectstack/spec/system`) runs, the one `resolveBundleLocale` also runs, in the code's order: exact, case-insensitive, same platform-table language (`zh-TW` → `zh-Hant`), base language, first registered variant. One root changeset, `'@objectstack/skills': patch`. No other skill text changes; no eval case added (the eval fixtures carry no locale-ladder case, and the card scopes the sentence alone). The five steps are read off `origin/main` `b77c160a`: `packages/spec/src/system/i18n-resolver.ts` (`resolveLocaleAmong`, steps 1 to 5) and its test `resolveLocaleAmong answers the same over a list` (`zh-TW` among `en, zh-CN, zh-Hant` answers `zh-Hant`); core's `resolveLocale` in `packages/core/src/fallbacks/memory-i18n.ts` returns `resolveLocaleAmong` directly. ## Tests Docs-only diff under `skills/**`; no package code or test changes, so no package test or typecheck owed. ## Acceptance notes - Token readings (ceil(utf8 bytes / 4), release-stamp line excluded), whole file: `skills/objectstack-i18n/SKILL.md` 5673 → 5718 tokens (+45), ceiling 6333 unchanged, headroom 660 → 615. Lines 520 → 522; bytes 22712 → 22891. - Whole package: bundle total (whole shipped tree) 226234 → 226279 tokens (+45); all `SKILL.md` files summed 4534 → 4536 lines. - The +45 is paid inside the existing ceiling's headroom; no ceiling raised. The dispatch pins "no other skill text changes", so no same-file deletion elsewhere in the skill was made. ## Verification Every reading below is on head `d9c1c6b4` (base `origin/main` `b77c160a`). - `node scripts/pm/dispatch-gates.mjs --ran`: 44 derived families accounted for, 44 run, 0 NOT-MEASURED, 0 UNRUN; every family exit 0. - `pnpm lint`: exit 0. - `node scripts/check-skills-token-ratchet.mjs`: exit 0; `skills/objectstack-i18n/SKILL.md is 5718 tokens (ceiling 6333; headroom 615)`. - `node scripts/check-commit-card-trailers.mjs --range origin/main..HEAD`: exit 0. - Five families first exited 3 (prerequisite: no dist): `check:doc-formula-expressions`, `check:dts-closure`, `check:dual-build-cjs-loads`, `check:lean-entry-closure`, `check:sourcemap-no-sources-content`. After a whole-tree `turbo run build` under `os-verify-lock.sh` (VERDICT command-exit 0), all five exit 0; those are the recorded codes. <details><summary>Per-family exit codes</summary> ```text node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0 node scripts/check-adr-0087-registration.mjs --self-test :: exit 0 node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0 node scripts/check-closing-keyword-parity.mjs :: exit 0 node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0 node scripts/check-comment-mask-corpus.mjs :: exit 0 node scripts/check-doc-route-spelling.mjs --advisory :: exit 0 node scripts/check-doc-route-spelling.mjs --self-test :: exit 0 node scripts/check-dts-emitted.mjs --self-test :: exit 0 node scripts/check-empty-changeset.mjs --base origin/main :: exit 0 node scripts/check-empty-changeset.mjs --self-test :: exit 0 node scripts/check-skills-token-ratchet.mjs :: exit 0 node scripts/check-skills-token-ratchet.mjs --self-test :: exit 0 node scripts/ci/assert-turbo-remote-cache.mjs --self-test :: exit 0 node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0 node scripts/ci/prune-turbo-cache.mjs --self-test :: exit 0 node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0 node scripts/release-pending-publish.mjs --self-test :: exit 0 pnpm --filter @objectstack/spec run check:skill-docs :: exit 0 pnpm check:agent-test-spelling :: exit 0 pnpm check:changeset-gate-self-tests :: exit 0 pnpm check:ci-filter-parity :: exit 0 pnpm check:closed-ceremony-text :: exit 0 pnpm check:corpus-claim-drift :: exit 0 pnpm check:cross-package-test-inputs :: exit 0 pnpm check:doc-authoring :: exit 0 pnpm check:driver-memory-census :: exit 0 pnpm check:gitlink-declared :: exit 0 pnpm check:merge-driver :: exit 0 pnpm check:nul-bytes :: exit 0 pnpm check:pm-governed-merges :: exit 0 pnpm check:pm-skill-id-lint :: exit 0 pnpm check:published-files :: exit 0 pnpm check:refd-timer-probe :: exit 0 pnpm check:role-word :: exit 0 pnpm check:skill-compatibility :: exit 0 pnpm check:skill-frame-sync :: exit 0 pnpm check:skill-identifier-liveness :: exit 0 pnpm check:watch-hint-literal :: exit 0 pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0 pnpm check:dts-closure :: exit 0 pnpm check:dual-build-cjs-loads :: exit 0 pnpm check:lean-entry-closure :: exit 0 pnpm check:sourcemap-no-sources-content :: exit 0 pnpm lint :: exit 0 ``` </details> --- _Generated by [Claude Code](https://claude.ai/code/session_016WV4czZcAEZpkY6CfBWJY7)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent da9b5f7 commit 254f2ec

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): objectstack-i18n teaches the five-step locale ladder that `resolveLocaleAmong` runs (exact, case-insensitive, same platform-table language, base language, first registered variant), so a `zh-TW` request is taught to reach a registered `zh-Hant` bundle rather than the first `zh-*` one
6+
7+
Clause-②: no
8+
Metadata-protocol: none

‎skills/objectstack-i18n/SKILL.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,10 @@ registers when no i18n plugin is present):
373373
plugins can each contribute their own `objects.*` slice
374374
- **`getLocales()`** / **`setSupportedLocales()`** / **`getDefaultLocale()`** / **`setDefaultLocale()`**
375375

376-
The in-memory fallback additionally resolves locale codes
377-
(exact → case-insensitive → base language `zh-CN` → `zh` → variant `zh` → `zh-CN`).
376+
The in-memory fallback additionally resolves locale codes through `resolveLocaleAmong`
377+
(`@objectstack/spec/system`), the one ladder `resolveBundleLocale` also runs: exact →
378+
case-insensitive → same platform-table language (`zh-TW` → `zh-Hant`) → base language
379+
`zh-CN` → `zh` → first registered variant `zh` → `zh-CN`.
378380

379381
The contract also declares optional methods — `getFieldLabels`, `getCoverage`,
380382
`suggestTranslations` — that **no shipped implementation provides**. Treat them

0 commit comments

Comments
 (0)