You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 02a290f
Browse filesBrowse the repository at this point in the historyBrowse files
feat(examples): dataset members carry a business description and its bundle translations (#34953)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBLW6dHPW6sSheA32XPKZzPV)_Fixes#34873
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么**:app-todo 与 app-showcase 的全部 39 个数据集成员(维度与度量)各加一句业务
`description`,并在各应用已有的非英文语言包里补上对应译文(app-todo:zh-CN、ja-JP;app-showcase:zh-CN)。
- **为什么改**:示例是作者照抄的样板;此前成员只有 `synonyms`,抄过去只学到一半词汇。现在与 app-crm 的写法一致。
- **风险与回滚**:仅示例元数据与译文、外加两处示例测试,不发布任何包;回滚即 revert 本 PR。
-
**先看**:`examples/app-showcase/src/ui/datasets/revenue-pulse.dataset.ts`(`total_home_sum`
与 `revenue_sum`
的业务口径)、`examples/app-todo/src/datasets/task.dataset.ts`、`examples/app-showcase/src/system/translations/index.ts`
的 zh-CN `datasets` 段。
- **两分钟验证**:`pnpm check:i18n-coverage`,预期输出 `OK (14 config(s), 423
baselined untranslated string(s), none new)`。
- **需要你做的**:无,席位落地。
## What changes
- **`examples/app-todo/src/datasets/task.dataset.ts`**: all 9 members (6
dimensions, 3 measures) of `todo_task_metrics` gain a one-sentence
business `description`, in the pattern of
`examples/app-crm/src/datasets/opportunity.dataset.ts` (a plain business
definition, not an instruction to a model).
-
**`examples/app-showcase/src/ui/datasets/{chart-gallery,revenue-pulse}.dataset.ts`**:
all 30 members of `showcase_task_metrics` (10),
`showcase_project_metrics` (6), `showcase_invoice_metrics` (8) and
`showcase_account_metrics` (6) gain the same. The one-line member
literals that now carry a description are unfolded to one key group per
line.
- **Bundle translations**, at the key the i18n walk and resolver read,
`datasets.NAME.{dimensions,measures}.MEMBER.description` (verified in
`packages/lint/src/i18n-walk.ts` and the spec's `datasets` translation
schema; the same shape app-crm uses), in every non-source locale each
app already carries: app-todo `zh-CN.ts` and `ja-JP.ts` (18 entries),
app-showcase `zh-CN` (30 entries, merged into the existing `datasets`
block beside its labels). Hand-written translations, terms aligned with
each bundle's existing field and option labels. `en` gets no entry: it
is the source locale, read from the dataset itself, and app-crm carries
none either.
- **Pins** (into the existing harness files, as top-level `describe`s):
`examples/app-todo/src/translations/translation-completeness.test.ts`
asserts each member declares a description and that zh-CN and ja-JP
carry a translated one that is not the English;
`examples/app-showcase/test/zh-cn-chart-gallery-measure-labels.test.ts`
runs the app's four datasets through `translateMetadataDocument` and
asserts every member authors a description and is served a Chinese one
under zh-CN.
## Tests
All readings at head `a7d31949`.
- **i18n-coverage baseline: unchanged, 106 → 106 (app-todo) and 317 →
317 (app-showcase).** `pnpm check:i18n-coverage` exit 0: `OK (14
config(s), 423 baselined untranslated string(s), none new)`. The card's
estimate of 106 → 124 is the count with the descriptions authored but
*untranslated* (9 members × 2 locales = 18); each new description is
translated in every non-source locale here, so the ratchet does not move
and `scripts/i18n-coverage-baseline.json` is not edited. Control leg (to
show the gate actually sees description keys): with the 9 zh-CN
descriptions removed from app-todo, `os lint --json` reports
`datasets.todo_task_metrics.*.description` missing for zh-CN; restored
from `HEAD` (hash matches the HEAD blob, `git diff HEAD` empty). At
head, `os lint --json` reports zero dataset `description` findings for
either app. The remaining dataset findings are the pre-existing
untranslated member *labels* (18 in app-todo, 25 in app-showcase),
already in the frozen baseline.
- `pnpm --filter @objectstack/example-todo validate` / `typecheck` /
`test`: exit 0 / 0 / 0 (Test Files 9/9, Tests 267/267).
- `pnpm --filter @objectstack/example-showcase validate` / `typecheck` /
`test`: exit 0 / 0 / 0 (Test Files 48/48, Tests 549/549). `Validation
passed`. Neither app's validate prints any
`dataset-member-no-vocabulary` or other dataset finding.
- `eslint --no-inline-config` on the 8 changed files: exit 0.
<details><summary>Ablation of the two new pins (one per pin, via
scripts/ablation-replace.mjs; restored to HEAD and verified)</summary>
- Showcase: deleted the zh-CN `paid_count` description line. Result: `1
failed | 5 passed (6)`, `showcase_invoice_metrics.paid_count serves no
zh-CN description`. Restored: `blob == HEAD (bf9a9f1) and git diff
HEAD is empty`.
- Todo: replaced the ja-JP `priority` description with the English text.
Result: `1 failed | 92 passed (93)`, the not-the-English assertion.
Restored: `blob == HEAD (495ea54) and git diff HEAD is empty`.
- No rebuild needed: both suites import the example sources by relative
path; the only dist import (`@objectstack/spec`) is untouched by the
diff.
</details>
## Acceptance notes
- **Changeset: none, and `skip-changeset` is requested on create.** Both
`@objectstack/example-todo` and `@objectstack/example-showcase` are
`private: true`; the diff publishes nothing from any released package
(the private-package fast lane).
- The dataset member **labels** in both apps stay untranslated in
zh-CN/ja-JP, as before; they are pre-existing baselined debt (the
showcase bundle's own comment says so) and out of this card's scope,
which is the description entries.
- The descriptions state each member's business scope (for example, that
counts and sums cover every status, that `total_home_sum` is converted
into the home currency, and that `revenue_sum` is each account company's
own annual revenue, not what it is billed). They introduce no number or
rule that the metadata does not already carry.
## Verification
<details><summary>Derived gate families (dispatch-gates --commands, 42
families), run locally at a7d3194</summary>
- 41 exit 0, including `check:i18n-coverage`, `check:nul-bytes`,
`check:examples-live-imports`, `check:cross-package-test-inputs`,
`check:test-source-alias`, `check:type-check-coverage`,
`check:type-check-debt`, `check:published-files`.
- NOT MEASURED: `check:dual-build-cjs-loads`, reason: exit 3
`PREREQUISITE NOT MET` (it reads every package's built `dist/`, and only
the CLI and the two examples' closures were built here). CI runs it on
this PR.
- `dispatch-gates --ran` reconciliation: `42 derived, 41 run, 1
NOT-MEASURED, 0 UNRUN`, derived from the recorded exit codes.
</details>
<details><summary>overlap-check</summary>
`overlap-check: ... changes 8 file(s); against origin/main (c81f498)
and 0 PR head(s)` · `origin/main: merges cleanly` · `VERDICT clean exit
0`.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzg1NmbJpZhtiWQkTir)_
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzg1NmbJpZhtiWQkTir -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments