Skip to content

feat(spec): Studio metadata-form select choices are translatable (metadataForms options slot) - #37569

Draft
objectstack-fleet[bot] wants to merge 4 commits into
mainfrom
claude/project-thread-gvxx96
Draft

objectstack-fleet[bot] wants to merge 4 commits into
mainfrom
claude/project-thread-gvxx96

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread

Fixes #36950

Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: none — skills/objectstack-i18n/SKILL.md names the metadataForms group only, never its leaf keys; the group is platform-owned, so no app author writes the new key

维护者速读

  • 用户能看到什么变化:非英文的搭建者在 Studio 里打开对象、字段、报表、仪表盘、钩子、动作、页面、智能体、技能的配置表单时,下拉框里的选项名(例如共享模型「私有 — 仅所有者」、字段类型、删除行为、默认时间段)改为显示当前语言;以前这些选项在所有语言下都是英文,周围的字段名却已经翻译。
  • 为什么做:翻译包里没有放选项名的位置,服务端也不翻译它们。
  • 出错会怎样:只多翻译一层显示文字,选项的值不变,保存下来的数据不变;某个选项没有译文时仍显示原来的英文。
  • 要你做什么:这个 PR 改动约 3,790 行(主要是 10 种语言的译文),超过 3,000 行,按规则需要授权审批人批准后由座位落地。

What changes

The reading the card asked for (at 021524cd, METADATA_FORM_REGISTRY walked with the extractor's path rule): of the 18 registered Studio forms, 9 carry a select row with options — object, field, hook, report, dashboard, action, page, agent, skill — 38 rows, 187 options (185 distinct type.path.value keys: object's fields.deleteBehavior is listed twice, with the same names). Every one is seen by a builder: the console's SchemaForm renders fieldSpec.options ahead of the schema enum (ui/packages/app-shell/src/views/metadata-admin/SchemaForm.tsx, the enum/select branch), and the server translated only label, helpText and placeholder of a form field.

  • Spec, translation slot (packages/spec/src/system/translation.zod.ts). A metadataForms.<type>.fields.<path> entry accepts options: a record from option value to its translated name, the shape objects.<object>.fields.<field>.options already has. choices and values are its aliases, as on the object-field face.
  • Spec, resolver (packages/spec/src/system/i18n-resolver.ts). translateFormField overlays each options[] entry's label with the translation keyed by its value, along the locale chain; an option with no translation, or with a non-string value, is passed through unchanged. This is the walker resolveMetadataFormLabels uses, which /api/v1/meta/types localizes served forms with.
  • Lint, extractor (packages/lint/src/i18n-walk.ts). walkFormField emits metadataForms.<type>.fields.<path>.options.<value> for every option of a row, seeded with its English label, so os i18n extract and pnpm check:i18n offer exactly the keys the resolver reads.
  • Platform-objects, shipped locales. node scripts/check-i18n-bundles.mjs --write added the 185 keys to all eleven *.metadata-forms.generated.ts packs; the ten translated packs then got hand-written names (ar, de, es-ES, fr, ja-JP, ko, pt-BR, ru, zh-CN, zh-Hant) and a second --write dropped every source-hash row they had seeded. The 17 Default Period choices take the wording of the console's own period chip (ui/packages/i18n/src/locales/*, dashboard.filters.range.* and dashboard.filters.custom), so the period an author picks reads as the period a viewer sees. Loanwords that read the same as English (URL, HTML, JSON, Markdown, and per locale words such as de Text, fr Date) are spelled so they are not byte-echoes of the source, which the catalog's zero-echo pins require (object-lifecycle-panel-echo-decisions.test.ts, report-form-echo-decisions.test.ts): for example zh-CN 网址(URL), de Textfeld, fr Date (sans heure).
  • content/docs/references/system/translation.mdx regenerated (gen:docs).

Small calls made here (no card): the alias pair choices / values mirrors the object-field face; a non-string option value is passed through untouched rather than stringified, since every option a registered form lists has a string value (the reading found none other).

Why

A non-English builder saw a translated field label with English choices under it on every server-rendered Studio form. The bundle had no slot for the names, so no locale could fix it.

Verification

  • packages/spec/src/system/i18n-resolver.test.ts, new top-level describe "select option names": a choice is renamed by its value and keeps its other keys; a value with no translation keeps its English label; a nested repeater row is reached by its dot path; the input form is not mutated.
  • packages/platform-objects/src/metadata-translations/form-option-labels.test.ts (new): through the SERVED bundle and the real registry, the object form's sharing model reads 私有 — 仅所有者 in zh-CN; the reading floor (≥30 option rows over ≥8 forms) holds; for each of the ten translated locales every choice of every form select has a non-empty name that differs from its English label.
  • Local runs on this branch: packages/spec full suite green (vitest, 618 s); packages/lint 236 files / 9,680 tests green; packages/platform-objects translations + metadata-translations 29 files green; packages/cli test/i18n-extract.test.ts green; node scripts/check-i18n-bundles.mjs exit 0; pnpm check:i18n-coverage could not measure here (exit 3: the example apps are not built in this worktree), so CI carries that one; pnpm --filter @objectstack/spec check:generated exit 0 after gen:docs.
  • node scripts/pm/overlap-check.mjs exit 0 against origin/main and the open PRs sharing these files (feat(spec)!: form is a metadata type of its own, and the form doors read a form over both types #37422, refactor(spec)!: rename the Studio helper defineForm to defineMetadataForm and its modules to *.metadata-form.ts #37366).

Contract review (L2) is owed before landing: the diff changes packages/spec/src/** and declares Clause-②: yes (widening). Changed lines exceed 3,000, so landing needs an authorized approval.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L6bhgUpnvPnJ1hR74pUrVj


Generated by Claude Code

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

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/lint, @objectstack/platform-objects, @objectstack/spec, touching 18 documentable anchor(s).

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

  • content/docs/api/error-catalog.mdx (via helpText (literal, a string literal in appTranslationDataShape))
  • content/docs/automation/flows.mdx (via helpText (literal, a string literal in appTranslationDataShape))
  • content/docs/protocol/kernel/i18n-standard.mdx (via helpText (literal, a string literal in appTranslationDataShape), metadataForms (literal, a string literal in walkFormField))
  • content/docs/protocol/objectui/actions.mdx (via helpText (literal, a string literal in appTranslationDataShape))
  • content/docs/protocol/objectui/layout-dsl.mdx (via helpText (literal, a string literal in appTranslationDataShape))
  • content/docs/ui/translations.mdx (via helpText (literal, a string literal in appTranslationDataShape), metadataForms (literal, a string literal in walkFormField))
  • content/docs/ui/views.mdx (via helpText (literal, a string literal in appTranslationDataShape))

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

  • content/docs/releases/v17/17-5.mdx (via helpText (literal, a string literal in appTranslationDataShape))
  • content/docs/releases/v18/18-2.mdx (via helpText (literal, a string literal in appTranslationDataShape))
  • content/docs/releases/v18/18-3.mdx (via helpText (literal, a string literal in appTranslationDataShape), metadataForms (literal, a string literal in walkFormField))
  • content/docs/releases/v18/18-4.mdx (via helpText (literal, a string literal in appTranslationDataShape))

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
  • 8 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 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 — 177 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 411646562566a1e12b4e0fc3de256192e8302719 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 2f884875451523b240e3c26a799abcd62a6b535d — the merge of head 8f1f70ffa5c34c3c708669cbf2ccf73ddbfdf324 into base 411646562566a1e12b4e0fc3de256192e8302719, 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 2f884875451523b240e3c26a799abcd62a6b535d && git checkout 2f884875451523b240e3c26a799abcd62a6b535d
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 411646562566a1e12b4e0fc3de256192e8302719 8f1f70ffa5c34c3c708669cbf2ccf73ddbfdf324 && git checkout -B drift-repro 411646562566a1e12b4e0fc3de256192e8302719 && git merge --no-ff 8f1f70ffa5c34c3c708669cbf2ccf73ddbfdf324

node scripts/docs-audit/affected-docs.mjs --json 411646562566a1e12b4e0fc3de256192e8302719

⚠️ 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 411646562566a1e12b4e0fc3de256192e8302719 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

This branch has not been deployed

No deployments
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 protocol:system size/xl 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.

Spec 表单的选项名(options[].label)没有 metadataForms 翻译槽位:服务端下发的表单里选项名在所有语言下都是英文

2 participants