Skip to content

fix(studio): conditional formatting refuses == on a list field while typing - #36785

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-miceok
Nov 23, 2026
Merged

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

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Warren · project thread

Fixes #36459

Clause-②: no
Metadata-protocol: none

维护者速读

  • 在视图的「条件格式」里,管理员写「标签等于 VIP」这类把多选字段当单值比较的规则时,编辑框会当场标红并给出改写建议(改成「VIP 在标签里」),保存按钮在改好之前不放行;以前这种规则能存下来,但永远不会给任何一行上色。
  • 属于界面体验专题,是「多选字段不能用等于比较」这一修复(字段属性面板已做)在条件格式编辑器上的补齐。
  • 出错的话只是条件格式编辑框多报或少报一条提示,不改已有视图和数据,可直接撤回。
  • 无。

What changes

CelPredicateField has taken the object's field definitions (fieldDefs: name, type, multiple) since the field inspector's list-equality work: it reads the list-valued fields through isMultiValueField and hands them to the lint as multiValueFields, so the engine refuses record.LISTFIELD == 'x' (list-equality) with the membership rewrite. The view conditional formatting editor mounted one CelPredicateField per rule but never passed fieldDefs, so no field was judged a list there and such a rule linted clean, saved, and never matched a row.

  • ConditionalFormattingEditor takes an optional fieldDefs prop and hands it to every rule's CelPredicateField. Omitted, the lint is what it was.
  • Both mount sites pass it: ViewVariantInspector (metadata admin view page) builds it from the useObjectFields catalog it already reads; ListViewMoreSection (Studio list-view panel) builds it from the loaded fieldCatalog it already receives, which already carries multiple.
  • The refusal is an error, so it counts in the editor's existing blocking-issue report: the host's Save (metadata admin) and autosave hold (Studio panel) stay shut until the rule is rewritten.

No spec, rule shape or server change. ConditionalFormattingEditor is not in @object-ui/app-shell's published exports, so no export changes (Clause-② no). Changeset: @object-ui/app-shell patch.

Card item 2 (should the view save refuse the same shape) is dropped by the seat; see Acceptance notes.

Tests

New file ui/packages/app-shell/src/views/metadata-admin/ConditionalFormattingEditor.listEquality-36459.test.tsx, against the real @objectstack/formula engine:

  • editor: record.tags == 'vip' and record.tags != 'vip' on a select declared multiple: true show the "holds a list" finding with the in rewrite and report 1 blocking issue;
  • editor: 'vip' in record.tags is clean (0 blocking);
  • control: record.stage == 'open' on a single-value select is clean;
  • mount sites: the view variant inspector (fed objectFieldsOverride) and the Studio list-view panel (fed a loaded fieldCatalog) both show the finding; the panel reports 1 blocking issue.

Reverse verification at 7c65f8b9, through scripts/ablation-replace.mjs (anchor hit 1 → 0, blob changed, restored blob == HEAD, git diff HEAD empty): with the fieldDefs={fieldDefs} pass-through deleted from ConditionalFormattingEditor, the 4 refusing cases fail and the 2 clean cases pass.

Local runs under the verify lock (head 7c65f8b)
pnpm --dir ui exec vitest run ConditionalFormattingEditor.listEquality-36459.test.tsx ConditionalFormattingEditor.test.tsx ConditionalFormattingEditor.celGate.test.tsx
 Test Files  3 passed (3)
      Tests  36 passed (36)
os-verify-lock: VERDICT command-exit 0

pnpm --filter @object-ui/app-shell run type-check
os-verify-lock: VERDICT command-exit 0

ablation (pass-through deleted)
      Tests  4 failed | 2 passed (6)
ablation-replace: ok restored: blob == HEAD and `git diff HEAD` is empty
dispatch-gates --commands (derived from the branch, head 7c65f8b9): 38 families, each run locally, every one exit 0
✓ dispatch-gates --ran: 38 derived famil(ies) accounted for — 38 run, 0 NOT-MEASURED (a DERIVED zero — all 38 recorded an exit code and none of them is 3).

The full @object-ui/app-shell suite and every other family run in CI (Test UI, Type Check UI); their check-runs are the verdict.

Acceptance notes

  • Card item 2 (the view save refusing the same shape): dropped — new save-door lint site; new gates default no. On main a view's conditionalFormatting[].condition is not CEL-linted at save at all (validate-expressions lints a field's own conditionalFormatting; the view write path runs the bulk-confirm text pass only), so refusing it there would be a new gate. Not filed.

Verification

Read first:

  1. ConditionalFormattingEditor.tsx: the new fieldDefs prop and its pass-through to CelPredicateField.
  2. ListViewMoreSection.tsx: fieldDefs built from fieldCatalog only when it is loaded (riskiest hunk: undefined while loading means no list judgement until the catalog arrives).
  3. ViewVariantInspector.tsx: celFieldDefs from the same catalog the field name list comes from.

Two-minute check: in Studio, open a list view of an object with a multi-select field, add a conditional formatting rule and type record.FIELD == 'x' for that field: the box shows "holds a list" with the in rewrite and the view does not save; type 'x' in record.FIELD: the finding clears.


Generated by Claude Code

…typing

The view conditional formatting editor did not hand the CEL lint the
object's field definitions, so record.LISTFIELD == 'x' (a rule that never
matches any row) was accepted silently. The editor takes fieldDefs and
both mount sites pass each field's type and multiple.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbXAtnodnKm6tuyEbxU
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 23, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbZeHNsF3RWcWpj7rGj

维护者速读

条件格式里,对「多选/列表」字段写 == 的规则(永远不会命中)现在在输入时就会被拦下,并提示改用 in。保存时的检查不加(新增检查默认不做)。
要你做的:无(普通改动,席位自动合并)。

席位核对 — ACCEPT (L1) · repo:objectstack#1 · head 7c65f8b9 · 2026-11-23T22:47Z

  • Shape: Fixes #36459 (card item 1). ConditionalFormattingEditor.tsx takes an optional fieldDefs and hands it to each rule's CelPredicateField; both mounts (metadata-admin/inspectors/ViewVariantInspector.tsx, studio-design/ListViewMoreSection.tsx) pass each field's type and multiple from catalogs they already read; one new test file; a patch changeset. Clause-②: no (the editor is not exported from the package index). Metadata-protocol: none.
  • Read: with no fieldDefs the lint is what it was; the Studio mount passes them only once its catalog has loaded; the inspector mount memoizes them.
  • Acceptance notes: item 2 (a save-time refusal) dropped: a new save-door lint site, and new gates default no. Not filed.
  • Tests: 6 new cases against the real formula engine, 36/36 across the editor's three files; the thread's reverse run turns 4 red with 2 controls green.
  • Gates: 41 success, 15 expected skip, 0 failed on 7c65f8b9; mergeable_state clean.
  • Landing: the seat readies the PR and arms auto-merge.

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 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.

ui: conditional formatting accepts == on a list field, so the rule is stored and never matches

2 participants