Skip to content

Commit 05c8d31

Browse files
committed
fix(types): name the parser tier in the metric-card label refusal's silence clause (objectui#4425)
The objectui#10981 closure walk requires every "no render-time error or warning" sentence to say what the parser tier does. Measured with the manifest built the way gen-manifest builds it: `dashboard` declares no `widgets` slot, so `validateTree` never reaches a widget-slot card and draws nothing for its `label` (control: an undeclared key on the dashboard itself draws `unknown-prop`). The zod message, the TypeScript member's docblock and the changeset now say so. Claude-Session: https://claude.ai/code/session_01FngvPpdrnhHMdHHq6vwwju Co-authored-by: Claude <noreply@anthropic.com>
1 parent 3ac08c8 commit 05c8d31

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎.changeset/4425-metric-card-label-refused.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ BREAKING (`@object-ui/types`): a `metric-card` in a dashboard's `widgets[]` that
99
- FROM `{ "type": "metric-card", "label": "Total Revenue", "value": "$123,456" }`
1010
- TO `{ "type": "metric-card", "title": "Total Revenue", "value": "$123,456" }`
1111

12-
Why: `MetricCard` draws `title` as the card heading and reads no `label`. `label` is how the sibling `metric` node spells its heading, and the card inherited it from `BaseSchema`, so a card authored with `label` validated on every face and drew no heading, with no warning. The objectui#8284 ruling settles which way to go: one spelling per rendered thing, and the other spelling is refused by name.
12+
Why: `MetricCard` draws `title` as the card heading and reads no `label`. `label` is how the sibling `metric` node spells its heading, and the card inherited it from `BaseSchema`, so a card authored with `label` validated on every face and drew no heading. Nothing said so: no render-time error or warning, and the parser tier's `validateTree` does not walk a dashboard's `widgets`. The objectui#8284 ruling settles which way to go: one spelling per rendered thing, and the other spelling is refused by name.
1313

1414
**Migration.** Rename the key to `title`. The value keeps its type: a plain string or an inline per-locale map.
1515

‎packages/types/src/complex.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2478,9 +2478,11 @@ export interface DashboardWidgetSlotComponentSchema extends BaseSchema {
24782478
* (`plugin-dashboard:metric-card`) declares `title`, and `MetricCard` draws
24792479
* `title` as the heading. `label` is how the sibling `metric` node
24802480
* (`plugin-dashboard:metric`) spells its heading, so an author who knows that
2481-
* node wrote it here and got a card with no heading and no warning. Under
2482-
* the objectui#8284 ruling (one spelling per rendered thing) the member is
2483-
* restated as a refusal, in the shape `body` / `children` below take.
2481+
* node wrote it here and got a card with no heading: no render-time error or
2482+
* warning, and the parser tier's `validateTree` does not walk a dashboard's
2483+
* `widgets`. Under the objectui#8284 ruling (one spelling per rendered thing)
2484+
* the member is restated as a refusal, in the shape `body` / `children` below
2485+
* take.
24842486
*
24852487
* The zod twin is the private slot arm in `zod/complex.zod.ts`, which
24862488
* refuses `label` by name and names `title` in the message.

‎packages/types/src/zod/complex.zod.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,8 +1250,9 @@ const METRIC_CARD_LABEL_IS_TITLE =
12501250
+ 'spells its heading `title`. The registration (`plugin-dashboard:metric-card`) declares `title`, and '
12511251
+ '`MetricCard` draws it as the card heading; nothing on that path reads `label`, which is how the sibling '
12521252
+ '`metric` node (`plugin-dashboard:metric`) spells its heading. An authored `label` therefore drew a card '
1253-
+ 'with NO heading, and no render-time error or warning. Write the heading as `title`: a plain string or '
1254-
+ 'an inline per-locale map.';
1253+
+ 'with NO heading, and no render-time error or warning; nor did the parser tier\'s `validateTree` notice it, '
1254+
+ 'because it does not walk a dashboard\'s `widgets`. Write the heading as `title`: a plain string or an '
1255+
+ 'inline per-locale map.';
12551256

12561257
/**
12571258
* A COMPONENT node sitting directly in a dashboard's widget slot — the

0 commit comments

Comments
 (0)