Repository navigation
cli: os g prints one hint when the project declares other locales - #39432
Conversation
Claude-Session: https://claude.ai/code/session_016WV4czHUJLmdQAqm4fdDs9 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4czHUJLmdQAqm4fdDs9 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4czHUJLmdQAqm4fdDs9 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 6 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 4 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 41 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 1b58de6336fb3e798218e8ad90cb5a256c6820a8 && git checkout 1b58de6336fb3e798218e8ad90cb5a256c6820a8
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 4eca9da00a30b969a7f4c3681cc842fc4ff8e76d a4c7b5b7da06433bdf5fa3319a8d1e62f6ef89cd && git checkout -B drift-repro 4eca9da00a30b969a7f4c3681cc842fc4ff8e76d && git merge --no-ff a4c7b5b7da06433bdf5fa3319a8d1e62f6ef89cd
node scripts/docs-audit/affected-docs.mjs --json 4eca9da00a30b969a7f4c3681cc842fc4ff8e76d
|
|
repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4czHUJLmdQAqm4fdDs9 Final green head · 2026-12-04T00:11Z · |
|
repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4czzaKz49WLAvKtdyiY 席位核对L1 verdict (L1-b): ACCEPT at head Face: Premise / deps: card's Diff (4 files, +264/−0), read in full:
Accepted gaps: full Lease: files are in seat Generated by Claude Code |
|
repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4czHUJLmdQAqm4fdDs9 Landing · 2026-12-04T00:16Z · head
|
Requested by Elon · project thread
Fixes #39324
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
packages/cli/src/utils/generate-locale-hint.ts:declaredOtherLocales(config)reads the loaded stack the wayos i18n checkreads it (normalizeStackInputthenauthoringRuleUnionStack; source locale throughresolveSourceLocale, i.e.sourceLocale, elsedefaultLocale, elseen; declared locales throughwithGatedDefaultLocaleoversupportedLocales) and answers the declared locales minus the source.reportGenerateLocaleHint(config)prints oneprintInfoline when that set is non-empty, nothing otherwise.packages/cli/src/commands/generate.ts(4,664 lines, so the new concern lives in the sibling module): one import and one call, as the last statement ofrunMetadataGeneration, i.e. only after a successful write. A--dry-run, every refusal and the reach-refusal rollback return or exit before it.en):Labels written in the source locale (en) only; this project also declares zh-Hans, zh-Hant, es and 7 more. Run `os i18n check` to list what is untranslated, and add translations to the stack's `translations` bundles (`os i18n extract` scaffolds them)..changeset/39324-generate-locale-hint.md, patch on@objectstack/cli.Tests
New
packages/cli/test/generate-locale-hint-39324.test.ts(unit tier, in-processGenerate.runin a sandbox project under this package'snode_modules):PLATFORM_LOCALE_TAGSdeclared: exactly one hint line namingen,zh-Hans, zh-Hant, es and 7 more,os i18n checkandtranslations; the tree afterwards is exactly the config,src/objects/index.tsandsrc/objects/note.object.ts(no stub), and the scaffold carrieslabel: 'Note';supportedLocales: ['en']: no line; noi18nblock: no line;--dry-run: nothing written and no line;supportedLocalesminusdefaultLocale;sourceLocaleoutranksdefaultLocaleand a differing users'defaultLocalecounts as declared; source-only stacks and no config answer nothing.Readings at a4c7b5b
vitest run test/generate-locale-hint-39324.test.ts:Tests 8 passed (8), VERDICT command-exit 0.scripts/ablation-replace.mjs, call line ingenerate.tsdeleted, mutation landed blob 11b7cfbf to ea314788, restored to HEAD):Tests 1 failed | 7 passed (8), the failing case is the every-locale one.vitest run --project unitover the generate-related unit files (commands.test.tsincluded; the spawning ones are integration tier):Test Files 14 passed (14),Tests 368 passed (368).pnpm --filter @objectstack/cli typecheck: exit 0 (check:test-typecheck: OK).packages/cliunit tier: NOT MEASURED, reason: did not finish inside the 570 s foreground window on the shared box; Test Core runs it.Acceptance notes
i18n.supportedLocales(plus the gated users'defaultLocale). A project with translation bundles but noi18nblock gets no line, althoughos i18n checkwould gate the bundle locales there; the card scopes the hint to declared locales.os i18n checkcompares them; a project declaringzh-CNseeszh-CNnamed.os ghas no--jsonmode, so the line goes to stdout with the command's other output.Verification
First read:
packages/cli/src/utils/generate-locale-hint.ts(declaredOtherLocales), then the one-call hunk at the end ofrunMetadataGenerationingenerate.ts.Two-minute check: in a project whose
objectstack.config.tsdeclaresi18n: { defaultLocale: 'en', supportedLocales: ['en', 'zh-Hans'] }, runos g object note; expect the usual Created lines and one info line ending in "this project also declares zh-Hans. Runos i18n check...". WithsupportedLocales: ['en'], no such line.Generated by Claude Code