Skip to content

view metadata type-schema is a no-op for runtime shapes: ViewItem/personalization bodies strip to {} under ViewSchema #3095

Description

@os-zhuang

问题

metadata-type-schemas.tsview 映射到 容器 ViewSchema({ list, form, listViews, formViews },四槽全 optional,Zod 默认 strip 未知键)。但 view 类型在运行时实际承载三种形态:

  1. defineView 聚合容器(裸 <object> 键,back-compat 保留);
  2. 展开/运行时创建的独立 ViewItem(name/object/viewKind/config,metadata-create-seeds.ts 的 create seed 就是这个形态);
  3. Runtime view overlay drops viewKind/object — one grid sort permanently removes the view from the switcher #2555 个性化 overlay(裸 view config + viewIdentityPatch 补的 viewKind/object/label identity)。

形态 2/3 经 ViewSchema.safeParse 会被剥成 {} 然后通过 —— 即:

  • saveMetaItem 的 422 校验对 ViewItem/个性化写入形同虚设(任意坏 config 都过);
  • computeMetadataDiagnostics 对枚举出的每个 ViewItem 返回 valid: true(空转);
  • metadata-create-seeds.test 里 view seed「通过」type schema 校验也是同一空转的假绿。

为什么没在 #3096(flat-view 修复 PR)一并收

作者侧已经堵住(defineView() 零视图抛错 + os validate 新增 view-container-shape 检查)。运行时侧若直接给 ViewSchema 加 refine,会把上面 2/3 两种合法形态全部打红/422(Console 个性化保存直接回归);正确修法需要:

这需要独立的 runtime 测试面,不适合塞进 docs/skills 修复 PR。

验收

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions