feat(spec): authoritative per-type create seeds + validating test#2270
Merged
Conversation
Root-cause fix for the recurring "the designer creates a minimal item the spec rejects, so create→save 422s" family (dashboard `layout`, action `body`, report stale anchors). The create-form's default shape was invented client-side (objectui `createDefaults`) and drifted from the spec's required fields with nothing validating the two against each other. Add `metadata-create-seeds.ts` — the single source of truth for each type's minimal valid create shape, co-located with the schemas. `metadata-create- seeds.test.ts` asserts every seed validates against its `metadata-type-schemas` schema (the canonical guard, at the most authoritative layer) and accounts for every schema-backed type (seeded or explicitly known-unseeded — e.g. canvas- create `report`). Seeds the 9 core Studio-designer types. Phase 1 of the spec-derived create-shape contract; Phase 2 exposes `createSeed` via /meta/types so the Studio designer derives its defaults from here instead of re-inventing them. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 91 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
os-zhuang
added a commit
that referenced
this pull request
Jun 24, 2026
…-shape contract, Phase 2) (#2276) Phase 1 (#2270) added the authoritative minimal create seeds in @objectstack/spec/kernel. Phase 2 delivers them to consumers: every /meta/types entry now carries an optional `createSeed`, so the Studio designer / CLI / API derive create defaults from the spec's single source of truth instead of re-inventing `createDefaults` (the drift that produced the dashboard-`layout` and action-`body` create→save 422s). - spec: barrel-export getMetadataCreateSeed / listMetadataCreateSeedTypes from /kernel; add optional `createSeed` to the GetMetaTypesResponse entry schema; regenerate api-surface (purely additive — 2 new exports). - objectql: getMetaTypes() attaches each type's seed to registry + runtime entries. Canvas-create types built interactively (report) stay absent. - dogfood: meta-types-create-seed.dogfood.test.ts asserts /meta exposes the dashboard/action seeds end-to-end and omits report's (4 pass). Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A recurring family found dogfooding the Studio designers: the designer creates a minimal item the spec rejects, so create → save 422s — a new dashboard lacked
layout, a newscriptaction lacksbody, a new report carried staleobjectName/columns. Root cause: the create-form's default shape is invented client-side (objectuicreateDefaults) and drifts from the spec's required fields, with nothing validating the two against each other.Per-instance fixes (#2247 dashboard, objectui#1950 action) + guards (#2260, objectui#1950) treat the symptoms. This anchors the create shape to the spec so it can't drift — the root cause.
What (Phase 1)
packages/spec/src/kernel/metadata-create-seeds.ts— the single source of truth for each type's minimal valid create shape (getMetadataCreateSeed(type)), co-located with the schemas. Seeds the 9 core Studio-designer types: dashboard, action, page, view, flow, validation, hook, dataset, object.metadata-create-seeds.test.ts— asserts every seed validates against itsmetadata-type-schemasschema (the canonical guard, at the most authoritative layer), returns fresh clones, and accounts for every schema-backed type (seeded or explicitly known-unseeded, e.g. canvas-createreport).Each seed reuses the exact shape proven save-valid (200) against the real backend while dogfooding.
Verification
vitest run metadata-create-seeds.test.ts→ 12 passed (9 seed-validates + sanity + clone + no-silent-cap coverage).Phase 2 (follow-up)
Expose
createSeedper type via/meta/types(protocolgetMetaTypes+ rest), then the Studio designer (objectuianchors.ts) derives itscreateDefaultsfrom the spec seed instead of hardcoding it — at which point the objectui conformance guard (objectui#1950) becomes a pure consistency check.🤖 Generated with Claude Code