Skip to content

fix(app-shell): a parenthesised metadata form condition is evaluated as a group, so the field form offers percent and currency rows only where the type allows - #38262

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-59mr8a
Nov 28, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-59mr8a

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread

Fixes #38070
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

Clause-②: no
Metadata-protocol: none

维护者速读

  • 管理员在 Studio 编辑字段时,「百分比显示」只在百分比字段和返回百分比的公式上出现,「货币」设置只在货币字段和返回货币的公式上出现;以前文本、货币、数字公式和空白字段上两组都会出现。
  • 替每个打开字段编辑器的管理员解决:表单里带括号的显示条件以前一律被当成「显示」。
  • 只改 Studio 表单读条件的方式,读不懂的条件照旧显示(按既有裁决);出问题最多是某行该出现没出现或反之,可以直接撤回。
  • 无

What changes

  • ui/packages/app-shell/src/views/metadata-admin/predicate.ts: the Studio metadata form evaluator reads (expr) grouping, as CEL does. One branch in evalExpr: when the whole text is one balanced group, it evaluates the inside. The branch sits after the || / && splits, which already leave a group whole, and before negation, so !(a && b) negates the group. The matching ) is found quote-aware, by the same rule splitTopLevel uses, so a parenthesis inside a string literal is never counted. The header's supported-subset list gains the grouping line, and a new header section says why.
  • Unchanged on purpose: a predicate the evaluator still cannot read (an unbalanced parenthesis, a function call such as size(data.x)) still fails open with the objectstack#6936 warning. The card's ask to make it fail closed was cut in the claim's Premise corrected (comment 7237651782), quoting objectstack#6936 comment 5230638168 (Option C: an unresolvable path evaluates TRUE, with a development-mode warning) and ADR-0137 D3 ("A faulting visibleWhen shows the field.").
  • One existing pin changes its diagnostic, not its verdict. The §9.7 pin ('admin' in current_user.positions) used to raise the objectstack#6936 unresolved-root warning, because the whole text was one operand with the root segment ('admin' in current_user. With the group stripped first, the membership sits at depth 0 and raises the more precise objectui#6617 warning instead. The verdict stays true, and the §9.3 verdict table that pins it is untouched. objectui#6617 is diagnostic-only by its ruling, so this moves no ruled verdict. The header paragraph and the carriesTopLevelIn docblock that called this spelling undetected are rewritten to match.
  • packages/spec/src/data/field.metadata-form.ts is not edited: percentDisplay and currencyConfig keep their parenthesised CEL, which now evaluates as written.
  • Changeset: @object-ui/app-shell patch.

Tests

ui/packages/app-shell/src/views/metadata-admin/predicate.test.ts, a new top-level describe (§10) in the shared harness:

  • 10.1 grammar: a whole-text group, a nested group, !(…) over a comparison and over &&, (a || b) && c against the ungrouped a || b && c, a nested a || (b && (c || d)), an in set inside a group, and ( / ) inside a string literal. Each case is true and false on two drafts, with no warning.
  • 10.2 still unreadable, still fail-open: an unbalanced (, a group followed by == true, and size(data.tags) > 0 each evaluate true and warn once.
  • 10.3 the two bundled rows, read from fieldForm in @objectstack/spec/data: a non-vacuity guard that both still spell a group, then percentDisplay and currencyConfig on seven drafts (table below), with no warning.
  • §9.7 pin rewritten as described above.
draft percentDisplay before → after currencyConfig before → after
text true → false true → false
percent true → true true → false
currency true → false true → true
formula returning percent true → true true → false
formula returning currency true → false true → true
formula returning number true → false true → false
empty draft true → false true → false

"Before" was measured on origin/main bd5407e with a copy of the evaluator. "After" is the §10.3 pin at this head.

Acceptance notes

  • Seen while measuring, not in this card: some malformed shapes already evaluate false silently, without a throw or a warning. data.type ==, data.type === 'text', data.type > 3 and data.type == 'text') all behave this way, which does not match the header's "fail-open on any parse error". Recorded here only, per the claim.
  • Grouping is base CEL and the forms declare dialect: 'cel', so this does not grow the interim evaluator into a second dialect (the claim's ruling on the route).

Verification

  • Two-minute check: pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/predicate.test.ts. Expect 173 passed, 24 of them grouping-dependent (§10 and the §9.7 pin).
  • Read first: the grouping branch in evalExpr and matchingCloseParen (predicate.ts), then §10.3 in predicate.test.ts.
Local readings at 571bb00
  • pnpm --dir ui exec vitest run on predicate.test.ts, SchemaForm.unresolvedPredicate.test.tsx, SchemaForm.optionVisibleWhen.test.tsx and SchemaForm.nestedAnyOfPredicate-9830.test.tsx: Test Files 4 passed, Tests 198 passed.
  • Ablation through scripts/ablation-replace.mjs: the grouping branch's condition was prefixed with false && (anchor 1 → 0, blob 1c645a78f74b → f5ef536be108). predicate.test.ts then had 24 failed and 149 passed: all of 10.1, all seven 10.3 row cases, and the §9.7 pin. 10.2 and the guard stayed green, as expected. Restore: blob == HEAD (1c645a78f74b), git diff HEAD empty.
  • eslint on both source files: 0 errors, 1 warning (the existing let cur: any in resolveValue, not this diff).
  • dispatch-gates --commands derived 38 families, all run with exit codes recorded (--ran: 38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN). 37 exit 0. pnpm --dir ui exec vitest run scripts/ exit 1: 7 failed and 5138 passed, in check-doc-snippet-types.test.ts (1) and spec-symbol-ledger-plugin-detail-7265.test.ts (6). Both read the built @objectstack/spec type declarations, and this worktree's spec dist comes from an OS_SKIP_DTS=1 closure build. Neither test reads a file this diff changes, so treat that red as NOT MEASURED locally. CI's Test UI runs them on a clean build. pnpm check:changeset-fixed (run beyond the derivation) exit 0.
  • @object-ui/app-shell type-check: NOT MEASURED locally, because the @object-ui/* and spec closures carry no type declarations in this worktree (2606 errors, none in a changed file). CI's Type Check UI decides.
  • overlap-check.mjs: VERDICT clean exit 0 against origin/main bd5407e, and 0 open PR heads share a file.

Generated by Claude Code

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 28, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1
2026-11-28T11:00Z

L1-a ACCEPT at 571bb002e1bf3635723245ddc37d116a60309d9e.

Face. L1 only, no L2 owed. The three files are ui/packages/app-shell/src/views/metadata-admin/predicate.ts, its test and one changeset. There is no packages/spec/src/**, no governed path, no narrowing, and Clause-②: no. @object-ui/app-shell is "private": true; its patch changeset follows the repo's practice (344 changesets name it) and publishes nothing.

Claim against surface (claim 7237651782). It matches file for file. Route P is built as ruled. evalExpr gains one branch: when the whole text is one balanced group, evaluate its inside. It sits after the || / && splits (which are depth-aware, so a || (b && c) and (a || b) && c reach it as whole groups) and before negation (so !(a && b) negates the evaluated group).

Evidence (reports 7238017671, 7238248941).

  • The per-type table (percentDisplay / currencyConfig) is right on every row: text F/F, percent T/F, currency F/T, formula returning percent T/F, formula returning currency F/T, formula returning number F/F, empty draft F/F. Before the change every row was T/T.
  • Ablation: 24 red and 149 green; the restored blob equals HEAD.
  • The two items NOT MEASURED locally (the ui/scripts spec-dts tests and the app-shell type-check) are green in CI.

Changeset, read sentence by sentence: every sentence holds, including "A condition it still cannot read (an unbalanced parenthesis, a function call) keeps failing open with its development warning, unchanged". The level is patch, and both declaration lines are line-initial.

Checks at this head: 38 success, 13 expected skip, 0 failed, 0 pending. mergeable clean.

Relation. Fixes #38070 is right. The card's remaining ask, after the cut of Ask 1's second half recorded on the claim, is that a parenthesised predicate evaluates correctly, and this PR delivers it.

Out of scope (Acceptance notes). A malformed predicate (data.type ==, data.type > 3) silently reads false. That is fail-closed with no warning, the class #6936 fixed for unresolvable roots. It does not earn a card of its own today: no predicate in the 18 spec metadata forms uses either shape, and this file retires at ROADMAP M9. If the producer-side check for predicate path references (the header's "filed separately") is still an open card, one line there naming these shapes is the right home.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

Landing · 2026-11-28T11:01Z · zone o3-ux (seat card thread)
Head-sha: 571bb002e1bf3635723245ddc37d116a60309d9e

  • L1 ACCEPT 7238266912 at this head (L1-a). The claim matches the surface file for file. The grouping branch sits after the depth-aware ||/&& splits and before negation, and its match is quote-aware, the same rule splitTopLevel uses. The fail-open boundary is unchanged: an unbalanced ( or a function call still fails open with the warning (the objectui: metadata-admin 谓词求值器对「无法解析的路径」静默判假(fail-CLOSED),与文件自述的 fail-open 承诺相反 #6936 ruling, ADR-0137 D3). No L2 is owed: no spec, governed or narrowing face, and app-shell is private.
  • Built as claimed (report 7238017671, final head 7238248941). Each type's percent and currency rows now follow the type, where before every type showed both. The ablation turned 24 tests red.
  • Out-of-scope note (malformed predicate reads false): no standalone card, per L1-a. No shipped form uses those shapes, and the file retires at M9.
  • check-governed-merges.mjs --pr 38262: NOT governed, +191 / −19.
  • K: 14 < 15, counted by hand.
  • Checks at this head: 38 success, 13 expected skip, 0 failed. mergeable_state clean.
  • Action: mark ready for review and enable auto-merge (queue).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 28, 2026 11:01
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 46137947190 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Dogfood Regression Gate (3/3) — 失败步骤: Boot example apps and exercise real user flows

    @objectstack/dogfood:test:  FAIL   isolated  test/expression-conformance.test.ts > ADR-0058 D7 — expression surface conformance ledger > is a sound conformance ledger + ratchet (ADR-0060 checkLedger)
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: UNCLASSIFIED surface — add a ledger row (ADR-0060): data/object.zod.ts:ObjectSchemaBase.uiReadonlyWhen: expected [ Array(1) ] to deeply equal []
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

  • test/expression-conformance.test.ts — 24h 窗口内只有本 PR 撞到过,暂不汇总(再有一个不同 PR 撞到就会自动开汇总 issue)。
  • ⚠️ 24h 评论账本没读完(超过 5 页仍未读到窗口尽头),所以上面的「不同 PR 数」是下界,不是全量。

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 19 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Studio form predicates: a parenthesised visibleWhen fails open, so the field editor shows percent and currency rows on every field type

2 participants