test(filter-parity): 给两处 spec 词表减法加排除项存活棘轮 (#3628) - #3640
Merged
Conversation
Both filter-operator parity tests subtract a hand-written exclusion set from the spec-derived VIEW_FILTER_OPERATORS vocabulary, but neither asserted that the subtracted tokens are still members of it. Once the spec retires or renames is_empty / is_not_empty the subtraction silently becomes a no-op: the sweep stays green (still total over what remains) while the excluded rows turn into dead weight whose comments describe an operator no author can declare. Same shape as #3601, where 37 of 82 deny-list entries went inert unnoticed. Adds one collected-then-asserted ratchet per file, naming the dead tokens in the failure message. Existing assertions unchanged. 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 #3628
与 #3601 / PR #3623 同一手法的预防性棘轮:两处 filter-operator 平价测试各自从 spec 派生的
VIEW_FILTER_OPERATORS里减去一个手写排除集,却没有任何一条断言被减的 token 仍然是那份词表的成员。各加一条存活断言。问题形状
packages/plugin-list/src/__tests__/filter-operator-ast-parity.test.ts——HANDLED_BEFORE_MAPPINGpackages/data-objectstack/src/filter-operator-ast-parity.test.ts——NOT_THIS_ADAPTERS_JOB两处减的都是
is_empty/is_not_empty,排除理由都成立(视图层在mapOperator/ 适配器被问到之前就把它们改写成 null 比较)。缺的是排除项自身的存活断言。上游一旦把这两个 token 退役或改名,减法就变成一次空减法:平价扫描依然全绿(它对剩下的 token 仍然是完整的),但排除行成了死重,注释还会继续对下一位读者宣称「视图层会先改写这一个」—— 而那时已经没有作者能声明这个 operator 了。这正是 #3601 里 82 条拒绝名单烂掉 37 条的同一个形状:一份手写清单挂在 spec 派生的词表旁边,却没有一条断言清单成员仍然存在于那份词表。
测量(在本分支 worktree 重测,非照抄 issue 正文)
worktree 装的是 lockfile 解析的
@objectstack/spec@17.0.0-rc.5:与 issue 正文一致:19 项词表,两条今天都还在,排除当前是有效的 —— 这条是预防性的,不是已兑现的腐化,没有任何现存排除项需要删除。
实现取舍
toBe(true)(照抄 PR test(types): 删除 37 条随 spec 退役而失效的 DROPPED_SCHEMA_EXPORTS,并加棘轮断言 (#3601) #3623 的设计取舍):词表退役是整族落地的,逐条断言会停在第一条、藏住其余。失败信息点名死项,并提示「spec 已退役,请把它从排除集删除」而不是留一次死减法。new Set< string >(VIEW_FILTER_OPERATORS)而不是 issue 正文建议的VIEW_FILTER_OPERATORS.includes(op):VIEW_FILTER_OPERATORS在 spec 的 d.ts 里是readonly ["equals", …]字面量元组,.includes()只接受该字面量联合,传Set< string >迭代出的string会是 TS 错误。Set查表既过了类型也是 O(1)。it与排除集 doc 注释里指向棘轮的一句。逆向验证(先预测后运行,两个方向都如预测)
在两个排除集里临时塞一个词表从未有过的 token
never_existed_op:Test Files 2 passed (2),Tests 42 passed (42)Test Files 2 failed (2),Tests 2 failed / 42 passed (44)修后那一轮的失败输出(两个文件对称,摘 plugin-list 一条):
修前那一轮绿就是恒真缺陷的现场演示:两条排除行这些年一直处在「没人能发现它失效」的状态。验证后假 token 已还原,提交里不含它(见 diff)。
验证
首轮 type-check 因新 worktree 未构建依赖而报
Cannot find module '@object-ui/components'(AGENTS.md §9 那个陷阱),先跑pnpm --workspace-concurrency=2 --filter '@object-ui/plugin-list^...' --filter '@object-ui/data-objectstack^...' build后即通过 —— 与本改动无关。无 changeset:测试-only 改动,不触碰任何包的公开面、运行时行为或类型导出 —— 按仓例(changeset 用于 user-visible 变更)无需 changeset,同 PR #3623 先例。
文件面:两个测试文件,+63 −1。
🤖 Generated with Claude Code
https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt