Repository navigation
Commit af3873b
docs(spec): a form section's translation TSDoc names both addresses — objects.OBJECT._sections for an object form view, metadataForms for a metadata form (#23815)
Fixes #23756
Clause-②: no
## What changed
These are TSDoc and comment edits only, at the three locations the card
and comment `6205162974` name, plus a fourth docblock the seat's review
found (item 4). No `.describe()` text, schema or code changes. Measured
at base `74b436263`.
1. **`packages/spec/src/ui/view.zod.ts`, `FormSectionSchema.name`.** The
TSDoc named one address, `metadataForms.TYPE.sections.NAME`. It now
names both addresses and which form each one serves:
- **Object-bound form view:** `objects.OBJECT._sections.NAME`. OBJECT is
the form's own `data.object`, else its view's. The i18n extractor
(`walkObjectSections`) scaffolds the key, the translation linter
(`collectViewRecord`) accepts it, and `translateView` serves it. A
section without a `name` has no key and keeps its authored text.
- **Metadata-editing form** (`defineForm({ schemaId })`):
`metadataForms.TYPE.sections.NAME`, read by `resolveMetadataFormLabels`.
A nameless section is looked up there under a slug of its `label`.
The group-key comment on the same schema (the `:3862` site) also named
`metadataForms.…` as the anchor. A section's `group` points at an
object's `fieldGroups`, so its key is `deriveFieldGroupLayout`'s `key`
at `objects.OBJECT._sections.KEY`, as `field-group-layout.ts` declares.
The comment now says that.
2. **`packages/spec/src/system/translation.zod.ts`, `_sections`.** The
TSDoc named `record:details` as the only reader. It now names:
- the three authoring surfaces that put a name under this key: form-view
`sections[].name`, `record:details` `sections[].name`, and object
`fieldGroups[].key`;
- the three readers on `main`: `walkObjectSections`, which scaffolds the
key from all three; `collectViewRecord`, which accepts a form view's
names; and `translateView`, which overlays a served form view's
`config.sections`;
- the `description` leaf, which the schema already declares;
- the metadata-form address, which is a different key.
3. **`packages/spec/src/system/i18n-resolver.ts`,
`translateFormSections`.** The docblock said "Three rules, each the one
its sibling translators already follow". It now says that rules 1 (own
`name` key) and 3 (a diverged string beats the catalog) are shared with
`translateBulkActionDefs`, and that rule 2 (only authored copy is
translated) belongs to sections alone. `resolveViewDescription` returns
a catalog description the view never authored, and
`translateBulkActionDefs` has no authored-copy guard.
4. **`packages/spec/src/system/i18n-resolver.ts`,
`resolveMetadataFormLabels`** (patch round, head `e7ac53b9a1`). The
docblock said a section without a stable `name` keeps its section-level
text, which contradicted item 1's new text and the function's own
`translateSection`. It now says what the code does: the lookup key is
the section's `name`, else a slug of its string `label` (lowercased, `&`
→ `and`, each run of non-alphanumerics → `_`, edge underscores trimmed).
Only a section with neither keeps its section-level text, and its fields
are translated either way. The changeset gained one sentence for it.
Every reader named above was found by its function name on `main` at
`74b436263`:
- `walkObjectSections`: `packages/cli/src/utils/i18n-extract.ts:914`
- `collectViewRecord`:
`packages/lint/src/validate-translation-references.ts:484`
- `translateView` and `translateFormSections`: `i18n-resolver.ts`
- `resolveMetadataFormLabels`: `i18n-resolver.ts:3926`
- `defineForm`: `view.zod.ts:7145`
The card body also lists objectui's form renderers as a reader. This
repo does not contain them, so the new text does not name them as a
reader.
## Changeset: `patch`, not `skip-changeset`
The dispatch hypothesis was that comments do not publish. That was
measured false for this diff:
- `@objectstack/spec`'s `files[]` includes `src/**/*.zod.ts` and `dist`.
- After `pnpm --filter @objectstack/spec build`, the new `view.zod.ts`
text ("one of two addresses, decided by what the form edits") and the
new `translation.zod.ts` text ("Three authoring surfaces name a section
under this key") both appear in `dist/**` bundles. The
`i18n-resolver.ts` text appears only in `src`.
- Positive control: unchanged TSDoc from the same docblock is also
present in `dist/**`.
So the diff publishes text, and
`.changeset/23756-section-translation-tsdoc.md` is a `patch` for
`@objectstack/spec`. The `skip-changeset` label is not applied.
## Generated artifacts
None carry this text. `git grep` for each replaced sentence returns zero
hits after the edit. `check:docs` ran green against the rebuilt `dist`.
## Verification (head `58c3d6070f`; the patch round's re-runs at
`e7ac53b9a1` are in report `6208324935`)
- `pnpm --filter @objectstack/spec run typecheck` passes.
- `vitest run src/system/i18n-resolver.test.ts
src/system/translation.test.ts src/ui/view.test.ts`: 3 files, 974 tests
passed.
- `node scripts/pm/dispatch-gates.mjs --commands` derived 79 families;
78 ran and exited 0.
- `pnpm check:dual-build-cjs-loads` exited 3, which means its
prerequisite was not met: it needs every workspace package's `dist`, and
only spec's build closure was built here. It is NOT MEASURED locally and
is left to CI.
- `--ran` reconciliation: "79 derived famil(ies) accounted for — 78 run,
1 NOT-MEASURED".
## Acceptance notes
- `check-plugin-teardown-shape --self-test` needs the full history,
because its positive control is pinned to a commit. It ran green after
`git fetch --unshallow`.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01RD4nZChNGxRzyyWJtvZ8NJ)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 59f9763 commit af3873b
4 files changed
Lines changed: 48 additions & 10 deletions
File tree
- .changeset
- packages/spec/src
- system
- ui
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1052 | 1052 | | |
1053 | 1053 | | |
1054 | 1054 | | |
1055 | | - | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
1056 | 1060 | | |
1057 | 1061 | | |
1058 | 1062 | | |
| |||
3912 | 3916 | | |
3913 | 3917 | | |
3914 | 3918 | | |
3915 | | - | |
3916 | | - | |
3917 | | - | |
| 3919 | + | |
| 3920 | + | |
| 3921 | + | |
| 3922 | + | |
| 3923 | + | |
| 3924 | + | |
| 3925 | + | |
3918 | 3926 | | |
3919 | 3927 | | |
3920 | 3928 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
395 | | - | |
396 | | - | |
397 | | - | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
398 | 408 | | |
399 | 409 | | |
400 | 410 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3676 | 3676 | | |
3677 | 3677 | | |
3678 | 3678 | | |
3679 | | - | |
3680 | | - | |
| 3679 | + | |
| 3680 | + | |
| 3681 | + | |
| 3682 | + | |
| 3683 | + | |
| 3684 | + | |
| 3685 | + | |
| 3686 | + | |
| 3687 | + | |
| 3688 | + | |
| 3689 | + | |
| 3690 | + | |
| 3691 | + | |
| 3692 | + | |
3681 | 3693 | | |
3682 | 3694 | | |
3683 | 3695 | | |
| |||
3859 | 3871 | | |
3860 | 3872 | | |
3861 | 3873 | | |
3862 | | - | |
| 3874 | + | |
| 3875 | + | |
3863 | 3876 | | |
3864 | 3877 | | |
3865 | 3878 | | |
| |||
0 commit comments