Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

Commit 0eb9f36

Browse files
fix(types): the strict authoring face admits the widget-slot metric-card's registered inputs (objectui#11022) (#11023)
Fixes #11022 Clause-②: yes — the strict face's accept set widens: a correctly authored `metric-card` (and any other card whose registered inputs the closed arm refused) now parses; an undeclared key is still refused. **The widening, named.** `StrictAnyComponentSchema` now accepts a `metric-card` in a dashboard's widget slot carrying the inputs its registration declares (`title`, `value`, `icon`, `trend`, `trendValue`, `description`). Before this change it refused `value`, `icon`, `trend` and `trendValue` as `unrecognized_keys`. Nothing that parsed before is refused now. The tolerant face (`AnyComponentSchema` and every named mirror) does not move. The changeset is `@object-ui/types` `minor`, with no BREAKING note, because nothing narrows. Implemented by a dispatched `os-dev` run under the `domain:spec` seat's claim `5878477986` (session `https://claude.ai/code/session_012UwY3ahMixEFkfTUxMVkYm`). Grade: triage `5878357772`. ## What changed - **`zod/node-derivation.ts`**: a side table, `declareRegisteredInputs(schema, names)` / `registeredInputsOf(schema)`, keyed by node identity (a plain `WeakMap`, not `.meta()`: a registry entry would reach `z.toJSONSchema` output and be inherited down zod's clone chain). It only accepts a passthrough object, one with a catchall, and throws otherwise. A stripping object has no tolerant judgment for the strict face to copy. - **`strict-authoring-face.ts`**, the walker's `object` arm: for a node that carries a record, each recorded name the shape does not already declare is added as `z.optional(catchall)`, judged by the node's own catchall exactly as the tolerant face judges it. The object is then closed with `catchall: z.never()` like every other object. A key no registration declares is still refused by name, and a name the shape already declares (such as `description`, a `BaseSchema` member) keeps its declared member. The module docblock gains a "Registered inputs" section, and the `StrictAnyComponentSchema` / `deriveStrictAuthoringSchema` docblocks say what counts as declared. - **`zod/complex.zod.ts`**: a private `DASHBOARD_WIDGET_SLOT_REGISTERED_INPUTS` table, one row per member of the closed `DASHBOARD_COMPONENT_WIDGET_TYPES`. Its `satisfies` clause types it as a `Record` from `DashboardComponentWidgetType` to `readonly string[]`, so a member added without a row does not compile (ablation A5). The slot arm is wrapped in `declareRegisteredInputs(...)`. The arm's shape, catchall, `describe` text and accept set are unchanged. The GlobalFilterSchema docblock that objectui#10930 edits is not touched. - **`complex.ts`**: docblock only. The `DASHBOARD_COMPONENT_WIDGET_TYPES` note now says a new member needs its row. - **`packages/types/README.md`**: one paragraph and a snippet in "The strict authoring face". - **Pins**: `packages/types/src/__tests__/strict-widget-slot-registered-inputs-11022.test.ts` (15 tests) and `packages/plugin-dashboard/src/__tests__/metricCardRegisteredInputsStrictFace-11022.test.ts` (9 tests). The second is the registry parity: it runs against the live `ComponentRegistry` and checks both directions, and it holds no copy of either list. - **Changeset**: `.changeset/11022-strict-widget-slot-registered-inputs.md`. Where the grade's pin sits: `metric-card` is deliberately not a root arm of `AnyComponentSchema` (objectstack#8593). So a root `{ type: 'metric-card', value: 42 }` is refused at `type` on both faces, before and after this change, and the pin puts the grade's widget in a dashboard's `widgets` slot. A control test records the root behaviour. ## The mechanism, measured on `origin/main` `797a30f48` before any edit - **Where the arm is built.** `const DashboardWidgetSlotComponentSchema = BaseSchema.extend({ type: z.enum(DASHBOARD_COMPONENT_WIDGET_TYPES), body: retirementTombstone(...), children: retirementTombstone(...) })` lives in `packages/types/src/zod/complex.zod.ts`. It is the first option of `DashboardComponentSchema.widgets`, which is `z.array(z.union([DashboardWidgetSlotComponentSchema, DashboardWidgetSchema]))`. `StrictAnyComponentSchema` is a `z.lazy` over `faceWalker(AnyComponentSchema)` in `packages/types/src/strict-authoring-face.ts`. - **How it closes.** Nothing in the arm is strict-specific. Its "passthrough" is `BaseSchema`'s loose catchall, inherited through `.extend` (measured: `def.catchall` is `unknown`). The walker's generic `case 'object'` arm (`out = cloneWithDef(schema, { shape, catchall: z.never() })`) replaces that catchall on every object it reaches. The derived slot arm therefore admits exactly `BaseSchema`'s members, with `type` / `body` / `children` overridden. - **Partly falsified PM assumption.** The passthrough has no members, and `@object-ui/types` holds no registry-input source for the passthrough to "use". The package has no dependency on any registry. The inputs exist only in the registration: `ComponentRegistry.register('metric-card', MetricCard, { inputs: [...] })` in `@object-ui/plugin-dashboard`. So the repair records the names on the arm and holds them to the live registration in a test inside that package. ## Reproduction (strict face, BASE `797a30f48`) | document (in a dashboard's `widgets`) | strict face | tolerant face | |---|---|---| | `{ type: 'metric-card', value: 42 }` | one `invalid_union` at `widgets.0`; arm 1: `unrecognized_keys` at path `[]`, keys `["value"]`; arm 2: `unrecognized_keys` at `[]`, keys `["value"]` | parses | | `{ type: 'metric-card' }` | parses | parses | | `{ type: 'metric-card', bogus: 1 }` | one `invalid_union` at `widgets.0`; both arms `unrecognized_keys` at `[]`, keys `["bogus"]` | parses | | every registered input | arm 1 refuses `title`, `value`, `icon`, `trend`, `trendValue`; arm 2 refuses `value`, `icon`, `trend`, `trendValue` | parses | After the change: the first and fourth rows parse on the strict face. The `bogus` row is refused exactly as before, with arm 1 and arm 2 both `unrecognized_keys` `["bogus"]`. `children` / `body` still get the objectui#9256 by-name refusal inside the union's `errors`. ## Census: who else sits in the same position **Query.** This was a throwaway vitest file in `apps/console`, deleted after the run and not committed. It eagerly imported every registering package (the console's `register-plugins`, `components`, `fields`, `layout` and 19 plugins) and read `ComponentRegistry.getAllConfigs()`: 508 configs, 286 unique registrations, 0 lazy stubs left. For each registration × authored type (namespaced key and, unless `skipFallback`, the bare fallback) × position, it parsed `{ type, INPUT: probe }` under `StrictAnyComponentSchema` and recorded every input named by an `unrecognized_keys` issue anywhere in the error tree, union `errors` walked. The positions were: root, when an arm claims the type; and widget slot, when the type is in `DASHBOARD_COMPONENT_WIDGET_TYPES`. That came to 911 probes over 179 rows that have an arm. An arm census over `AnyComponentSchema` (139 object arms) found the arms built the same way, with no member beyond `BaseSchema`'s: `div`, `box`, the seven semantic tags (`aside`, `main`, `header`, `nav`, `footer`, `section`, `article`) and the retired `kanban`. The widget-slot arm is the fifth such shape. **Controls.** Positive: the widget-slot `metric-card` `value` was reported refused (`["value"]` from both arms) at BASE. Negative: `button` `label` was admitted and `button` `bogus` was refused, in the same run. **Population in the same position: exactly one card, `metric-card`.** Four of its six registered inputs were refused (`value`, `icon`, `trend`, `trendValue`). `title` was admitted through the strict widget arm, which declares the spec's `title`, and `description` is a `BaseSchema` member. The bare-shaped root arms `div`, `box` and the seven semantic tags each register two inputs, and none of them is refused. No registration claims `kanban`. So there is no second member to pin. The registry pin walks the closed set, not a list, so a later member is covered, and `tsc` refuses a member without a row. A different position, not this card, is listed under Acceptance notes: declared root arms that do not declare some registered input. ## Consumers The strict face has no non-test consumer, re-checked (matches triage). A search of every `ts` / `tsx` / `mjs` / `js` file outside `node_modules` and `dist` for `StrictAnyComponentSchema`, `StrictSchemaNodeSchema` and `deriveStrictAuthoringSchema` finds: - the defining module; - the barrel re-export in `zod/index.zod.ts`; - 15 test files under `packages/types/src/__tests__`; - one comment in `scripts/measure-strict-authoring-face.mjs`, which keeps its own walker and imports none of them. ## Red on base, then green: ablation both ways Predictions were written to a file before any mutation. Every leg went through `ablation-replace.mjs` in wrap mode against committed HEAD `9fe80dbbc`. The anchor count and a blob change were proven on disk, and the restore was proven by blob equal to HEAD and an empty `git diff HEAD`. The tree was clean after each leg. The subjects are read from `src`: the types pin imports relatively, and vitest aliases `@object-ui/types` and `@object-ui/core` to `src` for the dashboard pin, so no leg needed a rebuild. | leg | mutation | types pin (15) | dashboard pin (9) | |---|---|---|---| | A1 | the arm's record emptied (`Object.values(...).flat()` → `[]`) | **RED 4**: value-42, every-input, loose-values, side-table non-vacuity | **RED 5**: under-admission `value` / `icon` / `trend` / `trendValue`, over-admission non-vacuity | | A2 | walker ignores the record | **RED 4**: value-42, every-input, loose-values, hand-built "WITH a record" (side-table row stays green: the record exists) | **RED 5**: same five | | A3 | walker leaves a recorded object OPEN (over-admission direction) | **RED 2**: `bogus` refused by name, hand-built "any other key refused" | **RED 1**: key-no-registration-declares control | | A4 | record gains an unregistered name (`loading`) | green 15/15 (holds no copy of the list) | **RED 1**: OVER-admission, `expected [ 'loading' ] to deeply equal []` | | A5 | closed set gains a member with no row | `tsc --noEmit` on `packages/types`: **exactly 1 × TS1360** at the `satisfies` | — | All five legs matched the predictions exactly. ## Gates (final HEAD `9fe80dbbc`; heavy runs through the shared verify lock; exit codes captured by redirecting first) | gate | result | |---|---| | `vitest run packages/types/` + the dashboard pin + `examples/schema-catalog/test/plugin-dashboard-component-schema.test.ts` + `scripts/__tests__/check-readme-exports.test.ts` | exit 0, 280 files / 6519 tests (at `9fe80dbbc`) | | `vitest run packages/plugin-dashboard/` + the files outside `packages/types` that read a touched file (`kanban-column-cards-6939`, cli `check-validity-recogniser`, scripts `check-handler-key-read-sites`, `check-readme-exports`, `component-node-vocabulary-7434`) | exit 0, 157 files / 1568 passed + 6 skipped (at `067461304`; the later commit touches only `packages/types/README.md`, and the README readers were re-run at HEAD in the row above) | | `@object-ui/types` `build` (tsc + vite + dist completeness) and `type-check` (three programs) | exit 0 (src unchanged since) | | `@object-ui/plugin-dashboard` `type-check`, after building its dependency closure | exit 0; `--listFilesOnly` shows both new test files are in their packages' test programs | | `check:control-bytes` · `check:new-line-citations` (0 new) · `check:test-path-roots` · `changeset:check` · `check-changeset-presence` · `check:changeset-claims` · `check:pending-changeset-literals` · `check:doc-types` · `check:doc-fences` | exit 0 each | | governed guard `--test` over the 8 paths | NOT GOVERNED, exit 0 (lit control `AGENTS.md`: exit 3) | | eslint over the 6 touched TS files (eslint's own JSON: 6 entries) | exit 0; 0 errors; 11 warnings, all `no-explicit-any` on untouched lines. The single root `eslint.config.js` sets no `parserOptions.project` / `projectService`, so no type-aware rule runs and no untouched file's verdict can move | | README snippet, compiled `--strict` against the built `packages/types/dist` | exit 0 (negative control, an unexported name: exit 2, 1 error) | NOT MEASURED locally, left to CI: - The `pnpm test` shards beyond the suites above. - Downstream `type-check`. The public type surface is unchanged: `declareRegisteredInputs` returns its argument's type, so `DashboardComponentSchema`'s inferred type does not move, and the two new `node-derivation` exports are not reachable through the package's `exports` map. - `check:doc-snippets`, `check:doc-examples` and `check:readme-exports` exited with PREREQUISITE NOT MET: their 34-package build closure was not built locally. That is not a verdict about the documents. - `pnpm check`, which needs the CLI build. - Bundle Analysis / `check:eager-closure`. The main `@object-ui/types` entry imports these modules type-only, so the new runtime code is reachable only through `@object-ui/types/zod`. - Repo-wide `pnpm lint`. ## Serial constraints - `origin/main` has not moved since `797a30f48`. It was fetched into a private ref and read by commit. - `git merge-tree --write-tree` of this head against objectui#10930's head exits 0 (clean). - That PR edits the `GlobalFilterSchema` docblock in `zod/complex.zod.ts`. This PR's edits there sit above it, in the new table const and the slot arm's wrapper and docblock. - No rebase, no force-push. ## Acceptance notes: out of scope, not changed here - **The legacy widget envelope.** At BASE and HEAD, `{ id, component: { type: 'metric-card', value: '1' } }` in a widget slot parses on the tolerant face and is refused on the strict face: `unrecognized_keys` `["value"]` at `component`. That member is plain `BaseSchema` by design (the objectui#8344 note), and the walker closes it the same way. The grade ruled the related observation on that member out of this card, so it is untouched. The strict face is dormant (no consumer). Noted, not filed. - **Declared root arms that do not declare a registered input.** This is a different position from the one this card repairs. The census found 45 root rows where a registered input is refused on the strict face and passes the tolerant face unjudged, 204 inputs in all. Seventeen are the ADR-0080 public blocks, whose inputs are registered flat while their arm is the spec row's `properties` bag (objectui#10872's flat-props batch). Fourteen name `dataSource`, which the registry emits through `withElementDataSourceInput`. The rest are hand-declared arms missing a key: for example, `object-form` 19, `object-grid` 11, `calendar` 9. In each case the arm declares its keys by hand or by spec row, and the tolerant face leaves those inputs undeclared too. Which side is right is objectui#4631's authority order, instrumented by `check:component-surface-parity` (report-only). A registry record would be the wrong repair there. Noted, not filed. - **`MetricCard` also reads `loading` and `error`** (its props interface), and no registration declares them. So the strict face refuses them by the grade ("It still refuses a key that no registration declares"), and the tolerant face admits them. Noted. - **`scripts/measure-strict-authoring-face.mjs`** keeps its own walker by design, and that walker does not read the registered-inputs record. On a corpus holding widget-slot `metric-card` nodes it will now name `value` and the other inputs as undeclared where the shipped face admits them. That is the redder direction, the opposite of objectui#10076's. It is a throwaway measurement script. Noted, not filed. - No `content/docs` page describes the strict face's per-slot behaviour. The schema-reference `widgets` row says a component node's other keys are that component's own props, and that is now true on both faces. --- _Generated by [Claude Code](https://claude.ai/code/session_012UwY3ahMixEFkfTUxMVkYm)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 12a6688 commit 0eb9f36

8 files changed

Lines changed: 532 additions & 6 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@object-ui/types': minor
3+
---
4+
5+
The strict authoring face accepts a correctly authored `metric-card` in a dashboard's widget slot (objectui#11022). This widens a published accept set; nothing that parsed before is refused now.
6+
7+
`StrictAnyComponentSchema` refused every `metric-card` widget that carried `value`, its required input, and `icon`, `trend` and `trendValue` with it: each came back as `unrecognized_keys` from both arms of the widget slot's union. The widget slot holds `metric-card` as a component node whose props are its registration's `inputs`. The tolerant face admits them through `BaseSchema`'s passthrough, and the strict face closes that passthrough, so it refused them as undeclared.
8+
9+
- **What changed.** The slot's component-node arm now records the input names the `metric-card` registration declares (`title`, `value`, `icon`, `trend`, `trendValue`, `description`). `deriveStrictAuthoringSchema` admits those names on that node before closing it. Each one is judged the way the tolerant face judges it: the passthrough admits any value, so the strict face checks which KEYS appear and judges no value the tolerant face does not. A name the node already declares, like `description`, keeps its declared type.
10+
- **What still refuses.** A key no registration declares is still refused by name, as `unrecognized_keys` (`{ type: 'metric-card', bogus: 1 }`). `children` and `body` on `metric-card` are still refused with the objectui#9256 message.
11+
- **What does not move.** The tolerant face (`AnyComponentSchema`, `DashboardComponentSchema` and every other mirror): its accept set, output and inferred types are unchanged, and the slot arm's shape and catchall are what they were. The legacy `{ id, component, layout }` widget envelope is untouched, and its `component` is still judged as a plain `BaseSchema` node on both faces. `metric-card` is still not a root-level arm of `AnyComponentSchema`, so a root `{ type: 'metric-card' }` document is refused at `type` on both faces, as before.
12+
13+
No migration: a document that parsed on either face still parses there.
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
/**
2+
* objectui#11022 — the strict authoring face admits what the widget slot's
3+
* REGISTRATIONS declare, measured against the live `ComponentRegistry`.
4+
*
5+
* `@object-ui/types` records, on its private widget-slot arm, the input names
6+
* of each component type in the closed `DASHBOARD_COMPONENT_WIDGET_TYPES`, and
7+
* the strict walker admits exactly those (see `strict-authoring-face.ts`,
8+
* "Registered inputs"). That package depends on no registry, so the names are
9+
* transcribed there — and a transcription is only as good as the check that
10+
* re-reads its source. The source is here: this package's barrel runs the
11+
* registration. So this file holds the record to the registration in BOTH
12+
* directions, and holds no copy of either list:
13+
*
14+
* 1. UNDER-admission — every input a widget-slot type's registration
15+
* declares parses on `StrictAnyComponentSchema` in the widget slot, with
16+
* no `unrecognized_keys` naming it. The population is every member of the
17+
* closed set, read from the set, so a member added later is walked too.
18+
* 2. OVER-admission — every key the strict slot arm admits beyond the
19+
* tolerant arm's own members is a key some widget-slot registration
20+
* declares. Read off the derived arm's shape, so a name added to the
21+
* record that no registration declares turns this red.
22+
*
23+
* The instrument's controls: a key no registration declares is refused by
24+
* name (so walk 1 can fail), and the population is non-empty and holds the
25+
* card that motivated the repair.
26+
*/
27+
import { describe, expect, it } from 'vitest';
28+
import { ComponentRegistry } from '@object-ui/core';
29+
import { DASHBOARD_COMPONENT_WIDGET_TYPES } from '@object-ui/types';
30+
import {
31+
DashboardComponentSchema,
32+
deriveStrictAuthoringSchema,
33+
StrictAnyComponentSchema,
34+
} from '@object-ui/types/zod';
35+
// Side-effect import: the package barrel runs the `ComponentRegistry.register`
36+
// calls, `metric-card`'s among them.
37+
import '../index';
38+
39+
type Issue = { code: string; path: PropertyKey[]; keys?: string[]; errors?: Issue[][] };
40+
type Def = {
41+
type: string;
42+
shape?: Record<string, unknown>;
43+
innerType?: unknown;
44+
element?: unknown;
45+
options?: unknown[];
46+
};
47+
type Input = { name: string; type?: unknown; enum?: Array<{ value: unknown } | string> };
48+
49+
const defOf = (schema: unknown): Def => (schema as { _zod: { def: Def } })._zod.def;
50+
51+
/** Every key named by an `unrecognized_keys` issue anywhere in the refusal. */
52+
const unrecognized = (issues: readonly Issue[]): string[] =>
53+
issues.flatMap((issue) => [
54+
...(issue.code === 'unrecognized_keys' ? (issue.keys ?? []) : []),
55+
...(issue.errors ?? []).flatMap((group) => unrecognized(group)),
56+
]);
57+
58+
/** A value of the input's registered kind — the key is what is measured, not the value. */
59+
const sampleFor = (input: Input): unknown => {
60+
if (input.type === 'enum' && input.enum?.length) {
61+
const first = input.enum[0];
62+
return typeof first === 'string' ? first : first.value;
63+
}
64+
if (input.type === 'number') return 1;
65+
if (input.type === 'boolean') return true;
66+
return 'sample';
67+
};
68+
69+
const dashboard = (widget: Record<string, unknown>) => ({ type: 'dashboard', widgets: [widget] });
70+
71+
const registeredInputs = (type: string): Input[] =>
72+
(ComponentRegistry.getConfig(type)?.inputs ?? []) as Input[];
73+
74+
/** The widget slot's component-node arm: the union option whose `type` is the closed set. */
75+
const slotArm = (dashboardSchema: unknown): unknown => {
76+
let widgets = defOf(dashboardSchema).shape?.widgets;
77+
while (defOf(widgets).innerType) widgets = defOf(widgets).innerType;
78+
const options = defOf(defOf(widgets).element).options ?? [];
79+
const arm = options.find((option) => {
80+
const type = defOf(defOf(option).shape?.type);
81+
return type.type === 'enum';
82+
});
83+
if (!arm) throw new Error('no component-node arm found in the widget slot — the slot moved; re-read it before trusting this file');
84+
return arm;
85+
};
86+
87+
describe('objectui#11022 — widget-slot registrations vs the strict authoring face', () => {
88+
it('the population is the closed set, and it is not empty', () => {
89+
expect(DASHBOARD_COMPONENT_WIDGET_TYPES).toContain('metric-card');
90+
for (const type of DASHBOARD_COMPONENT_WIDGET_TYPES) {
91+
expect(registeredInputs(type).length, `\`${type}\` has no registered inputs to walk`).toBeGreaterThan(0);
92+
}
93+
// The registration the defect was measured on: `value` is its REQUIRED input.
94+
expect(registeredInputs('metric-card').find((i) => i.name === 'value')).toMatchObject({ required: true });
95+
});
96+
97+
describe.each([...DASHBOARD_COMPONENT_WIDGET_TYPES])('`%s`', (type) => {
98+
it.each(registeredInputs(type).map((input) => [input.name, input] as const))(
99+
'UNDER-admission: its registered input `%s` parses in the widget slot on the strict face',
100+
(name, input) => {
101+
const result = StrictAnyComponentSchema.safeParse(dashboard({ type, [name]: sampleFor(input) }));
102+
const issues = result.success ? [] : (result.error.issues as unknown as Issue[]);
103+
expect(unrecognized(issues), `the strict face refuses the registered input \`${name}\``).not.toContain(name);
104+
expect(result.success).toBe(true);
105+
},
106+
);
107+
108+
it('CONTROL — a key no registration declares is refused by name', () => {
109+
const result = StrictAnyComponentSchema.safeParse(dashboard({ type, notARegisteredInput11022: 1 }));
110+
expect(result.success).toBe(false);
111+
expect(unrecognized(result.success ? [] : (result.error.issues as unknown as Issue[]))).toContain(
112+
'notARegisteredInput11022',
113+
);
114+
});
115+
});
116+
117+
it('OVER-admission: every key the strict slot arm admits beyond the tolerant arm is a registered input', () => {
118+
const tolerantKeys = new Set(Object.keys(defOf(slotArm(DashboardComponentSchema)).shape ?? {}));
119+
const strictKeys = Object.keys(defOf(slotArm(deriveStrictAuthoringSchema(DashboardComponentSchema))).shape ?? {});
120+
const admitted = strictKeys.filter((key) => !tolerantKeys.has(key)).sort();
121+
const registered = new Set(
122+
DASHBOARD_COMPONENT_WIDGET_TYPES.flatMap((type) => registeredInputs(type).map((input) => input.name)),
123+
);
124+
// Non-vacuity: the derived arm does admit something the tolerant arm does not declare.
125+
expect(admitted).toContain('value');
126+
expect(
127+
admitted.filter((key) => !registered.has(key)),
128+
'the strict slot arm admits a key no widget-slot registration declares — remove it from '
129+
+ '`DASHBOARD_WIDGET_SLOT_REGISTERED_INPUTS` in `@object-ui/types`, or register it first',
130+
).toEqual([]);
131+
// And the other half, read the same way: nothing registered is left out.
132+
const missing = [...registered].filter((key) => !tolerantKeys.has(key) && !admitted.includes(key));
133+
expect(missing).toEqual([]);
134+
});
135+
});

‎packages/types/README.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,22 @@ Opaque `custom` / `function` / `transform` validators have no shape to close;
159159
`deriveStrictAuthoringSchema` reports each one it meets through the optional
160160
`onOpaqueShape` callback.
161161

162+
One node spells its props through the passthrough by design: a `metric-card`
163+
sitting directly in a dashboard's `widgets` slot, whose props are its
164+
registration's `inputs`. The strict face admits exactly the input names that
165+
registration declares on that node, each judged as the tolerant face judges it,
166+
and still refuses any other key by name (objectui#11022; the names are held to
167+
the live registration by a test in `@object-ui/plugin-dashboard`):
168+
169+
```typescript
170+
import { StrictAnyComponentSchema } from '@object-ui/types/zod';
171+
172+
const card = (widget: object) => ({ type: 'dashboard', widgets: [widget] });
173+
174+
StrictAnyComponentSchema.safeParse(card({ type: 'metric-card', value: 42 })).success; // true
175+
StrictAnyComponentSchema.safeParse(card({ type: 'metric-card', bogus: 1 })).success; // false — `bogus` is named
176+
```
177+
162178
## Type Categories
163179

164180
### Base Types

0 commit comments

Comments
 (0)