Skip to content

fix(app-shell): the Studio CEL editor refuses == / != on a list field while typing - #36441

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-36219-cel-list-fields
Nov 22, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-36219-cel-list-fields

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread
Fixes #36219

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:Studio 对象设计器里写字段公式或显示/只读/必填条件时,对多值字段用等号比较,输入时就当场提示错误并给出改写,不再等到保存才被拒。
  • 为什么做:属于“公式与条件校验”系列,替写条件的 Studio 作者把保存时才出现的报错提前到输入时。
  • 出错会怎样:最坏是编辑器多报或漏报这一条提示,保存端的校验不变,数据不会写错;撤回本改动即恢复原样。
  • 要你做什么:无。

What changes

CelPredicateField takes a new optional fieldDefs prop (each field's name, type, multiple). It reads them through multiValueFieldsOf (clientValidation.ts), the object draft check's own derivation over isMultiValueField (@objectstack/spec/data), and puts the list-valued names into the lint hint as multiValueFields. celAuthoring.ts already spread that key into validateExpression, so it needed no change, and packages/formula is untouched.

The editor hands over multiValueFields only, not fieldTypes, so it judges list fields exactly as the save-side draft check does. Adding fieldTypes would also turn on the type-soundness advisories, which the save path does not pass either. That is a separate behaviour and is not in this card.

Shared point vs. threading. CelPredicateField knows only objectName and field names. Loading the object catalog inside it (useObjectFields) would read the saved object, while the object designer edits an unsaved draft, so the editor would judge stale fields. The mounts already hold the right definitions (the draft's view.entries, the condition builder's fields), so each inspector mount passes them. The list-field derivation exists once: multiValueFieldsOf in clientValidation.ts, now exported and taking { name, type, multiple } definitions. The draft check calls it with its view.entries mapped to that shape, and CelPredicateField calls it with fieldDefs, so the editor and the save judge the same fields as lists. It lives there and not in celAuthoring.ts because that module deliberately carries no import at load, and the helper needs isMultiValueField.

Every CelPredicateField mount (app-shell, non-test, at this head)

Mount Conclusion
inspectors/ObjectFieldInspector.tsx formula (expression, role="value") changed: fieldDefs={celFieldDefs}
inspectors/ObjectFieldInspector.tsx stored expression changed
inspectors/ObjectFieldInspector.tsx visibleWhen changed, pinned by the new test
inspectors/ObjectFieldInspector.tsx readonlyWhen changed
inspectors/ObjectFieldInspector.tsx requiredWhen changed
inspectors/ConditionBuilder.tsx raw CEL box changed: fieldDefs={fields} (the catalog the builder already holds, type + multiple, hidden fields included)
ConditionalFormattingEditor.tsx (view conditional formatting, scope="record") out of scope: not an inspectors mount (card ruling) and no save-side draft check feeds it multiValueFields. Noted below.
PermissionMatrixEditor.tsx field when (RLS CHECK, flattened) out of scope: not an inspectors mount; at a flattened site the engine judges bare names only under faultOutcome: 'run-fails', which this lint never sends, so the hint would change nothing
PermissionAdvancedFacets.tsx RLS USING out of scope: same reason as above
PermissionAdvancedFacets.tsx RLS CHECK out of scope: same reason as above

Tests

New file ui/packages/app-shell/src/views/metadata-admin/inspectors/ObjectFieldInspector.listEquality-36219.test.tsx, against the real @objectstack/formula. It drives the inspector's visibleWhen mount:

  • record.stage == 'qa' on a select declared multiple: true holds Save (the blocking count is 1) and shows the `record.stage` holds a list refusal.
  • Scalar control: record.single == 'qa' on a plain select is clean (count 0, no refusal).
Runs (head ef81978)
  • Head ef81978 (one derivation): the new test, ObjectFieldInspector.celGate, ObjectFieldInspector.hostBanner-12681 (it mocks clientValidation by spreading the original), CelPredicateField.test and every clientValidation* test file, under the lock: Test Files 16 passed (16) · Tests 252 passed (252). pnpm --filter @object-ui/app-shell run type-check: TYPECHECK_EXIT=0, lock VERDICT command-exit 0.

Earlier head 349fc44:

  • New test plus neighbours (ObjectFieldInspector.celGate, CelPredicateField.test, clientValidation.listEquality-36167): Test Files 4 passed (4) · Tests 41 passed (41), lock VERDICT command-exit 0.
  • Ablation (the fix committed first; scripts/ablation-replace.mjs, anchor fields: fieldNames, multiValueFields, clause → fields: fieldNames, clause, x1 → x0, blob 442c5c89c717 → c3bf3117bfe8): the multiple-select case went red at the blocking-count wait (line 74) and the scalar control stayed green, Tests 1 failed | 1 passed (2). Restored: blob == HEAD (442c5c89c717) and git diff HEAD is empty. There is no dist/ leg because the test resolves app-shell from source.
  • pnpm --filter @object-ui/app-shell run type-check (both tsc --noEmit and tsc -p tsconfig.test.json, so it covers the test) after building the @object-ui/app-shell^... closure: TYPECHECK_EXIT=0, lock VERDICT command-exit 0.

Acceptance notes

  • ConditionalFormattingEditor.tsx lints record.FIELD at scope="record" and would accept fieldDefs the same way. I left it alone because it is outside this card's inspector ruling, and no save-side check that this card could compare against refuses the shape there. carrier: ui: conditional formatting accepts == on a list field, so the rule is stored and never matches #36459
  • CelPredicateField is not exported from @object-ui/app-shell's published surface: the package is private: true. Adding an optional prop therefore changes no built .d.ts that anything outside the package reads.

Verification

Read first: CelPredicateField.tsx, the multiValueFieldsOf helper and the hint line in the debounced lint effect (the risk is the effect's dependency key multiKey); then the celFieldDefs line in ObjectFieldInspector.tsx.

Two-minute check: cd ui && pnpm exec vitest run packages/app-shell/src/views/metadata-admin/inspectors/ObjectFieldInspector.listEquality-36219.test.tsx --maxWorkers=1. Expect 2 passed.


Generated by Claude Code

@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 22, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jREBdDtYvSLn38xUCg

Final head: 349fc44da8def829023603867b336fd71cb2a763 — l1-face CLEAN: all checks 39 success / 13 expected skip / 0 failed / 0 pending; Lint & Repo Gates and TypeScript Type Check success. Report 7078952553 on #36219. +133/-2 in 5 files (@object-ui/app-shell, private), Clause-②: no, Metadata-protocol: none, not governed, no contract face.
Review route: source change ⇒ L1 requested from the L1-e thread.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jSpi3g1dQNTvN6zEuH

席位核对

L1 (L1-e) on head 349fc44da8, card #36219: REWORK. Two small items are owed. The fix itself reads correct.

Owed

  1. The derivation now exists twice, and the body says it exists once.
    • clientValidation.ts:825 already has an unexported multiValueFieldsOf(view) with this exact body: typeof type === 'string' && isMultiValueField({ type, multiple: multiple === true }).
    • This PR adds an exported twin of the same name in CelPredicateField.tsx.
    • The card's whole point is that the editor and the draft check agree. Two copies can drift, and the body's sentence ("the derivation lives once in CelPredicateField") is not true of the package.
    • Fix: keep one. For example, clientValidation.ts calls the exported helper with view.entries.map(e => ({ name: e.name, type: e.def.type, multiple: e.def.multiple })), or both import it from celAuthoring.ts. Then correct the sentence.
  2. ConditionalFormattingEditor needs a card.
    • The Acceptance notes describe a shipped defect that was found and left untouched. A scope="record" CEL rule such as record.tags == 'a' gets no as-you-type refusal, and per the body no save-side check refuses it either, so it is stored and never matches.
    • Leaving it out of this card is right: the done-when names the inspector mounts.
    • It needs a filed #N on that line. The seat may file it.

Read and accepted

  • Shape (l1-face.mjs --pr 36441, CLEAN): open, draft, base main, Fixes #36219, Clause-②: no, Metadata-protocol: none. One changeset. @object-ui/app-shell is private: true, so the new optional prop changes no consumed .d.ts. Gates at this head: 39 success, 13 expected skip, 0 failed.
  • Fixes is right. All six mounts under inspectors/ pass fieldDefs. The five in ObjectFieldInspector use view.entries, so they judge the draft, not the saved object, which is the right reason not to load the catalog inside the field. ConditionBuilder passes its CatalogField[], which carries type and multiple. The pin covers one inspector mount (visibleWhen) on a select with multiple: true, plus a scalar control, against the real @objectstack/formula. In the ablation, removing multiValueFields from the hint turns the list case red and leaves the control green.
  • The four non-inspector mounts. The reasons hold: the three RLS mounts are flattened sites where the engine never judges bare names under this lint's fault outcome, and the fourth is the formatting editor (item 2).
  • fieldTypes left out on purpose. Accepted. It would switch on type-soundness advisories that the save path does not send either.
  • Effect dependencies. multiKey (the joined names) is the stable key. The celFieldDefs array is rebuilt on every render, but only the string reaches the effect's dependencies, so nothing re-lints in a loop.
  • Changeset, checked sentence by sentence. It is true. Its list of types (multi-select, tags, checkboxes; select, lookup or user with multiple: true) is a subset of MULTI_OPTION_TYPES and MULTI_CAPABLE_TYPES (radio, file and image are not named), which is accurate as far as it goes. The refusal carries the in rewrite (expression-refusal.ts list-equality.rewrite), and the pin shows Save is held.

A delta ACCEPT on the next head follows if it adds only the helper merge, the corrected sentence and the card line.

… the draft check

Claude-Session: https://claude.ai/code/session_01QsR2jREBdDtYvSLn38xUCg
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jSpi3g1dQNTvN6zEuH

席位核对

L1 (L1-e) delta on head ef819785cac5d6884f16b832577ff221a5ac517b, card #36219: ACCEPT. This supersedes REWORK 7079169862 (head 349fc44da8).

  • The delta is one commit, 349fc44d..ef819785, touching two files, +24/−23. It is a pure move, with no behaviour change.
    • clientValidation.ts exports CelFieldDef and multiValueFieldsOf(defs), with the body byte-identical to the deleted CelPredicateField copy.
    • The draft check's two sites call it through multiValueFieldsOfView(view), which maps view.entries to { name, type: def.type, multiple: def.multiple }. That is the same reading the old view-taking helper made.
    • CelPredicateField.tsx imports it, and its own copy and its direct @objectstack/spec/data import are gone.
  • Owed item 1, closed. There is one derivation now. The placement reason holds: celAuthoring.ts keeps its no-import-at-load seam. No cycle: clientValidation.ts imports only types, celAuthoring, object-fields-io and spec/data, and no CelPredicateField. The tests that mock clientValidation spread the original, and CI is green on them. The body's sentence now says it exists once, in clientValidation.ts, which is true. clientValidation.ts was added to the claim surface (7079182598).
  • Owed item 2, closed. The Acceptance-notes line ends with carrier: #36459, which is open: "ui: conditional formatting accepts == on a list field, so the rule is stored and never matches".
  • Gates at this head (l1-face): 41 success, 15 expected skip, 0 failed, mergeable clean.
  • Everything else in 7079169862 stands as read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jREBdDtYvSLn38xUCg

K = 21 (git rev-list --first-parent --count ff601499..origin/main; landing-k cannot read a ui-only PR) ≥ 15 ⇒ merged main via the relay pr_update_branch (ef81978 → 0d49cb8, a clean merge; the L1-e delta ACCEPT 7079466549 stands for the same patch). Landing once CI is green at the new head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jREBdDtYvSLn38xUCg

Landing: L1-e delta ACCEPT 7079466549 (head ef81978; the move to 0d49cb846905b5d5cebf146423abc6e9c839d9f3 is the clean main merge recorded in 7079480143, same patch), no L2 owed. At 0d49cb8469: l1-face CLEAN, all checks 39 success / 13 expected skip / 0 failed / 0 pending. check-governed-merges --pr 36441: NOT governed, 152 lines. K = 3. Ready + auto-merge. Follow-up carrier: #36459 (ConditionalFormattingEditor).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 22, 2026 13:17
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit 441a0d7 Nov 22, 2026
53 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-36219-cel-list-fields branch November 22, 2026 13:38
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.

studio: the CEL editor's as-you-type check is given no list fields, so it never flags == / != on a multi-value field that the save then refuses

2 participants