Skip to content

fix(ui): a multi-value field's list filter offers contains / does not contain, not the operators the server refuses - #35991

Merged
objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/issue-35559-multivalue-filter-operators
Nov 21, 2026
Merged

objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/issue-35559-multivalue-filter-operators

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread

repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me

Fixes #35559

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:列表里按多选字段(多选、复选框、标签、多值人员/查找)筛选时,条件只剩「包含 / 不包含 / 为空 / 不为空」,选一个值就能查出结果,不再弹出「该视图的查询被拒绝」;单选字段照旧。
  • 为什么做:外部开发者反馈多选字段在列表里根本筛不了,服务器本来就支持「包含」,只是筛选面板一直没提供。
  • 出错会怎样:最坏是某个多值字段的条件选项少了或多了一项,只影响列表筛选,不改数据,撤回这个改动即可恢复原样。
  • 要你做什么:无。

What changes

The list's two filter surfaces chose operators from the field TYPE alone, so a multi-value field offered operators the server refuses on a JSON column (JSON_COLUMN_INCOMPATIBLE_OPERATORS, @objectstack/core): picking a value sent ["f_multiselect","=","red"] and the list showed the refusal. Both surfaces now read one helper keyed on the same two field facts the server's faces read (type and multiple, through the spec's isMultiValueField and STRUCTURED_JSON_TYPES):

  • @object-ui/components filter-builder.tsx: new exported jsonColumnFilterOperators(field) and operatorsForField(field). A multi-value field (multiselect / checkboxes / tags, or select / radio / lookup / user with multiple: true) offers contains, not_contains, is_empty, is_not_empty; a structured-JSON field offers is_empty / is_not_empty only; every other field keeps its type bucket. The row's own operator is always mounted, so a saved refused operator still shows and can be changed. contains on a multi-value option field draws a single-option picker (the spec's $contains takes one comparand; an array comparand is refused, measured below). "Add filter" and a field switch land on contains instead of equals for such a field. FilterBuilder field descriptors accept multiple; emptyCheckArm reads it too. operatorsForFieldType (what a row can HOLD, read by the dataset and flow inspectors) is unchanged.
  • @object-ui/plugin-list quick filter (conditions/): quickFilterOperators(field) = the same helper, else the family list. FilterValuePanel and the default operator read it.
  • ListView.tsx: the filter field descriptors carry multiple: field.multiple === true (one line, claim amended by the seat), without which select / lookup / user with multiple: true cannot be told from single-value.

Read first, by risk:

  1. filter-builder.tsx offeredOperatorsForRow / jsonColumnFilterOperators (the offer and the held-operator rule).
  2. filter-builder.tsx isOptionDrivenValueControl (the value control for contains on a multi-value option field).
  3. conditions/conditionModel.ts quickFilterOperators.

Follow-up (nested under #35559)

Tests

Pins
  • components/src/__tests__/filter-builder-json-column-operators.test.tsx (new): the helper per type and multiple; the dropdown on select with multiple: true, multiselect, address, single select (control); a stored equals still loads beside the four; contains draws a single-option Select; a field switch and "Add filter" land on contains.
  • plugin-list/src/conditions/__tests__/listConditions.test.tsx (new top-level describe): every operator either surface offers for six multi-value fields and one structured field is lowered through the list's own convertFilterGroupToAST and the spec's parseFilterAST, and none of the resulting $-operators is in the server's JSON_COLUMN_INCOMPATIBLE_OPERATORS (read from packages/core/src/utils/json-column-operator-refusal.ts, with a lit control that $eq / $in are in it and $contains / $empty are not); control leg: equals / not equals / in / not in each reach a refused operator; 「包含」 sends ["responsibilities","contains","quality_lead"] → $contains; single select unchanged; one pick replaces another; a saved refused operator still draws; zh-CN and en labels for both surfaces.
  • components/src/__tests__/filter-builder-empty-null-pair-11810.test.tsx: the multiselect / tags case now pins the JSON-column offer (empty pair, no null pair to a fresh choice) and that a stored is_null still loads with the empty-list hint.
Runs (head 0153d1f)
  • pnpm --dir ui exec vitest run --maxWorkers=2 packages/components/ packages/plugin-list/ → Test Files 681 passed, 1 skipped (682); Tests 6774 passed, 24 skipped; lock VERDICT command-exit 0.
  • pnpm --filter @object-ui/components --filter @object-ui/plugin-list run type-check → exit 0 (both tsc --noEmit && tsc -p tsconfig.test.json).
  • Ablation (committed fix, scripts/ablation-replace.mjs, test subject resolved through the vitest alias to src, so no build): deleting the multi-value line of jsonColumnFilterOperators → anchor 1 → 0, blob f440145ffece → 3a729237258e; the two pin files: 9 failed, 57 passed (exit 1). Restore: blob == HEAD, git diff HEAD empty; rerun 66 passed (exit 0).

Acceptance notes

  • Per-surface before / after, measured in the browser (showcase, zh-CN, 1280x800, showcase_field_zoo), and each server answer over REST:
    • Quick filter, multiselect / checkboxes: before 是其中之一 / 不是其中之一 / 为空 / 不为空, one pick sent ["f_multiselect","=","red"] → 400 INVALID_FILTER, list showed 「该视图的查询被拒绝」; after 包含 / 不包含 / 为空 / 不为空, one pick sends ["f_multiselect","contains","red"] → 200, 1 row.
    • Quick filter, tags: before 包含 / 不包含 / 等于 / 开头是 / 为空 / 不为空 (等于, 开头是 refused); after the four.
    • Quick filter, user with multiple: true: before 是其中之一 / 不是其中之一 / 为空 / 不为空; after the four.
    • Advanced panel (the shared FilterBuilder), multiselect / checkboxes / tags: before 等于 / 不等于 / 包含 / 包含(忽略大小写) / 不包含 / 为空 / 不为空 / 以…开头 / 以…结尾 / 为 null / 不为 null; user multiple: 等于 / 不等于 / 为空 / 不为空 / 属于 / 不属于; after the four on each.
    • Control, single select: unchanged on both surfaces (是其中之一 … / 等于 / 不等于 / 为空 / 不为空 / 属于 / 不属于), ["f_select","=","low"] → 200.
    • REST on multiselect, checkboxes, tags: =, !=, in, nin, startswith → 400 INVALID_FILTER; contains, notcontains, isempty, isnotempty → 200; contains with an array value → 400, so contains names one member; an or of two contains → 200 (any-of is two rows under OR in the advanced panel).
  • Surfaces that offer no operator per field, named: plugin-view FilterUI (writes values, no operator choice); the dashboard filter bar (writes values; its host lowers a select / lookup filter to bare equality or $in in @object-ui/core dashboard-filters.ts buildFilterCondition, outside this claim; not measured against a multi-value target); the filter-builder renderer forwards FilterBuilderSchema.fields, whose declared types (FILTER_FIELD_TYPES) and keys carry no multi-value type and no multiple, so it has no consumer of this offer.
  • Other hosts of the shared builder (FilterConditionField in @object-ui/fields, the metadata-admin widgets) pass no multiple: they get the fix for multiselect / checkboxes / tags by type, and keep the type bucket for select / lookup / user with multiple: true. Outside this claim.
  • A structured-JSON field is offered the empty pair only, not contains: the server's membership test is array-only, so contains on an object value would always answer no rows.
  • The quick filter's option list keeps its checkbox rows for contains; a second pick replaces the first (listbox not multiselectable).

Verification

Two minutes: in showcase, open 字段动物园, 筛选 → Multi-select. The operator reads 包含; tick Red; the list shows one record (Specimen — Full) and the chip reads 「Multi-select:包含 Red」.


Generated by Claude Code

…er accepts

The list's quick filter and the shared FilterBuilder keyed operators on the
field type alone, so a multi-select offered equals / in, which the server
refuses on a JSON column. Both now read one helper, jsonColumnFilterOperators,
keyed on the type and multiple through the spec's own sets.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
…al set; changeset

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

  • 列表里按多选字段(多选、复选、标签,以及允许多选的选项、关联、人员字段)筛选时,以前给出的「等于 / 属于」会被服务端拒绝、筛选直接报错;现在只给「包含 / 不包含 / 为空 / 不为空」,筛选能正常出结果。
  • 「包含」一次选一个值;想要「任一」,加两行用「或」连接。
  • 地址这类结构化字段只给「为空 / 不为空」。
  • 以前存下的、用了旧条件的筛选照常显示,方便用户改掉。
  • 席位意见:通过;检查跑完后由区域自行合并。仪表盘筛选栏等其他入口已另开卡跟进。

席位核对

ACCEPT · head 0153d1fe7f · card #35559 (area:ux p2, no epic parent; claim 7056652346 under the seat's 「你继续处理 ux 非专题下的 p2 任务,并发3」) · K=5 · merge-tree vs origin/main clean · governed: none · size +501/−35 = 536, 9 files · Clause-② no, no packages/spec path → area lands · CI 18 success, 15 skipped, 26 in progress · 2026-11-21T04:58Z

  • One helper jsonColumnFilterOperators({type, multiple}) decides through the spec's isMultiValueField and STRUCTURED_JSON_TYPES, the same two facts the engine's JSON-stored test reads. No local type list. The advanced builder reads it through operatorsForField and the quick filter through quickFilterOperators, so the two surfaces cannot drift. emptyCheckArm now passes multiple to expandEmptyOperator, so a multiple: true select, lookup or user takes the multi_value row. That is correct.
  • Point (2): one member. The quick panel's option list is multi-pick only for in / not_in, and seedValueFor collapses a one-element list to its member when the operator moves to contains. So the wire carries a scalar $contains. The builder's value control goes through isOptionDrivenValueControl, which now admits a multi-value field. Single-select fields still take the same path as before.
  • Point (3): a held operator stays drawn on both surfaces. offeredOperatorsForRow keeps held, and FilterValuePanel prepends row.operator. Nothing rewrites a stored predicate, which matches the objectui#9306 rule.
  • Point (1): the structured-JSON empty pair is right. The server's membership test is array-only.
  • Wire test: every offered operator is lowered through convertFilterGroupToAST → parseFilterAST and checked against JSON_COLUMN_INCOMPATIBLE_OPERATORS, with a lit control both ways. Ablation 9 red.
  • The ListView multiple line is covered by claim amendment 7056811586. Overlap with feat(list): a two-row list toolbar — View settings beside the view name, a resident condition row, ⋮ More at the far right #35918 is clean, as reported.
  • Point (4): Dashboard filter bar and condition editors still send = / $in on a multi-value field, which the server refuses (follow-up to #35559) #35992 is filed under Console filter builder: a multi-select field offers only operators the server refuses (=, in → 400 INVALID_FILTER); 「包含」(contains) is never offered #35559 for the dashboard filter bar and the Studio / FilterConditionField editors that do not carry multiple.
  • Nit: operatorsForField is marked @internal exported for tests, yet it goes onto the published @object-ui/components entry. Either drop the tag or keep the symbol off the barrel.
  • Nit: the test reads the refusal set by regex from packages/core source through a six-level relative path. The lit control catches an empty parse, but not a renamed file. A rename fails loudly at readFileSync, so this is acceptable.

R1: CI is still running. Flip ready and land once it is green.

…ence in the filter builder

The builder now relates the spec's multi-value predicate to the driver's
JSON-column refusal, so it names the card that owns their divergence, as the
plugin-detail pin requires of every such file.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me

CI fix · head 6ddf4b101a · 2026-11-21T05:13Z

Test UI (3/16) failed on 0153d1fe7f: plugin-detail/src/__tests__/relatedListParentScopeResidue-8937.test.ts › pin three, "a file relates the spec predicate to the driver without citing the card that owns their divergence", uncited packages/components/src/custom/filter-builder.tsx. This PR's: the builder now imports isMultiValueField, and its existing comments already name the driver, so it joined that pin's population. Fixed by citing objectstack#17469 in the helper's docblock (3 comment lines, no code change). Replaying the pin's sweep over ui/packages at the new head leaves no uncited carrier. L1-a's ACCEPT (7057604096) covered code; this is a comment-only delta.

…ltiselect row seeds contains

The shared filter builder now seeds contains on a multi-value column (the server
refuses equality on its JSON column), so the equality control no longer applies
there; that seed is pinned on its own.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

  • 只补了三行代码注释,让一个仓库自检规则通过,功能没有任何变化。
  • 席位意见:通过;检查跑绿后由区域自行合并。

席位核对

delta ACCEPT (on ACCEPT 7057604096) · head 6ddf4b101a (one commit on 0153d1fe7f) · K=8 · merge-tree vs origin/main clean · delta +3/−0, 1 file, comment only · CI 4 success, 13 skipped, 19 in progress · 2026-11-21T05:14Z

  • The jsonColumnFilterOperators docblock now cites objectstack#17469. The plugin-detail pin relatedListParentScopeResidue-8937 requires that citation in any ui file that names both isMultiValueField and the driver's JSON-column test. No code changed. The area reports that a rerun of the pin's sweep over ui/packages finds no uncited file.

R1 (carried): CI is running. Land when it is green.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me

CI fix 2 · head a9ef27ad8b · 2026-11-21T05:16Z

Test UI (15/16) also failed on 0153d1fe7f: fields/src/widgets/__tests__/FilterConditionField.emptyOperators-10790.test.tsx › "CONTROL: the seed "equals" row on a 'multiselect' column is untouched", expected '' to be '{"tags":""}'. This PR's: the shared builder now seeds contains on a multi-value column, which writes nothing until a member is picked, so the control's premise no longer holds there. Fixed in the test only: the equality CONTROL runs on the single-value columns, and a new CONTROL pins that a fresh multiselect row seeds 「Contains」 and writes nothing yet. Under the lock: that file + the #8937 pin + the builder's operator test → 3 files, 56 passed; all fields widget tests → 36 files, 482 passed. overlap-check clean.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

  • 只改了另一个模块里的一条测试:多选字段新加一行筛选时默认是「包含」,不再是「等于」,测试按新行为更新,单选等其他字段的检查保持原样。
  • 功能代码没有变化。
  • 席位意见:通过;检查跑绿后由区域自行合并。

席位核对

delta ACCEPT (on delta 7057776804) · head a9ef27ad8b (one commit on 6ddf4b101a) · K=8 · merge-tree vs origin/main clean · delta +15/−2, 1 test file · claim amendment 7057809873 · CI 5 success, 13 skipped, 18 in progress · 2026-11-21T05:18Z

  • The changed pin, FilterConditionField.emptyOperators-10790 in @object-ui/fields, is a test-only edit. It splits its CONTROL into two.
    • The equality CONTROL ("seed equals row is untouched") still runs over every column except multiselect. Its harness-sanity purpose is intact.
    • A new CONTROL pins that a multiselect row seeds 「Contains」 and emits ''.
    • The WRITER rows ($empty per operator per type, multiselect included) are unchanged. So the pin still guards objectui#10790's empty-operator writing, and it now also records this PR's seed rule. That is the correct direction: the shared builder's seed follows operatorsForField, and equals on a multi-value column is a server 400.
  • Nit: the changeset names only the list. FilterConditionField, the fields widget hosting the shared builder, now seeds and offers the same multi-value set. Consider one line saying so.

R1 (carried): CI is running. Land when it is green.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me

Landing · head a9ef27ad8b · after L1-a ACCEPT 7057604096, delta ACCEPTs 7057776804 + 7057820512 (R1: CI green on this head) · 2026-11-21T05:38Z

Probe Reading
Checks at head a9ef27ad8b skipped:13 success:45
Governed not governed (L1-a record)
Contract record not owed (UI only, no packages/spec)
Dogfood battery not owed (no !, no narrowing arm)
Overlap merge-tree clean vs origin/main (L1-a record)

Nit (changeset names only the list; FilterConditionField gets the same multi-value set): declined here, since a push would rerun the whole CI for a changelog line. The area will carry it in the next changeset that touches the shared builder.

Status: pr_ready + automerge_enable. Fixes #35559: on MERGED the area posts the close-out; follow-up #35992 stays open.

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/l tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants