fix(framework): 可见性谓词求值失败去静默——每谓词 warn 一次带源文本与原因 (#5149) - #3541
Merged
Conversation
Refs objectstack-ai/objectstack#5149 (appeal 2 of the half-approved ruling, 2026-08-06). evalFieldPredicate now logs one console.warn per predicate text on any evaluation failure (parse / not-ok / throw), with the predicate source, the engine's failure reason, and the caller's field/rule locator. Verdicts are byte-for-byte unchanged: still fail-open to the caller's safe default — flipping that default is appeal 1, deliberately NOT in this change. Fault-probing callers (evalRowPredicate fail-closed path, ExpressionEvaluator throwOnError) opt out via diagnostic.warn=false and keep their own single diagnostic, so no broken predicate ever warns twice. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015a5qkLzpGXhLL2F5gvJ7dD
|
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.
Refs objectstack-ai/objectstack#5149(⛔ 非 Fixes——诉求 1 仍在决策箱,本 PR 不关闭该 issue)
按维护者半裁(2026-08-06 10:39Z)落地已放行半边:诉求 2(求值失败去静默)+ 诉求 4(
record.绑定文档验收)。改了什么(诉求 2)
issue 摘的混淆产物
function A(e,t,n,r,i)即@object-ui/core的evalFieldPredicate(packages/core/src/evaluator/fieldRules.ts)。三种失败形状——表达式 parse 失败、ExpressionEngine.evaluate返回 not-ok、防御性 catch 捕获 throw——现在都:console.warn恰好一次(模块级按「谓词文本」去重,dialect+source 为键,JSON 编码——不用控制字符分隔,objectstack#5450 教训),内容含:谓词源文本、引擎失败原因([kind] message)、调用点提供的定位信息(如visibleWhen of field 'amount')、实际采用的默认值;定位信息线程化(有多少上下文给多少):
resolveFieldRuleState新增可选fieldContext,warn 报visibleWhen/readonlyWhen/requiredWhen of field 'x';conditionalFormatting[i]标签)全部传入定位;evalRowPredicatefail-closed 路径、ExpressionEvaluator.throwOnError——两处都是双求值探测)传warn: false,保留自己原有的单条诊断:每个坏谓词全局恰好一条 warn,listConditional 既有计数断言不破。措辞对齐服务端「log and allow」惯例(
readonlyWhen for 'x' failed to evaluate — change allowed through)与仓内既有warnEvalError风格([object-ui]前缀、Set 去重、JSON.stringify源文本)。文档同步:ADR-0036 增补 Amendment、content/docs/guide/metadata-diagnostics.md增补运行时诊断段。测试(全部实跑)
warn: false抑制;context 定位;resolveFieldRuleState规则种类+字段定位;引擎 throw 形状([throw]);pnpm exec vitest run packages/core/ packages/components/ packages/plugin-form/⇒ 187 files / 2418 tests 全绿;pnpm exec vitest run packages/app-shell/src/views/⇒ 180 files / 1585 tests 全绿(1 skipped 既有);turbo run type-check lint(core / components / plugin-form / app-shell)⇒ 36/36 任务成功;node scripts/check-control-bytes.mjs⇒ OK。诉求 4 验收(文档半边——判定:已存在,零改动)
裁决指向的 describe 在 objectstack 仓
packages/spec/src/ui/view.zod.ts(origin/main)已完整:record+current_user(runtime forms) ordata(metadata forms)」,示例即record.前缀写法(record.priority == 'urgent');范围红线(照裁决)
Changeset
.changeset/predicate-eval-failures-warn-once.md——四包 patch(行为不变、纯诊断增强)。Generated by Claude Code