Repository navigation
Commit 0004e8d
fix(plugin-list): withhold the In a queue toggle on a view whose filter pins owner_id (#34623)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBM4G57dB19BKkNck4JJf8GN)_
Fixes #34580
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:列表工具栏的「在队列中」开关,在当前视图自己的过滤条件已经要求「负责人必须有值」(顶层 AND 里 `owner_id` 为
`equals` 某人、`in` 一组人或 `is_not_empty`)时不再显示;写在 OR
组里的负责人条件不算。开关隐藏期间不再往查询里加条件;若之前处于打开状态会被关掉,切回能显示它的视图时是关闭的。
- 为什么改:开关加的条件是「负责人为空且在某个队列里」,和「负责人 = 我」矛盾,所以在
HotCRM「我的未结商机」这类视图上打开它永远是空列表,用户会误读成「队列里没有东西」。
- 风险与回滚:只改 `@object-ui/plugin-list` 的工具栏判断,不动元数据、契约和服务端;另把文档
`queues-and-assignment-rules.mdx`
里描述开关何时出现的一句改成两个条件都写明。最坏情况是某个视图上开关被多藏了一次(只在负责人确实被钉死时才藏)。回滚即 revert 本 PR。
- 先看:① `ui/packages/plugin-list/src/ListView.tsx` 的
`viewFilterRequiresOwner` 与它下面的 `conjunctsOf` /
`requiresOwnerValue`(哪些算「顶层 AND」、哪些运算符算「必须有值」);② 同文件
`queueFilterOffered` 处新加的 `viewPinsOwner` 与重置 effect;③
`ListView.harness.test.tsx` 新增的 `ListView.queueToggleOwnerPin-34580` 块。
- 两分钟验证:在仓根执行 `pnpm --dir ui exec vitest run
packages/plugin-list/src/__tests__/ListView.harness.test.tsx -t
34580`,预期 6 个测试全部通过。
- 需要你做的:无,席位落地。
## What changes
`ui/packages/plugin-list/src/ListView.tsx`:
- New exported `viewFilterRequiresOwner(viewFilter)`. It lowers the
view's own filter through the shared `toFilterNodeSafely` (so a stored
rule list, an AST and a MongoDB-style object answer alike), walks the
conjuncts of the top-level AND (nested `and` nodes and implicit-AND
lists included, `or` nodes skipped), and answers true when one conjunct
is on `owner_id` (`SystemFieldName.OWNER_ID`) with an operator that
requires a value, folded by the spec's `canonicalAstOperator`:
- `=` (any spelling: `equals`, `eq`, `==`) with a non-empty scalar
comparand;
- `in` with a list whose every member is a non-empty scalar;
- `is_not_empty` (any spelling; direction comes from the operator name,
as the spec's lowering reads it).
A filter the lowering refuses pins nothing here; the list already
answers it with its load error.
- `queueFilterOffered` adds `&& !viewPinsOwner`, where `viewPinsOwner =
viewFilterRequiresOwner(authoredFilter)` (the resolved view filter the
fetch, export and empty state already read). Since
`appliedQueueSittingConditions` is gated on `queueFilterOffered`, a
withheld toggle contributes no condition.
- An effect lets go of a pressed state while the view pins the owner, so
a view that offers the toggle again shows it off (acceptance 4). It
sends no extra query: the applied conditions are already the empty
constant while withheld.
No new key, no server reading, no contract change.
## Why
The toggle AND-s `owner_id is_empty` and `queue is_not_empty`
(`QUEUE_SITTING_CONDITIONS`). Beside a view filter `owner_id equals
{current_user_id}` (HotCRM's "My Open Deals") the conjunction has no
rows whatever the data, and the user reads the empty list as "nothing is
waiting in a queue". Same rule as the `hasAnyQueue` gate: offer an
affordance only where it can do something.
## Tests
Added as a top-level `describe('ListView.queueToggleOwnerPin-34580')` in
`ui/packages/plugin-list/src/__tests__/ListView.harness.test.tsx`,
opening with `restoreAfterBlock()`, among the blocks that register no
stand-in renderer (AGENTS.md: a new pin for a component that already has
a shared harness file goes into that file, ruling record 6583487846).
The toggle's existing offer rules stay pinned in
`ListView.queueSittingFilter-25769.test.tsx`, untouched.
- `viewFilterRequiresOwner` pins on equals / in / is_not_empty across a
stored rule list, an AST triple, a nested `and`, an implicit-AND list
and a MongoDB-style object; it does not pin inside an OR group (stored
`{ or: [...] }` and AST `or`), on `not_equals`, `is_empty`, `= null`, or
an `in` list holding null.
- Acceptance 1: "My Open Deals" (`owner_id equals {current_user_id}` +
`stage not_in [...]`, resolved through `FilterScopeProvider`): no
toggle, and the query carries no `is_empty`.
- Acceptance 2 and 3: "All Opportunities" (no owner condition): the
toggle renders off, and pressing it still AND-s both queue conditions
beside the view's stage filter.
- OR group: an owner condition inside `{ or: [...] }` keeps the toggle.
- Acceptance 4: one mount, the view filter changed by `rerender`:
pressed on the unpinned view, then the pinned view shows no toggle and
its query has no `is_empty`, then back on the unpinned view the toggle
is shown with `aria-pressed="false"` and the query has no queue
condition.
## Acceptance notes
- In the console the host remounts `ListView` per view (`identityKey` in
app-shell's `objectViewListRenderer.tsx`), so a view switch there
already resets the toggle; the rerender pin covers hosts that hand one
instance a new `filter`.
- A one-member any-of group `{ or: [rule] }` is lowered by
`toFilterNode` to the bare rule, so it pins: it is logically the same
condition. Groups of two or more members do not pin.
- Docs (round 2, L1-a REWORK 6938675239):
`content/docs/automation/queues-and-assignment-rules.mdx`, the sentence
on when the **In a queue** toggle shows, now names both shipped
conditions: the organization has at least one queue, and the view's own
filter does not require `owner_id` to hold a value. The file joined the
claim surface by the seat's amendment 6938684810.
- Open question (not implemented, per the card): per-object narrowing.
Measured in this repository at `144cdc25`: the only client-visible queue
signal is the organization-wide boolean `hasAnyQueue` on `GET
/auth/me/permissions` (no names, no counts, nothing per object), and the
`queue` column is injected on every `ownership: 'user'` object. So no
per-object signal exists to read without a new server reading; it stays
the maintainer's ruling the card raises.
## Verification
Round 1 readings below are against head `fc84516b` (base `144cdc25`).
Round 2 (`79f051de`) adds only the docs sentence; its gate run is the
last block.
<details><summary>Tests</summary>
Run from the repository root, `ui/` as vitest root, at `fc84516b`; each
under `scripts/pm/os-verify-lock.sh`.
- `pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-list/` →
`Test Files 174 passed (174)`, `Tests 1863 passed (1863)`, lock `VERDICT
command-exit 0`.
- `pnpm --dir ui exec vitest run --reporter=verbose
packages/plugin-list/src/__tests__/ListView.harness.test.tsx -t 34580` →
the six `ListView.queueToggleOwnerPin-34580` tests listed ✓, `VERDICT
command-exit 0`.
- `pnpm --filter @object-ui/plugin-list type-check` (`tsc --noEmit &&
tsc -p tsconfig.test.json`) → `VERDICT command-exit 0`.
- `npx eslint src/ListView.tsx src/__tests__/ListView.harness.test.tsx`
(from the package, as Lint UI runs it) → 0 errors (warnings only, all
`no-explicit-any`, the harness's existing style).
- `pnpm --dir ui run check:new-line-citations` → `0 new citation(s)`.
- Closure built first: `npx turbo run build
--filter='@object-ui/plugin-list^...' --concurrency=2` → `VERDICT
command-exit 0`.
</details>
<details><summary>Ablation</summary>
Two mutations through `node scripts/ablation-replace.mjs` (anchor hit 1
→ 0, blob moved, restore proved by blob == HEAD and an empty `git diff
HEAD`), each running `pnpm --dir ui exec vitest run
packages/plugin-list/src/__tests__/ListView.harness.test.tsx -t 34580`.
The subject is imported from source (`../ListView`), so no build sits
between the mutation and the run.
1. `queueFilterOffered` without `&& !viewPinsOwner` → `Tests 2 failed |
4 passed`: "My Open Deals": no toggle… and switching views… went red.
2. The reset effect's `setSittingInQueueOnly(false)` replaced by `void
0` → `Tests 1 failed | 5 passed`: only switching views… went red (the
toggle came back `aria-pressed="true"`).
Both restored; `git diff HEAD` empty after each.
</details>
<details><summary>Derived gates</summary>
`node scripts/pm/dispatch-gates.mjs --commands` (change set of 3 paths
vs merge base `144cdc254`), each run at `fc84516b`, then `--ran` → `38
derived famil(ies) accounted for — 38 run, 0 NOT-MEASURED`.
```text
node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-sdui-manifest.mjs :: exit 0
node scripts/check-sdui-manifest.mjs --self-test :: exit 0
node scripts/ci/snapshot-next.mjs --self-test :: exit 0
node scripts/pm/check-governed-queue-guard.mjs --self-test :: exit 0
node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
node scripts/release-pending-publish.mjs --self-test :: exit 0
pnpm --dir ui exec vitest run scripts/ :: exit 0
pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0
pnpm check:adr-anchors :: exit 0
pnpm check:changeset-gate-self-tests :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:dispatcher-error-vocabulary :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:engine-double-contract :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:published-files :: exit 0
pnpm check:query-options-erasure :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:registry-log-declared :: exit 0
pnpm check:rest-log-spy-declared :: exit 0
pnpm check:skill-identifier-liveness :: exit 0
pnpm check:test-source-alias :: exit 0
pnpm check:tier-file-adoption :: exit 0
pnpm check:type-check-coverage :: exit 0
pnpm check:type-check-debt :: exit 0
pnpm check:undeclared-dep-imports :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm check:where-matcher :: exit 0
```
`node scripts/pm/check-governed-merges.mjs --branch HEAD` → `0 of 3
path(s) hit the register`, NOT governed; size +218 / −4.
</details>
<details><summary>Round 2 derived gates (79f051d)</summary>
After the docs commit the change set is 4 paths and `--commands` derives
70 families; all 70 were run at `79f051de`, each `:: exit 0`, and
`--ran` reports 70 run, 0 NOT-MEASURED. The tree was 24 commits behind
`origin/main` at derivation; per AGENTS.md section 10, `main` was not
merged in (no conflict, no main-caused red).
```text
node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
node scripts/check-adr-links.mjs :: exit 0
node scripts/check-adr-links.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-doc-route-spelling.mjs --advisory :: exit 0
node scripts/check-doc-route-spelling.mjs --self-test :: exit 0
node scripts/check-docs-section-name.mjs :: exit 0
node scripts/check-docs-section-name.mjs --self-test :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-sdui-manifest.mjs :: exit 0
node scripts/check-sdui-manifest.mjs --self-test :: exit 0
node scripts/check-section-landing-index.mjs :: exit 0
node scripts/check-section-landing-index.mjs --self-test :: exit 0
node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0
node scripts/ci/snapshot-next.mjs --self-test :: exit 0
node scripts/pm/check-governed-queue-guard.mjs --self-test :: exit 0
node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
node scripts/release-pending-publish.mjs --self-test :: exit 0
pnpm --dir ui exec vitest run scripts/ :: exit 0
pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0
pnpm --filter @objectstack/lint run check:doc-security-posture :: exit 0
pnpm --filter @objectstack/spec run check:docs :: exit 0
pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0
pnpm --filter @objectstack/spec run check:empty-state :: exit 0
pnpm --filter @objectstack/spec run check:liveness :: exit 0
pnpm --filter @objectstack/spec run check:skill-examples :: exit 0
pnpm --filter @objectstack/spec run check:strictness-ledger :: exit 0
pnpm --filter @objectstack/spec run check:variant-docs :: exit 0
pnpm --filter @objectstack/spec run check:yaml-examples :: exit 0
pnpm check:adr-anchors :: exit 0
pnpm check:changeset-gate-self-tests :: exit 0
pnpm check:ci-filter-parity :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:corpus-claim-drift :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:dispatcher-error-vocabulary :: exit 0
pnpm check:doc-anchors :: exit 0
pnpm check:doc-authoring :: exit 0
pnpm check:doc-frontmatter :: exit 0
pnpm check:docs-audit-scope :: exit 0
pnpm check:docs-redirects :: exit 0
pnpm check:docs-single-h1 :: exit 0
pnpm check:docs-spec-enumerations :: exit 0
pnpm check:docs-transcript-drift :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:engine-double-contract :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:published-files :: exit 0
pnpm check:published-readme-links :: exit 0
pnpm check:query-options-erasure :: exit 0
pnpm check:react-page-adapter-contract :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:registry-log-declared :: exit 0
pnpm check:rest-log-spy-declared :: exit 0
pnpm check:role-word :: exit 0
pnpm check:skill-identifier-liveness :: exit 0
pnpm check:test-source-alias :: exit 0
pnpm check:tier-file-adoption :: exit 0
pnpm check:type-check-coverage :: exit 0
pnpm check:type-check-debt :: exit 0
pnpm check:undeclared-dep-imports :: exit 0
pnpm check:vendor-version-stamps :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm check:where-matcher :: exit 0
```
</details>
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(`packages/spec` untouched.)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes. (eslint on the two
changed files: 0 errors.)
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: n/a.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzgSfnXy1nRQDKzcsXw)_
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzgSfnXy1nRQDKzcsXw -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>1 parent b86331d commit 0004e8d
4 files changed
Lines changed: 219 additions & 5 deletions
File tree
- .changeset
- content/docs/automation
- ui/packages/plugin-list/src
- __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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
1072 | 1072 | | |
1073 | 1073 | | |
1074 | 1074 | | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
1075 | 1120 | | |
1076 | 1121 | | |
1077 | 1122 | | |
| |||
2578 | 2623 | | |
2579 | 2624 | | |
2580 | 2625 | | |
| 2626 | + | |
| 2627 | + | |
| 2628 | + | |
| 2629 | + | |
2581 | 2630 | | |
2582 | 2631 | | |
2583 | 2632 | | |
2584 | 2633 | | |
2585 | | - | |
| 2634 | + | |
| 2635 | + | |
| 2636 | + | |
| 2637 | + | |
| 2638 | + | |
2586 | 2639 | | |
2587 | 2640 | | |
2588 | 2641 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
1420 | 1420 | | |
1421 | 1421 | | |
1422 | 1422 | | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
1423 | 1570 | | |
1424 | 1571 | | |
1425 | 1572 | | |
| |||
0 commit comments