Skip to content

fix(metadata): stamp top-level name on view bodies at the write path (no dropped views)#1564

Merged
xuyushun441-sys merged 1 commit into
mainfrom
fix/normalize-view-write-path
Jun 3, 2026
Merged

fix(metadata): stamp top-level name on view bodies at the write path (no dropped views)#1564
xuyushun441-sys merged 1 commit into
mainfrom
fix/normalize-view-write-path

Conversation

@xuyushun441-sys
Copy link
Copy Markdown
Contributor

@xuyushun441-sys xuyushun441-sys commented Jun 3, 2026

What

getMetaItems only overlays a sys_metadata row when its parsed body has a top-level name. Some view producers — notably loose { list: <ListView> } / { form: … } fragments that AI tools and hand-authoring emit — pass schema validation but carry no top-level name, 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

saveMetaItem now guarantees a top-level name on every view body 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:

  • the defineView container form ({ list, listViews, … }, expanded by the loader), and
  • the { 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 as normalizeViewMetadata and unit-tested (7 cases).

Scope note (why no schema tightening here)

An earlier draft of this PR also tightened the view metadata schema to reject garbage bodies (unknown viewKind, kanban config missing groupByField, {}). I backed that out: the view schema 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.
  • Full objectql suite green (505 tests).

🤖 Generated with Claude Code

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 3, 2026 9:17am

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation tests tooling size/m and removed documentation Improvements or additions to documentation tests tooling labels Jun 3, 2026
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>
@xuyushun441-sys xuyushun441-sys force-pushed the fix/normalize-view-write-path branch from e3eeb15 to d253d75 Compare June 3, 2026 09:15
@github-actions github-actions Bot added documentation Improvements or additions to documentation tests tooling labels Jun 3, 2026
@xuyushun441-sys xuyushun441-sys changed the title fix(metadata): normalize view bodies at the write path (systemic — no console-unusable views) fix(metadata): stamp top-level name on view bodies at the write path (no dropped views) Jun 3, 2026
@xuyushun441-sys xuyushun441-sys merged commit 6fc2678 into main Jun 3, 2026
12 checks passed
@xuyushun441-sys xuyushun441-sys deleted the fix/normalize-view-write-path branch June 3, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants