Skip to content

Commit db3d462

Browse files
committed
fix(ui-types): DashboardComponentSchema takes the spec globalFilters slot by reference
The mirror rebuilt globalFilters as z.array(GlobalFilterSchema), which kept every element check and dropped the spec array's own refinement: two global filters under one key passed the published mirror while every spec door refuses them. Take StrippedSpecDashboard.shape.globalFilters instead. Also corrects the FormView key taxonomy docblock: drawerSide/drawerWidth are tombstones on the spec form view and live on as ObjectForm's own props. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUAK3FofY5VJPyS8fr
1 parent a644163 commit db3d462

2 files changed

Lines changed: 22 additions & 8 deletions

File tree

‎ui/packages/types/src/objectql.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1769,10 +1769,12 @@ export type SubmitBehavior =
17691769
*
17701770
* - **[spec-aligned]** — same name & semantics as `@objectstack/spec`
17711771
* `FormViewSchema` (`title`, `description`, `layout`, `columns`, `sections`,
1772-
* `defaultTab`, `tabPosition`, `allowSkip`, `showStepIndicator`, `drawerSide`/`drawerWidth`,
1772+
* `defaultTab`, `tabPosition`, `allowSkip`, `showStepIndicator`,
17731773
* `modalSize`, `subforms`, `submitBehavior`; `formType` ↔ spec `type`).
17741774
* - **[ObjectUI extension]** — serializable renderer extras with no spec
17751775
* backing yet (button visibility/labels, `className`, `initialValues`,
1776+
* `drawerSide`/`drawerWidth` — tombstones on the spec form view, the React
1777+
* `ObjectForm` block's own props,
17761778
* `fields`/`customFields`, …). Candidates for upstreaming are tracked in
17771779
* #2545; until then they are sanctioned, documented extensions.
17781780
* - **[runtime-only]** — non-serializable runtime concerns that never belong

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

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,11 +1646,20 @@ export const GlobalFilterSchema = stripImportedDefaults(SpecGlobalFilterSchema);
16461646
* - `widgets` — objectui's element schema is its own ledger entry (the local
16471647
* widget still carries the legacy `component` envelope the spec has no room
16481648
* for); migration deferred.
1649-
* - `globalFilters` — re-added below over the exported {@link GlobalFilterSchema},
1650-
* which since objectui#7759 IS the spec's element schema by reference, so the
1651-
* accept set equals the spec member's; the separate const is kept because it
1652-
* is published API. (It used to be "deliberately looser than spec's" — the
1653-
* bare-string option shorthand and a relaxed `optionsFrom` — see that const.)
1649+
* - `globalFilters` — re-added below as the spec's own SLOT, by reference
1650+
* (`StrippedSpecDashboard.shape.globalFilters`): the array whose element is
1651+
* the exported {@link GlobalFilterSchema} (since objectui#7759 the spec's
1652+
* element schema by reference) and which carries the spec's array-level
1653+
* refinement, so the accept set equals the spec member's. objectstack#29284:
1654+
* until then this mirror rebuilt the array as `z.array(GlobalFilterSchema)`,
1655+
* which kept every element check and dropped the array's own — the refusal
1656+
* of two filters under one key (a filter's `name`, else its `field`;
1657+
* objectstack#29023) — so this validator went green on a dashboard every
1658+
* spec door refuses. It stays on the excluded list because that list is
1659+
* published API and the TypeScript twin in `../complex.ts` restates the key
1660+
* over the same element type. (It used to be "deliberately looser than
1661+
* spec's" — the bare-string option shorthand and a relaxed `optionsFrom` —
1662+
* see {@link GlobalFilterSchema}.)
16541663
*
16551664
* `dateRange` was a third member of that list until objectui#10334. Its local
16561665
* element (`defaultRange` a bare `z.string()`, a stripping object) admitted
@@ -1679,7 +1688,8 @@ export const DASHBOARD_SPEC_EXCLUDED = [
16791688
// TypeScript twin in `../complex.ts`, which extends `Omit< Dashboard, … >` over the same
16801689
// array — so the published validator and the published type project one spec
16811690
// surface and cannot drift apart again.
1682-
const SpecDashboardFields = specFieldsExcept(stripImportedDefaults(SpecDashboardSchema).shape, DASHBOARD_SPEC_EXCLUDED);
1691+
const StrippedSpecDashboard = stripImportedDefaults(SpecDashboardSchema);
1692+
const SpecDashboardFields = specFieldsExcept(StrippedSpecDashboard.shape, DASHBOARD_SPEC_EXCLUDED);
16831693

16841694
/**
16851695
* Dashboard Schema — the objectui dashboard renderer node, derived from
@@ -1703,7 +1713,9 @@ export const DashboardComponentSchema = BaseSchema.extend(SpecDashboardFields.sh
17031713
// (see `closeStrictUnionArms` in `./node-derivation.ts`).
17041714
widgets: z.array(z.union(closeStrictUnionArms([DashboardWidgetSlotComponentSchema, DashboardWidgetSchema] as const)))
17051715
.describe('Dashboard widgets'),
1706-
globalFilters: z.array(GlobalFilterSchema).optional().describe('Dashboard-level filters'),
1716+
// The spec's slot by reference, refinement included (objectstack#29284; see the
1717+
// `globalFilters` bullet on `DASHBOARD_SPEC_EXCLUDED`).
1718+
globalFilters: StrippedSpecDashboard.shape.globalFilters,
17071719
body: retirementTombstone(
17081720
'REFUSED (objectui#9256, ADR-0049) — `dashboard` reads NEITHER content channel: measured with the '
17091721
+ 'TypeScript type checker across all 24 registering packages, no renderer read consumes `body` or '

0 commit comments

Comments
 (0)