This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
Commit 401611b
feat(types)!: the widget slot's metric-card arm declares MetricCard's registered inputs, and the widget
Fixes #11467
Clause-②: yes
Parent: objectui#8347, which keeps the index-signature removal. This PR
is its F2 half and leaves the signature in place: every commit compiles
with `BaseSchema`'s signature present.
## What this does
Seat answer A, executed. `DashboardWidgetSlotComponentSchema` is the
widget slot's component arm. It now declares `metric-card`'s registered
inputs as members, typed as the props `MetricCard` reads. The zod twin
declares the same members. The widget's legacy `component` slot takes
the arm first, then any other node, on both faces.
| member | TypeScript face | zod twin | source of the type |
| --- | --- | --- | --- |
| `title` | `string \| I18nLabel`, optional | spec `I18nLabelSchema`
(defaults stripped), optional | `MetricCardProps.title` |
| `value` | `string \| number`, **required** | `z.union` of string and
number, required | `MetricCardProps.value`; the registration marks it
`required` |
| `icon` | `string`, optional | `z.string()`, optional |
`MetricCardProps.icon` |
| `trend` | `'up' \| 'down' \| 'neutral'`, optional | `z.enum` of the
three, optional | the registration's enum, which equals
`MetricCardProps.trend` |
| `trendValue` | `string`, optional | `z.string()`, optional |
`MetricCardProps.trendValue` |
| `description` | inherited `BaseSchema` member, not restated |
inherited | already `string \| I18nLabel` on both faces |
`component` changes too. On the TypeScript face it is
`DashboardWidgetSlotComponentSchema | SchemaNode`. On the zod face it is
`z.union` of the arm and `BaseSchema`.
**"By reference" across a package boundary.** `@object-ui/types` cannot
import the registration or `MetricCard`, so the members are transcribed.
The registering package holds them to both sources in
`metricCardRegisteredInputsStrictFace-11022.test.ts`:
- every registered input is a member of the arm on both faces;
- every member the arm adds beyond `BaseSchema` and `layout` is a
registered input;
- `value` is required, as the registration marks it;
- `trend` is exactly the registered enum;
- a type-level equality between the arm's members and `MetricCardProps`
for the six inputs.
**No second spelling.** objectui#11022's side table of input names
(`DASHBOARD_WIDGET_SLOT_REGISTERED_INPUTS`, through
`declareRegisteredInputs`) recorded these same names so the strict
walker could admit them. Every name it held is now a member, so the
table, `declareRegisteredInputs` / `registeredInputsOf`, and the
walker's branch for them are removed. They were internal and not
exported, and the arm was their only caller.
**A guard instead of the table's `satisfies`.** The arm's zod `type` is
`z.enum` over `DASHBOARD_COMPONENT_WIDGET_TYPES` with a `satisfies`
check against the one-member list `metric-card`. A second member of the
closed set is therefore a compile error until the arm is split per
component. Without the check, the new member would inherit the card's
props.
## Measured first
**H1. Which inputs `MetricCard` reads.** Two instruments, both at base
`d93e53f5`.
- *Type-checker census.* A TypeScript LanguageService ran over
plugin-dashboard's own program. For each `MetricCardProps` member it
looked up the references to the member symbol, then the uses of the
destructured binding in the render body. `title`, `value`, `icon`,
`trend`, `trendValue` and `description` are each destructured and read.
A standalone `tsc` program over the same config: 0 errors.
- *Runtime probe.* A real `DashboardRenderer` drew the card through the
real `SchemaRenderer` and `ComponentRegistry`, one key removed at a time
from a full card. The probe was a one-shot test file, deleted after the
run.
- Removing `title`, `value` or `description` changed the text.
- Removing `icon` changed the drawn svg count.
- Removing `trend` or `trendValue` changed the text, the svg count and
the trend colour class. Each is drawn only together with the other.
- Changing `trend` from up to down or neutral moved the colour class
from green to red or yellow.
- CONTROL: an unregistered key changed nothing drawn. It does land as a
DOM attribute through `MetricCard`'s rest spread (objectui#4426,
pre-existing).
All five keys the card named are read. `description` is the sixth input
and is already declared on `BaseSchema`.
**H2. What each zod face judged at base.**
- Tolerant face: the slot arm declared only `description` (through
`BaseSchema`). The other five passed through the catchall unjudged.
- Strict face: it admitted all six names from the side table. Five were
judged by the catchall (`unknown`), so `trend: 'sideways'`, `title: 7`
and `value: {}` all parsed on both faces.
- The `component` slot was `BaseSchema` alone. The strict face therefore
refused a card's `title`, `value`, `icon`, `trend` and `trendValue`
there as `unrecognized_keys`. That includes the plugin-dashboard
README's own legacy-envelope example.
**H3.** PR objectui#11460 had landed (`9d1c0bff`) before this branch was
cut from `d93e53f5`.
**H4.** `zod-mirror-parity.test.ts` did not move. The file is untouched,
and the types suite is green with it. `component` stays in `KnownDrift`
(the primitive arms of `SchemaNode`), and so does `widgets`.
## Accept-set change (Clause-② yes)
| document | tolerant face, before → after | strict face, before → after
| TypeScript face, before → after |
| --- | --- | --- | --- |
| card in `widgets[]` with all inputs well-typed | accept → accept |
accept → accept | compiles → compiles |
| card in `widgets[]`, `trend: 'sideways'` / `title: 7` / `icon: 5` /
`trendValue: 3` / `value: {}` | accept → **refuse** at that key | accept
→ **refuse** | compiles → **error** |
| card in `widgets[]` with `icon`, `trend` or `trendValue` and no
`value` | accept → **refuse** | accept → **refuse** | compiles →
**error** |
| card in `widgets[]` with only `title` / `description` / `layout` and
no `value` | accept → accept (through the widget arm) | accept → accept
| compiles → compiles (widget arm) |
| card in a widget's `component` slot with its inputs (README example) |
accept → accept | **refuse → accept** | compiles → compiles |
| card in `component` with `trend: 'sideways'` | accept → accept
(`BaseSchema` fallback) | refuse → refuse (now at the arm's `trend`) |
compiles → compiles while the signature stands |
| any other node in `component` (`{ type: 'chart' }`) | unchanged |
unchanged | unchanged |
| undeclared key on a card (`someProp`) | kept → kept | refused by name
→ refused by name | compiles → compiles while the signature stands |
The TypeScript face gains no accepted key while the signature stands.
The read type of `title` off a `widgets[]` entry moves from `any` to
`string | I18nLabel`. Six consumer packages and two examples type-check
unchanged; see Gates.
## The card's own reading, two legs
The probe used the parent's mutation: only `BaseSchema`'s documented
index signature deleted, with `@object-ui/types` rebuilt so that
`dist/base.d.ts` keeps 1 signature. Then `tsc -p
packages/types/tsconfig.test.json` and `pnpm check:doc-snippets` ran.
The mutation went through `scripts/ablation-replace.mjs` from the
objectstack checkout: anchor 1 → 0, blob `ce2bc9e31dc6` →
`93c3221b8301`, restored to blob == HEAD, `git diff HEAD` empty. Both
legs ran in this container, in two worktrees.
| | base `d93e53f5` (control) | head `35a89136` |
| --- | --- | --- |
| types test program, errors in the arm-7952 and 9256 files | `value` x3
(README usage copy; `component` slot x2), `title` x1 (9256 accepting
literal), plus probe `someProp` | probe `someProp`, probe `bogus` only |
| `check:doc-snippets` | 70 of 776 blocks failed; 3 diagnostics in
`packages/plugin-dashboard/README.md` | 68 of 776 failed; 0 in the
plugin-dashboard README |
| diagnostics, set difference | — | the 3 README diagnostics gone;
nothing new |
The `bogus` line at head is the arm-7952 file's "MEASURED LIMIT"
constant. That corner shuts once the `component` card's `value` is
declared, and the constant says to delete it then. This is noted for
objectui#8347's last PR. The restore leg rebuilt types: `dist/base.d.ts`
signatures 2, src 2, `git diff HEAD` 0.
## Reverse verification of the new pins
Each leg deleted the members with `ablation-replace.mjs` on the
committed tree (anchor 1 → 0, blob moved), ran, and restored (blob ==
HEAD, `git diff HEAD` empty). The direction was predicted before each
run: red.
- **zod members deleted.** vitest over the three pin files: 21 failed,
29 passed. Red: the grade pins, every value-judgment row, the
`value`-required row, the arm-shape pin, the README-literal strict pin,
plugin-dashboard UNDER-admission x6, DECLARED, typed-members, and the
saved-layout strict parse.
- **TypeScript members deleted.** The types test program: 10 errors. Six
`Equal` pins went false: the five members and the zod twin. Three
`@ts-expect-error` directives went unused (TS2578). The `title` read pin
went false.
## Corpus re-judged
`scripts/measure-strict-authoring-face.mjs` ran at base and at head over
the schema catalog, the docs fences, the apps and the types sources: 610
documents, 2244 nodes.
- Tolerant face: unchanged. `documentsRedTodayWholeDocument` is 23 → 23
and `nodesRedToday` 30 → 30.
- The script's strict twin: 61 → 56 documents refused. The 5 are the
three catalog dashboards and two docs dashboards with direct-slot cards.
That script keeps its own walker, which never modelled the
objectui#11022 side table, so at base it disagreed with the shipped
strict face on exactly these 5. The shipped face accepted them at base
and accepts them now. With the table gone, the script and the face
agree.
- Every `metric-card` in the corpus carries a string `value` and a
`trend` from the three, so no document's verdict moved on the shipped
faces.
- One already-red docs dashboard (a `type: 'card'` widget with
`children`, in the plugin-dashboard mdx) also lists the component arm's
missing `value` among its union errors now. Its verdict is unchanged;
only the error shape moved.
## Pins moved
- `strict-widget-slot-registered-inputs-11022.test.ts`. Several blocks
are rewritten:
- "admitted unjudged" becomes "refused at that key, on both faces";
- the "side table" shape pin becomes "the arm's shape is the base plus
`layout` and the five inputs";
- the hand-built-node derivation block is removed with the mechanism.
- The `bogus` and `value`-required fixtures now carry a `value`.
- `metricCardRegisteredInputsStrictFace-11022.test.ts`. The
OVER-admission test, which read "strict keys minus tolerant keys", is
replaced by DECLARED-both-directions on both faces. Typed-member and
`MetricCardProps` pins are added. The UNDER-admission and `layout`
fixtures carry the required `value`.
- `dashboard-widget-slot-component-arm-7952.test.ts`. `value` is added
to two existing literals so each pin keeps refusing for its stated
reason. A new objectui#11467 block holds the member types, the twin
parity, the TypeScript refusals, the `component` slot type, the README's
two literals on both faces, and the `component`-slot strict judgment.
## Files outside the claimed surface (declared)
The claim's surface did not list five files. Each one is the same
accept-set change, not a side quest:
- `packages/types/src/zod/node-derivation.ts` and
`packages/types/src/strict-authoring-face.ts`: the side table and its
walker branch are removed, because every name in it is now a member.
- `strict-widget-slot-registered-inputs-11022.test.ts` (types) and
`metricCardRegisteredInputsStrictFace-11022.test.ts` (plugin-dashboard):
they pinned the passthrough-plus-side-table state that the ruling
replaces.
- `packages/types/README.md`: its strict-face paragraph described the
side table.
The renderer, the index signature and `SchemaNode` are untouched.
## Gates (head `35a89136`)
- `pnpm --filter PKG run type-check` (each echoed `type-check`): exit 0
for types, plugin-dashboard, core, sdui-parser, plugin-list,
plugin-designer, app-shell, example-schema-catalog and
example-console-starter. All 40 packages were built first, with turbo
`Tasks: 40 successful`.
- vitest from the worktree root, each a repo-relative path:
- `packages/types/`: 330 files, 8770 tests passed;
- `packages/plugin-dashboard/`: 160 files, 1532 passed, 6 skipped
(pre-existing);
- `examples/schema-catalog/`: 39 files, 2235 passed;
- `packages/sdui-parser/`: 20 files, 289 passed;
- 8 consumer files in cli, app-shell, plugin-designer and core: 96
passed.
- `check:doc-snippets`: 776 of 776 judged, 0 failed.
`check:doc-examples`: 87 fail, all 87 declared. `check:doc-types`:
green.
- `check:spec-symbols`, `check:component-surface-parity`,
`check:new-line-citations`, `check:control-bytes`,
`check:changeset-claims`, `check:pending-changeset-literals`,
`check:doc-fences`, `check:readme-exports`, `check:test-path-roots` and
`check:handler-key-reads`: exit 0.
- `node scripts/check-changeset-no-major.mjs` and `node
scripts/check-changeset-presence.mjs`: exit 0.
- `check:sdui-registration-pins`: **NOT MEASURED**. It exits 2 with "No
console build to weigh", a prerequisite the run did not meet. No
registration or `sideEffects` array moved.
- `node scripts/check-governed-queue-guard.mjs --test` on the 11 paths:
NOT GOVERNED.
## Overlap
- `main` advanced 6 commits after `d93e53f5`, objectui#11477 (F3) among
them. `git merge-tree` against it is clean. The one shared file is
`packages/types/README.md`, in a different section. Nothing on `main`
touches `complex.ts`, `complex.zod.ts` or `zod-mirror-parity.test.ts`.
- objectui#11466 (F1) is in flight on `SchemaNode`. `component` is
`DashboardWidgetSlotComponentSchema | SchemaNode`, so it composes with
whatever `SchemaNode` becomes, and the card stays typed by the arm.
## Acceptance notes
- **`value` required is enforced on the arm, not on every
`metric-card`.** A `{ type: 'metric-card', title }` entry with no
card-only input still parses on both faces through the widget arm. The
widget arm parses it because `DashboardWidgetTypeSchema` also carries
the closed component types (objectui#4600). Reported to the seat as a
finding.
- **Measured limit in the `component` slot.** A card that fails the arm
still parses on the tolerant face through the `BaseSchema` fallback, and
the TypeScript union has the same corner. Only the strict face refuses
it. This is recorded as a MEASURED LIMIT in the arm-7952 file, not
ruled.
- **The mdx's `type: 'card'` widget with `children`** is refused by the
validator today. The README twin was repaired by objectui#7035; the mdx
was not. Reported to the seat as a finding.
The session that made this change is
`https://claude.ai/code/session_01XvhGmGAP79ZB8swnkapxPC`.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01XvhGmGAP79ZB8swnkapxPC)_
---------
Co-authored-by: Claude <noreply@anthropic.com>component slot takes the arm (objectui#11467) (#11482)1 parent 2b188fa commit 401611b
14 files changed
Lines changed: 581 additions & 382 deletions
File tree
- .changeset
- content/docs/plugins
- packages
- plugin-dashboard
- src/__tests__
- types
- src
- __tests__
- zod
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
84 | | - | |
85 | | - | |
| 85 | + | |
| 86 | + | |
86 | 87 | | |
87 | | - | |
88 | | - | |
89 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| |||
463 | 464 | | |
464 | 465 | | |
465 | 466 | | |
466 | | - | |
| 467 | + | |
| 468 | + | |
467 | 469 | | |
468 | 470 | | |
469 | 471 | | |
| |||
479 | 481 | | |
480 | 482 | | |
481 | 483 | | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
486 | 490 | | |
487 | 491 | | |
488 | 492 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
563 | 563 | | |
564 | 564 | | |
565 | 565 | | |
566 | | - | |
| 566 | + | |
567 | 567 | | |
568 | 568 | | |
569 | 569 | | |
| |||
592 | 592 | | |
593 | 593 | | |
594 | 594 | | |
595 | | - | |
| 595 | + | |
| 596 | + | |
596 | 597 | | |
597 | 598 | | |
598 | 599 | | |
| |||
607 | 608 | | |
608 | 609 | | |
609 | 610 | | |
610 | | - | |
| 611 | + | |
| 612 | + | |
611 | 613 | | |
612 | 614 | | |
613 | 615 | | |
| |||
633 | 635 | | |
634 | 636 | | |
635 | 637 | | |
636 | | - | |
637 | | - | |
638 | | - | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
639 | 654 | | |
640 | 655 | | |
641 | 656 | | |
642 | | - | |
| 657 | + | |
643 | 658 | | |
644 | 659 | | |
645 | 660 | | |
| |||
657 | 672 | | |
658 | 673 | | |
659 | 674 | | |
660 | | - | |
661 | | - | |
662 | | - | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
663 | 680 | | |
664 | 681 | | |
665 | 682 | | |
| |||
0 commit comments