fix(metadata): stamp top-level name on view bodies at the write path (no dropped views)#1564
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
getMetaItems only overlays a sys_metadata row when its parsed body has a
top-level `name`. Loose `{ list }` / `{ form }` view fragments (emitted by
AI tools and hand-authoring) pass schema validation but carry no top-level
`name`, so the view was silently dropped from the object's view list and
never surfaced as a tab.
saveMetaItem now guarantees a top-level `name` on every view body at the
single write chokepoint, without reshaping the document — both the
defineView container form and the {name,object,viewKind,config} record form
are valid and the console consumes both, and reshaping risks producing an
invalid record (non-`<object>.<key>` name) or dropping Studio-only fields
(isPinned, sortOrder). Exported as normalizeViewMetadata and unit-tested.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
e3eeb15 to
d253d75
Compare
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.
What
getMetaItemsonly overlays asys_metadatarow when its parsed body has a top-levelname. Some view producers — notably loose{ list: <ListView> }/{ form: … }fragments that AI tools and hand-authoring emit — pass schema validation but carry no top-levelname, so the view was silently dropped from the object's view list and never appeared as a tab ("validates ≠ surfaces").This was the root cause behind the AI-built kanban/list views that validated but didn't render (follow-up to #1559 / #1563).
Fix
saveMetaItemnow guarantees a top-levelnameon everyviewbody at the single write chokepoint, before validation + persistence, so a nameless view is auto-corrected no matter which authoring path produced it.It deliberately does NOT reshape the document. Both legitimate forms are kept verbatim:
defineViewcontainer form ({ list, listViews, … }, expanded by the loader), and{ name, object, viewKind, config }record form.Reshaping a container into a record risks producing an invalid record (a non-
<object>.<key>name) and drops Studio-only fields (isPinned,sortOrder,isDefault). Exported asnormalizeViewMetadataand unit-tested (7 cases).Scope note (why no schema tightening here)
An earlier draft of this PR also tightened the
viewmetadata schema to reject garbage bodies (unknownviewKind, kanban config missinggroupByField,{}). I backed that out: theviewschema is a tangle of four loosely/inconsistently-validated shapes (record / container / flat-list / flat-form), and tightening it correctly requires first consolidating those shapes — done hastily it rejects real views (artifact/Studio/flat). That's a separate spec change; this PR keeps the safe, high-value core (every view becomes listable).Tests
normalize-view-metadata.test.ts— 7 cases (name-stamping without reshaping; containers/records/Studio-extras preserved; non-view types untouched; plural alias).protocol-meta.test.ts— view save/overlay regression (container, record, Studio-aux preservation, plural types, artifact overlay) all green.objectqlsuite green (505 tests).🤖 Generated with Claude Code