This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
Commit 0eb9f36
fix(types): the strict authoring face admits the widget-slot
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>metric-card's registered inputs (objectui#11022) (#11023)1 parent 12a6688 commit 0eb9f36
8 files changed
Lines changed: 532 additions & 6 deletions
File tree
- .changeset
- packages
- plugin-dashboard/src/__tests__
- types
- src
- __tests__
- zod
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 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 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
162 | 178 | | |
163 | 179 | | |
164 | 180 | | |
| |||
0 commit comments