test(app-shell): 给 viewEnvelope 产出补 ViewItem spec 一致性 pin;MetadataProvider docblock 撤掉 "Legacy" 措辞 (#3375) - #3420
Merged
Conversation
…te; drop "Legacy" from the container docblock (#3375) Two cleanup tails from #3312 / objectstack#4959. 1. `viewEnvelope` (runtime-metadata-persistence.ts) is app-shell's second ViewItem producer; only `createBuildBody` had a spec-conformance pin. Adds the same-shaped ratchet: the envelope produced from each real call site payload must pass `ViewItemSchema.safeParse`. 2. MetadataProvider's docblock called the aggregated container "Legacy". objectstack#4959 ruled it a deliberate stack-level packaging shape, so the wording now names both gates (record vs stack) and states the branch is not dead code. Comment prose only, zero runtime-code changes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
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.
Fixes #3375
#3312 / objectstack#4959 的两条本仓侧尾巴,清理级,非缺陷。无任何运行时行为改动。
1.
viewEnvelope产出补 spec 一致性 pinpackages/app-shell/src/views/runtime-metadata-persistence.ts的viewEnvelope是 app-shell 的第二个 ViewItem 生产者;第一个(metadata-admin 的createBuildBody)早有view-create-body.test.ts守着,这里没有。新增同型 pin:packages/app-shell/src/views/runtime-metadata-persistence.viewItemSpec.test.tsObjectView.handleViewCreate(CreateViewDialog 的{ type, label, name, [type]: subConfig },加上该调用点对 kanban/gallery 的 column 补全)与ObjectDataPage.handleSaveAsView。config.data保留 / CJK label 的type_base36兜底 key。runtime-metadata-persistence.test.ts的分工:那边断言信封的字面形状(哪个键落在哪),spec 收紧时依然绿;这边断言产出能过记录门(ADR-0017 ViewItem),所以 spec 一动会在这里报出来,而不是拖到 publish 时。pin 方向按要求先预测后运行:这是 ratchet 不是 bug 复现,预期今天的代码上全绿 —— 实测即全绿。
反向验证做了两次(改完即还原,工作树干净):
viewEnvelopename: key)ViewItemNameSchema报 "View item name must be a dotted snake_case qualified name"config.data上的provider: 'object'即 pin 的两半(name 与 config)都是承重的,不是空绿。
补充一条 negative 用例钉住边界:没有 object 绑定时信封拿不到限定名,记录门必然拒绝 —— 两个调用点都在进 seam 前解析出了 object,这条把「为什么该前置条件是承重的」写下来。它在上面两次反向验证里保持绿(因为它断言的就是"无效"),属预期。
2.
MetadataProvider.tsxdocblock 撤掉 "Legacy"objectstack#4959 端到端裁定:container 是刻意的栈级打包形状,不是遗留物。docblock 改为并列两个门 —— 记录门(ADR-0017 ViewItem,
defineViewItem/ 运行时/metaseam)与栈门(container,defineView产出、defineStack({ views: [...] })携带),并写明该分支不是死代码。措辞前先核过 spec 而非直接采信 issue 正文:
@objectstack/spec/ui把 container 当一等公民(导出isAggregatedViewContainer/expandViewContainer,且defineView与defineViewItem是两个并列工厂),MetadataProvider.merge.test.ts也确有 container 形状的用例在跑 —— 所以"不是死代码"这句有测试兜底,不是纯断言。同时把分支上方两处仍写 "Legacy"/"New protocol" 的行内注释一并对齐(否则准备删这个分支的读者正好读到那两行)。该文件 diff 每一行都是注释文字,已机械核验(过滤掉注释前缀后无剩余变更行)。
测试
仓根跑 vitest(按 #3288 / #3378,不用包级过滤),已确认新文件名出现在 verbose 输出里:
app-shell 全量(仓根发起):
pnpm --filter @object-ui/app-shell type-check(tsc --noEmit && tsc -p tsconfig.typetests.json)通过。Changeset
未加。纯测试 + 注释,非用户可见;对照近期纯测试提交(
0c9983fcd,只动sectionLabelI18n.test.tsx)也未带 changeset,符合 AGENTS.md §9「功能改进才写 changeset」。顺带发现(未在本 PR 修)
已另开 #3419:
ObjectDataPage.handleSaveAsView把 URL 下钻的FilterTriple[](三元组数组)原样写进config.filter,而记录门要的是{ field, operator, value }对象数组 —— 带条件点「Save as view」写出的是 off-spec ViewItem。修它属运行时行为改动,不在本 PR 范围,故本 PR 的 filter 用例走的是viewFilterFold那条符合 spec 的产出。Generated by Claude Code