Repository navigation
Commit 6aacad9
fix(ui): condition editors offer a multiple: true field only what its evaluator answers (#36165)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XP3RHGWUG7UH3fNa4tBa9UC)_
Part of #35992 — the condition-editor half. The dashboard filter bar
half is left open on the card: it is built on its own branch under the
same claim, route A per seat note 7066557346 (see Acceptance notes).
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 在工作室里给"多选"字段(例如可选多人的负责人字段)写条件时,下拉框现在只给"包含 / 不包含 / 为空 /
不为空",不再给一定出错或算错的"等于 / 属于";仪表盘筛选栏这一半没改。
- 属于"多值字段筛选"这组修复,接着上一张让列表筛选支持多值字段的卡做完条件编辑器部分。
- 影响写共享规则条件、数据集筛选、关联列表筛选和流程分支条件的管理员;只改界面给出的选项,已存的条件原样不动,可以直接撤回。
- 要你做的一件事:无。仪表盘筛选栏那一半已由席位定为路线 A(可选的 DataSource 读数据集定义),在同卡另一分支施工。
## What changes
A `select` / `lookup` / `user` field declared `multiple: true` stores a
list. The condition editors built their field lists without `multiple`,
so the shared `FilterBuilder` treated such a field as single-value and
offered `Equals` / `Is any of`. Each editor's evaluator was measured
first (below); every one of them refuses or mis-answers those operators,
so each now passes `multiple` and the builder offers
`jsonColumnFilterOperators`' set (Contains, Does not contain, Is empty,
Is not empty). No operator table is copied: every surface asks
`operatorsForField` / `jsonColumnFilterOperators`.
| Editor | Evaluator | Measured on a list-valued field | Change |
|---|---|---|---|
| `@object-ui/fields` `FilterConditionField` (sharing-rule criteria,
roll-up filters) | engine `find` (data door) | `=` and `$in`: 400
`INVALID_FILTER`; `$contains`, `$or` of `$contains`: rows | passes
`multiple` |
| Studio `FilterConditionField` + `datasetFilterCondition` (dataset
scope / measure filter) | `POST /analytics/dataset/query` | `=` and
`$in`: **200 with a count of 0**; `$contains` / `$notContains` /
`$empty`: right counts | passes `multiple`; read-back asks
`operatorsForField`, so a stored `$eq` / `$in` there opens in Source
instead of as an `equals` row |
| same editor, a field's `relatedListFilter` | data door | as the first
row | passes `multiple` |
| Studio flow edge rows (`flow-edge-condition-rows`) | `celEngine` (CEL)
| `S == 'u1'` false for `['u1','u2']`; `S.contains('u1')` faults (no
overload for list); `'u1' in S` true | passes `multiple`; `contains` /
`not_contains` on a list write `S != null && V in S` / `S == null \|\|
!(V in S)` and read back; offered set read from `operatorsForField` |
The flow rows and the CEL `ConditionBuilder` read their fields from
`useObjectFields`, which now carries the served `multiple` (one more
read of the same payload, like `required` / `system`).
Read first, by risk:
1.
`ui/packages/app-shell/src/views/metadata-admin/inspectors/flow-edge-condition-rows.ts`
— the membership spellings and the two new read-back patterns
(`celToRows` adopts a guard only when `rowsToCel` re-writes it byte for
byte).
2.
`ui/packages/app-shell/src/views/metadata-admin/inspectors/datasetFilterCondition.ts`
— `builderHolds` / `readBackOperator` now ask `operatorsForField(type,
multiple)`; a stored `$in` on a list field stops opening as a row.
3.
`ui/packages/app-shell/src/views/metadata-admin/previews/useObjectFields.ts`
— the `multiple` projection. It also makes `ConditionBuilder`'s existing
multi-value 「is empty」 arm reachable from the hook path (it was
reachable only through a `fields` prop).
Two-minute check: `pnpm --dir ui exec vitest run
packages/app-shell/src/views/metadata-admin/inspectors/flow-edge-condition-rows.multiValue-35992.test.ts`.
Expect 12 passed. Each spelling there is evaluated by `celEngine`.
## Tests
New files named for the card:
- `flow-edge-condition-rows.multiValue-35992.test.ts`: the offered set
is the helper's. Contains and Does not contain write membership, read
back, and the engine answers them on a list, on null, and as any-of. The
`==` control is false. A single-value column keeps its equality
spelling.
- `FlowEdgeInspector.multiValue-35992.test.tsx`: a membership guard on a
`multiple: true` user column opens as one row. Its real operator
dropdown lists exactly Contains / Does not contain / Is empty / Is not
empty.
- `datasetFilterCondition.multiValue-35992.test.tsx`: both field
catalogs (`buildFieldOptions`, `useObjectFields`) mark exactly the
`multiple: true` columns. `$contains` / `$notContains` / `$empty` open
as rows, and `$eq` / `$in` go to Source. Single-value controls still
open `$eq` / `$in` as rows.
- `FilterConditionField.multipleField-35992.test.tsx` (fields): a
`multiple: true` user / lookup / select column's real operator dropdown
equals `operatorsForField`'s labels. Single-value controls keep Equals.
<details><summary>Reverse verification (source at base, new tests
kept)</summary>
Committed first. The nine source files were then restored to the base
`30b0987c` with the new tests kept: **19 failed / 10 passed** (the
passing 10 are the single-value controls and the refusal rows). Restored
with `git checkout HEAD -- PATH`. `git diff HEAD` came back empty, and
all nine `git hash-object` values matched the HEAD blobs.
</details>
<details><summary>Affected suites</summary>
`pnpm --dir ui exec vitest run --maxWorkers=2
packages/app-shell/src/views/metadata-admin/inspectors/
packages/app-shell/src/views/metadata-admin/previews/useObjectFields.draftOverlay-11895.test.tsx
packages/fields/src/widgets/__tests__/` → Test Files 279 passed (279),
Tests 3679 passed, 1 skipped (3680). The full `@object-ui/app-shell` /
`@object-ui/fields` suites are CI's (`Test UI`).
</details>
## Acceptance notes
- **Dashboard filter bar: not in this PR.** `buildFilterCondition`
lowers a select / lookup global filter to `=` / `$in` with no knowledge
of the bound field. That field's definition is not reachable at the
binding site. A dataset-bound widget learns its base object only from
its own query's answer (`AnalyticsResult.object`; `DashboardView` says
the same), and the `DataSource` interface has no read for a dataset's
definition. The seat ruled route A for it (seat note 7066557346): an
optional `DataSource` member that reads a dataset definition, built on
its own branch under the same claim.
- **Premise correction, measured:** on the dashboard's door, `POST
/api/v1/analytics/dataset/query` on `showcase_project_metrics` with
`runtimeFilter: { labels: 'frontend' }` or `{ labels: { $in: [...] } }`,
the server does not refuse with 400. It answers 200 with a count of 0
(SqlDriver, better-sqlite3). The data door refuses the same filters with
400. `$contains` gives 2, an `$or` of two `$contains` gives 3, and the
substring `fron` gives 0, so this is real membership. That difference
between the two doors is tracked as #36168, not fixed here.
- The CEL `ConditionBuilder` (hook conditions, action visibility,
page-block visibility) is not on the shared builder. On a list subject
its `==` / `!=` give a constant answer, measured with `celEngine`, and
`validateExpression` accepts `record.labels == 'frontend'` with no
warning. It is tracked as #36167; its fix needs a membership operator in
that builder, which is out of this card's mechanism.
- The Studio view / page-block filter (`FilterBuilderField` in
`metadata-admin/widgets.tsx`) builds its fields without `multiple` too.
It is outside this claim's file surface and is tracked as #36169.
## Verification
<details><summary>Local gates</summary>
All 38 families from `node scripts/pm/dispatch-gates.mjs --commands
--repo objectstack-ai/objectstack` exited 0, each exit code captured
before any pipe. `--ran` reconciliation: 38 derived, 38 run, 0
NOT-MEASURED, and the zero is derived because every family recorded an
exit code. After the `@object-ui/app-shell^...` dependency closure was
built, `pnpm --filter @object-ui/fields run type-check` and `pnpm
--filter @object-ui/app-shell run type-check` both exited 0, each
covering the `src` program and `tsconfig.test.json`.
`ui/scripts/check-new-cross-file-line-citations.mjs` reported 0 new
citations.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01FEkQ5okniknzVVR3KTSVr1)_
<!-- signed: repo:objectstack#4 · os-project-manager ·
session_01FEkQ5okniknzVVR3KTSVr1 -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 04f9861 commit 6aacad9
14 files changed
Lines changed: 547 additions & 22 deletions
File tree
- .changeset
- ui/packages
- app-shell/src/views/metadata-admin
- inspectors
- previews
- fields/src/widgets
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
461 | | - | |
| 461 | + | |
462 | 462 | | |
463 | 463 | | |
464 | 464 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
38 | 44 | | |
39 | 45 | | |
40 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
110 | 113 | | |
111 | 114 | | |
112 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3123 | 3123 | | |
3124 | 3124 | | |
3125 | 3125 | | |
| 3126 | + | |
3126 | 3127 | | |
3127 | 3128 | | |
3128 | 3129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
120 | 130 | | |
121 | 131 | | |
122 | 132 | | |
| |||
143 | 153 | | |
144 | 154 | | |
145 | 155 | | |
146 | | - | |
147 | | - | |
148 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
149 | 159 | | |
150 | 160 | | |
151 | 161 | | |
| |||
155 | 165 | | |
156 | 166 | | |
157 | 167 | | |
158 | | - | |
| 168 | + | |
159 | 169 | | |
160 | | - | |
161 | | - | |
| 170 | + | |
| 171 | + | |
162 | 172 | | |
163 | 173 | | |
164 | 174 | | |
| |||
351 | 361 | | |
352 | 362 | | |
353 | 363 | | |
354 | | - | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
355 | 367 | | |
356 | 368 | | |
357 | 369 | | |
| |||
364 | 376 | | |
365 | 377 | | |
366 | 378 | | |
367 | | - | |
368 | | - | |
| 379 | + | |
| 380 | + | |
369 | 381 | | |
370 | 382 | | |
371 | 383 | | |
| |||
432 | 444 | | |
433 | 445 | | |
434 | 446 | | |
435 | | - | |
| 447 | + | |
436 | 448 | | |
437 | 449 | | |
438 | 450 | | |
| |||
0 commit comments