This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
fix(grid): 批量 action 的 visible 改为逐条记录求值 (#3067) - #3070
Merged
Merged
Conversation
) The bar evaluated `visible` against the ambient scope with no record bound. That does not fail open — the lenient evaluator returned `true` for EVERY row-scoped predicate, including ones that should be false: `${record.done}` and `${record.owner == user.id}` both came back `true` with no record in scope. The authored gate was inverted for half its inputs, indistinguishable from a real verdict. `visible` is now evaluated once per selected record with that record in scope, fail-closed per record and warning once on a fault — the row kebab's contract. One evaluation answers both questions: the button is offered when at least one selected record passes, and the run acts only on those. A record-free predicate answers identically for every row, so a plain feature/permission gate still behaves as a button-level gate with no syntactic sniffing for `record`. The confirm step reports how many records were skipped, so a run narrower than the user's selection says so. Eligibility is re-applied to the expanded set after "select all N matching", not just the page selection the button saw. Reverse-control: with only BulkActionBar.tsx + ObjectGrid.tsx reverted, the two new positive assertions fail (all selected records dispatched instead of the eligible one; button rendered when nothing qualifies). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 #3067。按 issue 里的方案 (A) 实现。
根因回顾
选择栏用没有绑定 record 的 ambient 作用域求值
visible。这不是「求不出来所以放行」—— 宽松求值对任何行级谓词都返回true,包括本该为 false 的:${!record.done}truetrue${record.done}truefalse${record.owner == user.id}true作者写的门禁不是被削弱,而是对一半输入给出了相反答案,且调用方无从分辨。
方案 (A):一次求值,回答两个问题
visible现在逐条选中记录求值、record 在作用域内,逐条失败关闭 + 首次故障 warn —— 和行菜单同一套契约。由此:关键在于不需要去语法嗅探谓词有没有引用
record:不引用 record 的谓词(features.x/current_user.y)对每一行给出相同答案,因此天然退化成「按钮级门禁」,行为与今天一致。这是我选 (A) 而不是拆解谓词的原因 —— 拆解只能靠脆弱的字符串启发式。「全选 N 条匹配」展开后会重新做一次资格过滤,而不是只信按钮当时能看到的当页选择 —— 否则展开进来的记录会绕过门禁。
用户可见变化
grid.bulk.skippedIneligible)。验证
BulkActionBar.tsx+ObjectGrid.tsx后,两条新增正向断言失败 —— 全部选中记录都被派发(应只派发合格的那条)、无合格记录时按钮仍渲染。{dialect,source}信封、空选择),3 条驱动真实 grid(只跑合格记录 + 跳过提示、无合格记录隐藏按钮、无门禁 action 照旧全量)。plugin-grid+i18n61 文件 / 520 测试全绿;type-check 31 任务全过;改动文件 0 lint error。🤖 Generated with Claude Code