Skip to content

cli: os g prints one hint when the project declares other locales - #39432

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-39324-wip
Dec 4, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-39324-wip

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread

Fixes #39324

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:开发者在声明了多种语言的项目里用生成命令新建对象、视图等之后,会多看到一行提示:标签只写了源语言,请运行翻译检查命令,并说明翻译写在哪里;单语言项目看不到这行。
  • 为什么做:落实"模板携带全部平台语言、生成器只写源语言"的裁决,让开发者知道其他语言还没翻译,而不是悄悄留下缺口。
  • 出错会怎样:最坏情况是提示该出现时没出现或多出现一行,不会写入或改动任何文件;改动可直接撤回。
  • 要你做什么:无。

What changes

  • New module packages/cli/src/utils/generate-locale-hint.ts: declaredOtherLocales(config) reads the loaded stack the way os i18n check reads it (normalizeStackInput then authoringRuleUnionStack; source locale through resolveSourceLocale, i.e. sourceLocale, else defaultLocale, else en; declared locales through withGatedDefaultLocale over supportedLocales) and answers the declared locales minus the source. reportGenerateLocaleHint(config) prints one printInfo line 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 of runMetadataGeneration, i.e. only after a successful write. A --dry-run, every refusal and the reach-refusal rollback return or exit before it.
  • The line (with all 11 platform locales declared, source 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).
  • No translation stub is written (the card's ruling: coverage counts any string as translated).
  • Changeset .changeset/39324-generate-locale-hint.md, patch on @objectstack/cli.

Tests

New packages/cli/test/generate-locale-hint-39324.test.ts (unit tier, in-process Generate.run in a sandbox project under this package's node_modules):

  • all 11 PLATFORM_LOCALE_TAGS declared: exactly one hint line naming en, zh-Hans, zh-Hant, es and 7 more, os i18n check and translations; the tree afterwards is exactly the config, src/objects/index.ts and src/objects/note.object.ts (no stub), and the scaffold carries label: 'Note';
  • supportedLocales: ['en']: no line; no i18n block: no line; --dry-run: nothing written and no line;
  • reader cases: supportedLocales minus defaultLocale; sourceLocale outranks defaultLocale and a differing users' defaultLocale counts 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.
  • Ablation (scripts/ablation-replace.mjs, call line in generate.ts deleted, 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 unit over the generate-related unit files (commands.test.ts included; 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).
  • Full packages/cli unit tier: NOT MEASURED, reason: did not finish inside the 570 s foreground window on the shared box; Test Core runs it.

Acceptance notes

  • "Declared" means i18n.supportedLocales (plus the gated users' defaultLocale). A project with translation bundles but no i18n block gets no line, although os i18n check would gate the bundle locales there; the card scopes the hint to declared locales.
  • Locales are compared as written, as os i18n check compares them; a project declaring zh-CN sees zh-CN named.
  • os g has no --json mode, 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 of runMetadataGeneration in generate.ts.

Two-minute check: in a project whose objectstack.config.ts declares i18n: { defaultLocale: 'en', supportedLocales: ['en', 'zh-Hans'] }, run os g object note; expect the usual Created lines and one info line ending in "this project also declares zh-Hans. Run os i18n check ...". With supportedLocales: ['en'], no such line.


Generated by Claude Code

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/cli, touching 7 documentable anchor(s).

6 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/deployment/cli.mdx (via os generate (command, read off packages/cli/src/commands/generate.ts))
  • content/docs/deployment/validating-metadata.mdx (via os generate (command, read off packages/cli/src/commands/generate.ts))
  • content/docs/getting-started/build-with-claude-code.mdx (via os generate (command, read off packages/cli/src/commands/generate.ts))
  • content/docs/getting-started/your-first-project.mdx (via os generate (command, read off packages/cli/src/commands/generate.ts))
  • content/docs/protocol/kernel/lifecycle.mdx (via os generate (command, read off packages/cli/src/commands/generate.ts))
  • content/docs/protocol/objectql/types.mdx (via os generate (command, read off packages/cli/src/commands/generate.ts))

⛔ 4 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-4.mdx (via os generate (command, read off packages/cli/src/commands/generate.ts))
  • content/docs/releases/v17/17-5.mdx (via os generate (command, read off packages/cli/src/commands/generate.ts))
  • content/docs/releases/v17/17-7.mdx (via os generate (command, read off packages/cli/src/commands/generate.ts))
  • content/docs/releases/v18/18-4.mdx (via os generate (command, read off packages/cli/src/commands/generate.ts))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 71 of 256 client-bound route-ledger rows — the other 185 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 185: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 60 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 125 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 41 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 4eca9da00a30b969a7f4c3681cc842fc4ff8e76d → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 1b58de6336fb3e798218e8ad90cb5a256c6820a8 — the merge of head a4c7b5b7da06433bdf5fa3319a8d1e62f6ef89cd into base 4eca9da00a30b969a7f4c3681cc842fc4ff8e76d, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# 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

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 4eca9da00a30b969a7f4c3681cc842fc4ff8e76d → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4czHUJLmdQAqm4fdDs9

Final green head · 2026-12-04T00:11Z · a4c7b5b7da06433bdf5fa3319a8d1e62f6ef89cd · every check-run green or expected skip (41 success, 20 skipped). L1 requested from the seat's L1-b thread at this head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4czzaKz49WLAvKtdyiY

席位核对

L1 verdict (L1-b): ACCEPT at head a4c7b5b7da (Fixes #39324, p2). Read at 2026-12-04T00:14Z.

Face: l1-face --pr 39432 CLEAN — 13 read, none flagged. Check-runs at a4c7b5b7da: 41 success · 20 expected skip · 0 failed · 0 pending. Floor checks success. Dogfood not owed. Draft, base main, Fixes #39324 only.

Premise / deps: card's Blocked-by: #39320 is closed (completed). Ruling (Bill, record on #38456): generators write the source language only, completeness is os i18n check's, no stubs, #21325 pin unchanged — the diff honours all four (no stub written, asserted by the tree check; generate-scaffold-gates.e2e.test.ts untouched).

Diff (4 files, +264/−0), read in full:

  • generate.ts (4,664 lines): +2 only, one import and one call as the last statement of runMetadataGeneration, so dry-run and refusals return before it. New concern in a sibling module — the >2,000-line rule is met, not crossed.
  • generate-locale-hint.ts reuses resolveSourceLocale / withGatedDefaultLocale from utils/i18n-coverage.ts:644,682 and authoringRuleUnionStack, i.e. the readers os i18n check uses; no second locale rule.
  • Test: in-process Generate.run; every-locale case asserts exactly one line and the exact file tree; single-locale, no-i18n and --dry-run assert no line. Ablation of the call line turns the every-locale case red (in body).
  • Changeset read sentence by sentence: patch on @objectstack/cli; each bullet matches the code (declared-locale reading, the three silent cases, no stub).

Accepted gaps: full packages/cli unit tier NOT MEASURED locally; CI Test Core is green on this head and covers it. Acceptance note (bundles without an i18n block get no line) is within the card's "declares" scope — no card owed.

Lease: files are in seat repo:objectstack@os-justin's packages/cli/** lease; the claim records the file-level clearance and check-handover --inflight read no overlap. Non-governed, under 3000 lines: zone lands.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4czHUJLmdQAqm4fdDs9

Landing · 2026-12-04T00:16Z · head a4c7b5b7da · L1-b ACCEPT 7396561154

reading result
check-governed-merges.mjs --pr 39432 NOT governed
check-runs at head 41 success · 20 expected skip · 0 failed
State: ready + auto-merge.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review December 4, 2026 00:17
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Dec 4, 2026
Merged via the queue into main with commit 55d673c Dec 4, 2026
62 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-39324-wip branch December 4, 2026 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cli: os g prints one hint when the project declares other locales (source label written; run os i18n check)

2 participants