Skip to content

Commit 57f2e2c

Browse files
committed
skills(ui): fix schema-enum errors and broken pointers; correct contract generator
Third-party review found a dense cluster of P0 schema errors that made generated UI metadata fail os validate or render unknown components: - Page types are record|home|app|utility|list — record_detail/ app_launcher/utility_bar don't exist; page examples fixed (type: 'record', object: not objectName:) and all definePage/defineDataset examples now carry the required label. - Interface-page rule updated to the revised ADR-0047 model: the page IS the view definition (page-owned columns/sort/filterBy); sourceView is a deprecated fallback. - Report types = tabular|summary|matrix|joined (charts are the embedded chart: config); dashboard widget type is the 18-value ChartTypeSchema taxonomy; widget placement is optional layout (not required position). - Action locations: global → global_nav (+record_related/ record_section); nav divider → separator; requiresCapability → requiresService; component names record:related_list, line_items, object-metric/object-chart, <object-grid> — all verified against the objectui block registry. - DATE_MACRO_TOKENS/isDateMacroToken import from @objectstack/spec/data (not root); monorepo-relative ADR/examples/content pointers replaced with plain text or shipped zod paths; stale dated objectui coverage scan removed. - build-react-blocks-contract.ts no longer marks .default()-carrying props as required (Zod v4 output-io artifact); contract + reference regenerated; provenance now cites the @objectstack/spec/ui module instead of a non-shipping src path; evals cleaned of internal issue refs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Kj2MJEPXoUXC4LiC3XYJc
1 parent cdfc492 commit 57f2e2c

6 files changed

Lines changed: 171 additions & 167 deletions

File tree

packages/spec/scripts/build-react-blocks-contract.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ function dataProps(schema: any, allow?: string[]): Prop[] {
7777
name,
7878
type: renderType(node),
7979
kind: 'data',
80-
required: required.includes(name),
80+
// z.toJSONSchema emits output-io semantics, where a `.default()`-carrying
81+
// prop is always present — so it lands in `required` even though an author
82+
// may omit it. A prop with a default is optional to WRITE, which is what
83+
// this contract documents; only default-less required props stay required.
84+
required: required.includes(name) && node?.default === undefined,
8185
description: clip(node?.description),
8286
}));
8387
}
@@ -101,7 +105,7 @@ const blocks = REACT_BLOCKS.map((b) => {
101105
const contract = {
102106
version: 2,
103107
adr: 'ADR-0081',
104-
source: 'GENERATED from packages/spec/src/ui/react-blocks.ts — data props from the spec zod schemas, binding/controlled/callback from the React overlay.',
108+
source: "GENERATED from the REACT_BLOCKS definition in the '@objectstack/spec/ui' module — data props from the spec zod schemas, binding/controlled/callback from the React overlay.",
105109
note: "Props each component accepts in kind:'react' page source. Reference blocks by their PascalCase tag. kind: data=declarative config (from the spec schema) · binding=connects to data · controlled=React state · callback=React function. These blocks are for DATA. Live data: const adapter = useAdapter(); adapter.find/findOne/create/update. STYLING (ADR-0065) — a page's source is runtime metadata, so the console's build-time Tailwind NEVER scans it: utility classNAMES silently produce no CSS. Do NOT use Tailwind className in page source. (a) Layout/chrome: inline style={} with hsl(var(--token)) theme colors — e.g. color:'hsl(var(--foreground))', background:'hsl(var(--card))', border:'1px solid hsl(var(--border))', and px/flex for layout. (b) Overlays: render <ObjectForm formType='drawer'|'modal' open onOpenChange> (a pre-styled Sheet/Dialog) — never hand-roll a fixed inset-0 backdrop.",
106110
blocks,
107111
};
@@ -112,7 +116,7 @@ const esc = (s: string) => String(s).replace(/\|/g, '\\|');
112116
const L: string[] = [];
113117
L.push('---');
114118
L.push('title: React-tier component contract');
115-
L.push("description: Props each injected component accepts in kind:'react' page source (ADR-0081). GENERATED from packages/spec/src/ui/react-blocks.ts — do not edit by hand.");
119+
L.push("description: Props each injected component accepts in kind:'react' page source (ADR-0081). GENERATED from the REACT_BLOCKS definition in the '@objectstack/spec/ui' module — do not edit by hand.");
116120
L.push('---');
117121
L.push('');
118122
L.push('{/* GENERATED by packages/spec/scripts/build-react-blocks-contract.ts — do not edit. */}');

0 commit comments

Comments
 (0)