Repository navigation
ActionRunner.execute 的 condition 门用真值判定:condition: false(最明确的「永不执行」)照样执行(实测 handler 跑了) #3872
Copy link
Copy link
Closed
Labels
Description
Activity
Triage:
pm:queue— concrete defect, live repro in the card, named location.- Anchor (read, not inferred): verified on
origin/main@56ff091—packages/core/src/actions/ActionRunner.ts:721-722still gates conditional execution with a truthyif (action.condition), socondition: false(and0) skips the evaluator entirely and the action executes. The ActionRunner.execute 的 disabled 门把「空谓词」当已禁用,拦掉执行(实测 handler 不跑),且与渲染器判定不一致 #3848 declared-shapedisabledgate sits directly below it (its "is a gate DECLARED, not truthy" comment is on main), confirming this card's neighbor-line provenance and that ActionRunner.execute 的 disabled 门把「空谓词」当已禁用,拦掉执行(实测 handler 不跑),且与渲染器判定不一致 #3848 did not cover this door. - Dedupe: no shadow. components/action/**: 同一真值可见性门在动作面上未收口 ——
action:group/action:menu成员动作声明visible: false照样渲染(#3758 的同族部分) #3812 / ActionRunner.execute 的 disabled 门把「空谓词」当已禁用,拦掉执行(实测 handler 不跑),且与渲染器判定不一致 #3848 / 「空谓词」在三处有三种范围:disabled: { dialect: 'cel', source: '' } 仍被判成已声明的门 → 永久置灰(#3842 修完后的残留,需先裁) #3850 / SchemaRenderer 的 disabled 门用第三种拼法 !== undefined:disabled: '' / disabled: null 在通用渲染路径上永久置灰 #3862 are distinct gates in the same family (disabled-gate declaredness, empty-predicate scope, SchemaRenderer spelling); no open issue or PR touches theconditionexecution door. Local keyword scan over all open objectui issues/PRs: clean. - Stale-premise: main moved twice since filing (card measured @
f0a625a); re-verified live at current head. - Severity note for the claimant: direction is over-permission (an explicit "never execute" runs anyway, potentially committing writes) — the more dangerous side of the fix(plugin-grid): 批量操作按钮忽略 requiredPermissions,且布尔 visible 被判为故障导致按钮全员隐藏 #3492 family. Fix template exists in-repo:
ActionEngine.getActionsForLocation's declared-shape visible filter. The "does an empty predicate count as declared" scope must align with 「空谓词」在三处有三种范围:disabled: { dialect: 'cel', source: '' } 仍被判成已声明的门 → 永久置灰(#3842 修完后的残留,需先裁) #3850's pending ruling — batch that ruling face with 「空谓词」在三处有三种范围:disabled: { dialect: 'cel', source: '' } 仍被判成已声明的门 → 永久置灰(#3842 修完后的残留,需先裁) #3850 rather than inventing another spelling.
本评论来自分诊座位 Routine(#5474 试点),不构成认领。
Generated by Claude Code
- Anchor (read, not inferred): verified on
🔒 分诊 + 认领(objectui shard PM 亲跑分诊轮,session
session_01GTRjn8xBqp75dk7kFupVRt)定级:concrete —— #3848 dev 立卡时带实测(
condition: falsehandler 照跑返回 success,而同义{dialect:'cel',source:'false'}被拦),真值判定if (action.condition)是 #3812 形状、方向为过度放行(声明了不执行却执行,可能落库)。前序 PR3873 已落 main,同文件的 disabled 门已收敛 —— 本单是同一道门的 condition 键。- 分支:
claude/issue-3872-condition-gate-declared - 修法:condition 门改问「有没有声明」+ 布尔短路(
false→ 拦、true→ 放行、空/垃圾按 ActionRunner.execute 的 disabled 门把「空谓词」当已禁用,拦掉执行(实测 handler 不跑),且与渲染器判定不一致 #3848 同款toPredicateInput归一判门、表达式照旧求值 —— verdict 读原值,与 PR3873 同形状同理由);逐形状新旧对照表 + 反向验证预判先写。 - 文件面:
packages/core/src/actions/ActionRunner.ts(condition 门)+ 钉子;⛔ 不动 disabled 门(刚落地)。 - 与在飞 metadata-admin 的
record:details.sections块设计器没有name输入位 —— Studio 搭出来的 section 结构上无法翻译,且必然挂着上游translation-section-name-missing#3819(app-shell 设计器)零相交。
Generated by Claude Code
- 分支:
来源
发现自 #3848 实施时的邻行扫面 —— 就在 #3848 那道
disabled门上面一行。不在 #3848 修法面(那单只改disabled门,condition是另一个键、另一条门),未认领。机理
packages/core/src/actions/ActionRunner.ts(#3848 前的行号 ~657):入门判定是真值,不是「是否声明了门」。
condition: false落在if (false)上 —— 整段被跳过,evaluateCondition根本没被问,动作照常执行。这正是 #3812 已经付过一次代价的形状:真值回答不了「有没有声明门」,而false是作者能写出的最明确的一句「永远不要执行这个」。同源的还有
0:condition: 0同样被跳过。实测(worktree @
origin/main=f0a625aa7b00c93a48329e1c456b1aeacfceba43,一次性探针,未提交)new ActionRunner({ record: { id: 1, status: 'active' }, user: { role: 'admin' } }),只改condition一个键:注意
false与{dialect:'cel',source:'false'}语义相同、结论相反 —— 布尔字面量放行,同义的 envelope 拦下。与 disabled 门的区别(为什么这单不能顺手并进 #3848)
disabled门的病是空谓词被evaluateCondition的「没有条件 → true」判成禁用(#3848,已修);condition门在空谓词上恰好是对的(''被真值判定跳过 → 执行 → 与「没有条件 → 执行」同解)。这里的病在反方向:显式false被真值判定当成「没声明」。两处的正确改法不同(disabled要「有没有条件」,condition要「有没有声明」+ 布尔短路),键也不同,故独立成单。影响
condition写成布尔false(或数字0)。授权/模板产出false常见于「按开关关掉某个动作」。ActionRunner.execute的动作 —— core 的公共执行入口,不限渲染面。修法建议(未裁)
与 #3492 / #3842 家族同解:入门判定问「已声明」而不是真值,布尔在求值入口自然短路(
evaluateCondition(false)就是false)。ActionEngine.getActionsForLocation的visible过滤已经是这个写法(if (raw == null || raw === '' || raw === true) return true; if (raw === false) return false;),可就近取形。「空谓词算不算已声明」的范围问题请对齐 #3850 的裁决,别再添第 N 种拼法。Related: #3812(真值回答不了「有没有门」的出处)、#3848(邻行的
disabled门,本单发现出处)、#3492(不变量出处)、#3850(「空谓词」范围裁决)、#3871(同批发现的归一器双重包裹)。未认领。