Repository navigation
Commit 91dff12
fix(app-shell): the translation preview names a global action by its label (objectui#11755) (#11763)
Fixes #11755
Clause-②: no
The translation designer's preview drew every spec-valid `globalActions`
entry as `NAME[object Object]`. It now shows the action node's `label`,
quoted as a flat string is, and the node's key count when the node has
no `label`.
## What changed
- `TranslationPreview`: the `globalActions` category is nested now
(`flat: false`) and carries a new `nodeLabel` flag on the file-local
`CategoryDef`. `renderSampleValue` takes the category. For a `nodeLabel`
category it returns the node's `label` when that is a string, and
otherwise the existing key-count row.
- The module docblock's "flat string maps" list no longer names
`globalActions`, and says how the category is drawn.
- The other seven categories render as before. The control pin reads
`messages` and `objects`.
- No export, prop, type member or language-pack key is added, and
`CategoryDef` is file-local. So the claim's `Clause-②: no` holds.
- Files: the component, the pin file beside it, and
`.changeset/11755-translation-preview-global-actions.md` (`patch` on
`@object-ui/app-shell`). All three are inside the claim's file surface.
## Measured before the change (objectui `77c12b9`, installed
`@objectstack/spec` 17.7.0)
A throwaway probe mounted the real component. It was deleted before the
commit, and `git status` was clean afterwards.
| bundle data | `TranslationDataSchema.safeParse` | rendered sample row
|
|---|---|---|
| `globalActions: { portfolio_snapshot: { label: 'Snapshot' } }` |
success | `portfolio_snapshot[object Object]` |
| `objects: { sales_order: { label, _actions: { close_order: { label } }
} }` | success | `sales_order{2 keys}` |
| `globalActions: { close_order: 'Close' }` (legacy flat string) |
refused: `invalid_type` at `globalActions.close_order` |
`close_order"Close"` |
After the change, the same probe read `portfolio_snapshot"Snapshot"`,
then `close_orderClose`, then `sales_order{2 keys}` (unchanged). None of
the three contains `[object Object]`.
### "The same per-node rendering the object `_actions` entries get":
that rendering does not exist
The preview never renders an `objects.X._actions.Y` entry by itself. The
objects category lists only the top-level object names, each with its
inner key count (`sales_order{2 keys}` above), and never descends into
`_actions`. So the triage scope's phrase points at nothing, and the
card's Done-when ("at least `label`") decides. **Named gap:** object
nodes keep their key count, and only `globalActions` reads a node's
`label`. Other nested categories (`apps`, `dashboards`, `metadataForms`)
also declare `label` in the spec. They are not changed here.
### The legacy flat-string value
`globalActions.NAME: 'Close'` is refused by the spec (`invalid_type`,
expected object). The designer's own client validation refuses it too:
the same probe ran `validateMetadataDraft('translation', …)` and got
`globalActions.close_order: Invalid input: expected object, received
string`. After this change the preview draws that value through the
nested branch's existing scalar fallback, `String(v)`. It reads `Close`,
unquoted. That is readable, never `[object Object]` and never blank, and
it does not look like a valid label. No branch was added for the refused
shape (AGENTS.md #0.1, contract-first). The spec refuses the value at
validation, and the preview shows what is stored. The behaviour is not
pinned, because a pin would fix in place how the renderer treats input
the spec refuses.
## Pins: `TranslationPreview.globalActions-11755.test.tsx` (4 tests)
Each test first parses its fixture with the installed spec's
`TranslationDataSchema` and asserts success. The fixture is this file's
own, because objectui#11439 moves the preview sample's only
`globalActions` entry out.
1. A spec-valid node `{ label: 'Snapshot' }` renders `"Snapshot"`, and
the preview text has no `[object Object]`.
2. A node with `confirmText` and `successMessage` beside `label` still
renders the label.
3. A node without `label` renders its key count. The expected row is
read back through `tFormat`.
4. Control: `messages` renders `"Bienvenue"` as before, and `objects`
keeps its key count.
## Ablations
Both ablations were run on the committed fix `29bff9e` through
objectstack's `scripts/ablation-replace.mjs`. The tool asserts that the
anchor count fell and the blob hash changed, then restores the file and
proves its blob equals HEAD with an empty `git diff HEAD`.
- **Restore `flat: true` on the `globalActions` def** (anchor hit x1 to
x0, blob `ca2d00a4bc7b` to `682296fde42c`): `Tests 3 failed | 1 passed
(4)`. The failures were `expected '[object Object]' to be '"Snapshot"'`
twice and `expected '[object Object]' to be '{2 keys}'`. The control
stayed green. Restored: blob equals HEAD (`ca2d00a4bc7b`), and `git diff
HEAD` is empty.
- **Delete `nodeLabel: true`, keeping `flat: false`** (blob
`ca2d00a4bc7b` to `2b964160a448`): `Tests 2 failed | 2 passed (4)`. The
failures were `expected '{1 keys}' to be '"Snapshot"'` and `expected '{3
keys}' to be '"Snapshot"'`, so the label branch carries the fix, not the
`flat` flip alone. Restored the same way.
## Gates (all on HEAD `29bff9e`, run from the worktree root)
| command | exit | verdict line |
|---|---|---|
| `pnpm exec vitest run packages/app-shell/` | 0 | `Test Files 1053
passed, 1 skipped (1054)`, `Tests 10306 passed, 9 skipped (10315)` |
| `pnpm --workspace-concurrency=2 --filter '@object-ui/app-shell^...'
build` | 0 | dependency closure built for the type-check |
| `pnpm --filter @object-ui/app-shell type-check` | 0 | `tsc --noEmit &&
tsc -p tsconfig.test.json`; `--listFilesOnly` on the test project lists
the new pin file |
| `pnpm exec eslint` on the two touched `.tsx` files | 0 | no output |
| `pnpm check:control-bytes` | 0 | `check-control-bytes: OK` |
| `pnpm check:test-path-roots` | 0 | `check-test-path-roots: OK` |
| `pnpm check:changeset-claims` | 0 | `No pending changeset names a file
this change touches.` |
| `pnpm check:pending-changeset-literals` | 0 | `No test source names a
pending changeset.` |
| `pnpm check:new-line-citations` | 0 | `0 new citation(s)` |
| `node scripts/check-changeset-presence.mjs` | 0 | `2 source file(s) of
1 released package(s) changed, and this change declares 1 changeset(s)`
|
| `node scripts/check-changeset-no-major.mjs`,
`check-changeset-overwrite.mjs`, `check-changeset-fixed.mjs` | 0 | each
OK |
| `pnpm check:spec-symbols`, `pnpm check:i18n-keys`, `node
scripts/check-type-check-coverage.mjs`, `node
scripts/check-lint-coverage.mjs` | 0 | each OK |
Not run locally because the diff does not reach them: the i18n parity
and drift gates (no locale pack changed) and `check:readme-exports` (no
export changed). The full farm is CI's.
## Acceptance notes
- **Spec drift in the same `CATEGORIES` table** is reported to the seat
as a finding and is not fixed here. Fixing it needs new category heading
rows, which is a `Clause-②` question. The table lists
`validationMessages`, which `@objectstack/spec` 17.0.0 removed
(`TranslationDataSchema` refuses it with `unrecognized_keys`), and
`settings`, a platform-only group that the application bundle schema
refuses. It omits `picklists`, `datasets`, `pages`, `flows` and
`settingsCommon`. Measured on the real component at `77c12b9`: a bundle
whose only entries are `pages` (or `picklists`) passes
`TranslationDataSchema` and the designer's client validation, yet the
preview reads "This bundle is empty — add at least one translated string
to see the coverage report."
- The en `keyCount` row reads `{1 keys}` for a single key (seen in the
second ablation). This is polish and is not filed.
- objectui#11439 (in flight) moves the preview sample's
`globalActions.close_order` out. This PR does not touch
`apps/console/src/preview-samples.ts`.
Session: `https://claude.ai/code/session_01CGZy1BGCjdN5cXqL9cnvB8`
---
_Generated by [Claude
Code](https://claude.ai/code/session_01CGZy1BGCjdN5cXqL9cnvB8)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 3bf8894 commit 91dff12
3 files changed
Lines changed: 124 additions & 8 deletions
File tree
- .changeset
- packages/app-shell/src/views/metadata-admin/previews
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
Lines changed: 86 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
Lines changed: 29 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| |||
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
54 | 62 | | |
55 | 63 | | |
56 | 64 | | |
| |||
63 | 71 | | |
64 | 72 | | |
65 | 73 | | |
66 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
67 | 81 | | |
68 | 82 | | |
69 | 83 | | |
| |||
173 | 187 | | |
174 | 188 | | |
175 | 189 | | |
176 | | - | |
| 190 | + | |
177 | 191 | | |
178 | 192 | | |
179 | 193 | | |
| |||
188 | 202 | | |
189 | 203 | | |
190 | 204 | | |
191 | | - | |
192 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
193 | 211 | | |
194 | 212 | | |
195 | 213 | | |
196 | 214 | | |
197 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
198 | 219 | | |
199 | 220 | | |
200 | 221 | | |
| |||
0 commit comments