Skip to content

Commit 6210a08

Browse files
fix(kanban): a list view board laned by a lookup shows each lane's whole sum, avg, min and max, not one page's (#37295)
repo:objectstack#4 · os-justin · session_01QSeKYnagJvGbCtNg2PhvgW Fixes #36871 Clause-②: yes (widening) Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:列表里的看板,泳道按查找字段决定时,泳道底部的合计、平均、最小、最大值现在按整条泳道的全部记录计算,不再只加当前这一页;平均、最小、最大也不再空白。 - 为什么做:看板泳道统计这一族的收尾(上一张卡已让看板自己查询时按整条泳道计算),这里补上列表把一页数据交给看板的那条路径。 - 出错会怎样:最坏是泳道底部不显示统计数字,不会显示错误的数字;卡片、泳道和计数不受影响,可直接撤回。 - 要你做什么:无 ## What changes Route **(A)**, the preferred one: on ListView's rows-handed kanban path the board now queries its lane figures over the whole lane, through the same `queryGroupHeaders` + `readLaneStatistic` read a self-querying board uses (a cut answer, a refused read or a source without the door draws no figure). That fixes `sum`, `avg`, `min` and `max` at once, so no "loaded only" marker and no new locale string is needed, and the view-settings picker stays as it is. - `@object-ui/plugin-list` (`ListView.tsx`): new `kanbanLaneStatisticHosted` = kanban view, not lane-paged, and this list fetches for itself (not inline rows, not a `value` provider). For that board the node's `filter` is the effective filter the list's own window was fetched with (`selfQueryFilter`, the same value the lane-paged board gets), and a new host prop `laneStatisticQuery` carries the toolbar search term and fields and a reload key built from `refreshKey`, `refreshTrigger` and the invalidation nonce. - `@object-ui/plugin-kanban`: `ObjectKanban` takes `laneStatisticQuery` (type `KanbanLaneStatisticRequest`, in `KanbanLaneStatistic.ts`). With handed cards and that prop, `laneReadAsked` is true and the board asks the lane read under the node filter and the host's search pair, and asks again when the reload key moves. Without the prop nothing changes: cards handed in whole still get a `sum` added up over them, and no other figure. - Docblocks updated: `LaneFootStatistic` (`KanbanImpl.tsx`), `KanbanColumnSummary.figures`, the `KanbanLaneStatistic.ts` module header. - `@objectstack/spec`: the `KanbanConfig.summary` describe (`packages/spec/src/ui/view.zod.ts`) and the `KanbanLaneSummarySchema` docblock drop the "known gap" sentence and say what that board draws. The generated mirror `content/docs/references/ui/view.mdx` carries the same text (`check:generated` and `check:docs` green). The describe lives in `@objectstack/spec`, not `@object-ui/types` as the claim's file surface put it: same text, different package. - `.changeset/36871-kanban-rows-handed-lane-statistic.md`: new (patch: plugin-kanban, plugin-list, spec). One sentence in it supersedes the "known gap" line of #36857's still-pending note (`.changeset/36520-kanban-lane-statistic-server.md`, left byte-identical to `main`) for the lookup-lane list view board. ### What widens (Clause-② yes) - `ObjectKanbanComponentProps`, exported by `@object-ui/plugin-kanban`, gains the optional `laneStatisticQuery?: KanbanLaneStatisticRequest`. `KanbanLaneStatisticRequest` itself is not exported from the package index. No other exported member changed: the spec edit is describe text only, and ListView's exported props are unchanged. Overlap: `overlap-check` (no exclusions) is clean at head 790a943, and `origin/main` merges cleanly. ## Tests <details><summary>Pins added (3 files) and the ablation</summary> - `ui/packages/app-shell/src/__tests__/listKanbanEveryRecord-12619.test.tsx`: new top-level describe. The real board runs under the real ListView with a lookup lane field (`account` references `crm_account`, no options), 60 deals alternating over two accounts, and `pagination.pageSize: 25`. A rig self-check asserts 25 cards (13 / 12) are drawn. Then `sum`, `avg`, `min` and `max` read 870/900, 29/30, 0/1 and 58/59: the whole lanes, never the page's 156/144 or 24/23. The read runs under the view's filter (850/875). CONTROL: a source with no grouped door draws no figure, never the page's sum. - `ui/packages/plugin-kanban/src/ObjectKanban.laneStatistic-36370.test.tsx`: a board handed 3 cards plus `laneStatisticQuery` draws the whole lane's `sum`, `avg`, `min` and `max` (2415 / 34.5 / 0 / 69) and calls no `find`. The read carries the node filter and the host's search pair, and it is asked again when `reloadKey` moves. The existing "adds the cards a host hands in" test is the control for cards handed in without their query. - `ui/packages/plugin-list/src/__tests__/ListView.kanbanOwnsLanes-12619.test.tsx`: the rows-handed board gets `data`, `laneStatisticQuery` and, as `filter`, exactly the `$filter` of the list's own query. The swimlane board gets the request too. CONTROLS: the lane-paged board does not get it, and neither does a board over `value`-provider rows. - Ablation, committed first and then run with `node scripts/ablation-replace.mjs` on `ObjectKanban.tsx`: `const laneReadAsked = boardQueriesItself || hostHandsQuery;` became `... || (hostHandsQuery && false);`. Anchor count went 1 to 0, blob `908a872bc29b` to `396418ba8a82`. Result: **11 failed / 25 passed**. That is every new 36871 pin in both suites, the no-door CONTROL included, because the page's sum came back. The red is the defect itself: `expected '156' to be '870'`, `expected '286' to be '850'`, `expected '3' to be '2415'`. Restored: blob after restore equals HEAD (`908a872bc29b`), and `git diff HEAD` is empty. </details> <details><summary>Suites and type-checks (head da9a59c; 790a943 changes only changeset text)</summary> - `vitest run packages/plugin-kanban/ packages/plugin-list/` (ui root config): Test Files 274 passed, Tests 2650 passed. - The three touched test files alone: Test Files 3 passed, Tests 49 passed. - `pnpm --filter @object-ui/plugin-kanban run type-check` and `... plugin-list run type-check`: exit 0, both. Each covers `tsconfig.test.json`. - `@object-ui/app-shell` type-check: not run locally, left to CI (`Type Check UI`). </details> ## Acceptance notes - **Swimlane board (a view with grouping).** The swimlane layout draws no lane foot at all: `LaneFootStatistic` is rendered only in `KanbanColumnView`, the flat layout. So the card's "grouped view" face does not exist as a page-scoped sum. The board still offers every statistic in the picker and then draws none. That is reported, not fixed here. - **Other faces of the same path, left alone.** On the rows-handed board the lane header count and the foot `count` still count the page, with no `+`. A lane whose records all fall past the first page is not drawn. A `summarizeField` header total still sums the page. The list footer's window warning is the only marker of the window. All of these are reported, not fixed here. - Cards handed in whole without a query (inline rows, or a host that is not ListView) still draw `sum` only. That is correct for `sum`, and `avg`/`min`/`max` stay blank there, as before. ## Verification - Read first: `ObjectKanban.tsx` at `hostQuery` / `hostHandsQuery` / `laneReadAsked` (the gate), `ListView.tsx` at `kanbanLaneStatisticHosted` and the `laneStatisticQuery` spread, then the app-shell describe. - Two-minute check: `cd ui && pnpm exec vitest run packages/app-shell/src/__tests__/listKanbanEveryRecord-12619.test.tsx`. Expect 9 passed, and the 36871 describe shows `sum covers every record of each lane over a window of one page`. <details><summary>Derived gate families (local subset, head da9a59c)</summary> `dispatch-gates --commands` derived 117 commands. With `--ran`: 117 derived, 116 run, 1 NOT-MEASURED. Exit codes: - 114 exited 0. `check-empty-changeset.mjs --base origin/main` exited 1 at da9a59c on the pending note's edit, which is now reverted. - Re-run at head 790a943: `check-empty-changeset --base origin/main`, `check-adr-0087-registration --base origin/main` and `check-changeset-no-major --base origin/main` all exit 0. - `pnpm --dir ui exec vitest run scripts/` exit 1, NOT MEASURED. Its failures (absent eager-closure chunk, date-only-zone forks runs, doc-snippet root bound) need a full ui build this box does not have, and none names a file in this diff. Left to CI. - `pnpm check:dual-build-cjs-loads` exit 3, NOT MEASURED: it needs a full `pnpm build`. - Re-run after the spec and closure build, all exit 0: `check:doc-formula-expressions`, `check:doc-security-posture`, `check:skill-examples`, `check:generated`, `check:docs`, `check:dts-closure`. On the first pass these exited 3 or 1, against dist still being built. - `check:nul-bytes` exit 0. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01QSeKYnagJvGbCtNg2PhvgW)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 039b288 commit 6210a08

11 files changed

Lines changed: 393 additions & 34 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@object-ui/plugin-kanban': patch
3+
'@object-ui/plugin-list': patch
4+
'@objectstack/spec': patch
5+
---
6+
7+
fix(kanban): a list view board whose lanes come from a lookup field shows each lane's whole sum, average, minimum and maximum, not one page's
8+
9+
Clause-②: yes (widening)
10+
Metadata-protocol: none
11+
12+
A list view board whose lanes it cannot know before the query (lanes over a lookup field) is handed one page of records. Its lane statistic (`kanban.summary`) used to add up that page under the name of the lane's total, and drew no average, minimum or maximum at all although the view settings offer them.
13+
14+
- **`@object-ui/plugin-list`**: the list view now hands that board the query of its page too: the node's `filter` is the effective filter its own fetch sent, and a new host prop, `laneStatisticQuery`, carries its search term and fields and its refetch signal (Refresh, `refreshTrigger`, a declared write).
15+
- **`@object-ui/plugin-kanban`**: a board handed its cards with `laneStatisticQuery` asks the lane read a board that queries its own cards asks: one grouped aggregate (`DataSource.queryGroupHeaders`) over every record of each lane. `sum`, `avg`, `min` and `max` are the whole lane's figures; a source without that door, a refused read or a cut answer draws no figure, never the page's. A board handed its cards without their query (records handed in whole) still adds up a `sum` over them and draws none of the other three.
16+
- **`@objectstack/spec`**: the `KanbanConfig.summary` description drops the "known gap" sentence and says what such a board draws.
17+
- **What widens:** `ObjectKanbanComponentProps` (exported by `@object-ui/plugin-kanban`) gains the optional `laneStatisticQuery?: KanbanLaneStatisticRequest`. Every existing caller is unchanged.
18+
19+
This supersedes the "known gap" line of #36857's note (follow-up #36871) for the list view board whose lanes come from a lookup field: that board's `sum`, `avg`, `min` and `max` now cover every record of each lane.

‎content/docs/references/ui/view.mdx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ HTTP methods a view data source may request — the subset of `HttpMethod` witho
689689
| **groupByField** | `string` | ✅ | Field to group columns by (usually status/select). NO leading or trailing whitespace: the board reads this name off every card verbatim, so a padded spelling collapses the whole board into one `Uncategorized` lane. |
690690
| **lanes** | `string[]` | optional | The lanes the board draws, in this order: stored option values of the groupByField field (the option `value`, not its label). Omit to draw one lane per option in the options' own order. A record whose value is not listed is not hidden: it lands in the `Uncategorized` lane, as a record whose value matches no lane does. To keep records off the board, filter the view. List each value once. |
691691
| **summarizeField** | `string` | optional | Field to sum at top of column (e.g. amount) |
692-
| **summary** | `{ type: 'none' } \| { type: 'count' } \| { type: 'sum'; field: string } \| { type: 'avg'; field: string } \| … +2 more` | optional | The statistic each lane shows at its foot. `{ type: 'count' }` counts the lane records; `{ type: 'sum', field: 'amount' }` totals a number field over all of the lane records, `avg` averages it, and `min` / `max` show its smallest / largest value, each computed by the query (a field the reader may not read shows no figure); `{ type: 'none' }` shows nothing. Known gap: on a board given its records by its host instead of querying them (in a list view, lanes over a lookup field or a view with grouping), `sum` totals the records handed in, one page, unmarked, and the other three show nothing. Takes precedence over summarizeField. Omit to keep summarizeField's sum, or no statistic without it. |
692+
| **summary** | `{ type: 'none' } \| { type: 'count' } \| { type: 'sum'; field: string } \| { type: 'avg'; field: string } \| … +2 more` | optional | The statistic each lane shows at its foot. `{ type: 'count' }` counts the lane records; `{ type: 'sum', field: 'amount' }` totals a number field over all of the lane records, `avg` averages it, and `min` / `max` show its smallest / largest value, each computed by the query (a field the reader may not read shows no figure); `{ type: 'none' }` shows nothing. A list view board whose lanes come from a lookup field draws one page of records: its `sum`, `avg`, `min` and `max` still cover every record of each lane, and its `count` counts that page. Only on a board handed its records whole, without their query, does `sum` total the records handed in and the other three show nothing. Takes precedence over summarizeField. Omit to keep summarizeField's sum, or no statistic without it. |
693693
| **showFieldLabels** | `boolean` | optional | Whether each card names its fields beside their values. Omit for true (names shown); false shows the values alone. |
694694
| **hideEmptyFields** | `boolean` | optional | Whether a card leaves out a field that holds no value. Omit for true (left out); false keeps the field with an empty value. |
695695
| **titleField** | `string` | optional | Field displayed as the card title. Omit to fall back to the record display name (ADR-0079 resolver chain) |
@@ -1043,7 +1043,7 @@ An any-of group: `{ or: [rule, ...] }` matches a record when ANY of its rules ma
10431043
| **groupByField** | `string` | ✅ | Field to group columns by (usually status/select). NO leading or trailing whitespace: the board reads this name off every card verbatim, so a padded spelling collapses the whole board into one `Uncategorized` lane. |
10441044
| **lanes** | `string[]` | optional | The lanes the board draws, in this order: stored option values of the groupByField field (the option `value`, not its label). Omit to draw one lane per option in the options' own order. A record whose value is not listed is not hidden: it lands in the `Uncategorized` lane, as a record whose value matches no lane does. To keep records off the board, filter the view. List each value once. |
10451045
| **summarizeField** | `string` | optional | Field to sum at top of column (e.g. amount) |
1046-
| **summary** | `{ type: 'none' } \| { type: 'count' } \| { type: 'sum'; field: string } \| { type: 'avg'; field: string } \| … +2 more` | optional | The statistic each lane shows at its foot. `{ type: 'count' }` counts the lane records; `{ type: 'sum', field: 'amount' }` totals a number field over all of the lane records, `avg` averages it, and `min` / `max` show its smallest / largest value, each computed by the query (a field the reader may not read shows no figure); `{ type: 'none' }` shows nothing. Known gap: on a board given its records by its host instead of querying them (in a list view, lanes over a lookup field or a view with grouping), `sum` totals the records handed in, one page, unmarked, and the other three show nothing. Takes precedence over summarizeField. Omit to keep summarizeField's sum, or no statistic without it. |
1046+
| **summary** | `{ type: 'none' } \| { type: 'count' } \| { type: 'sum'; field: string } \| { type: 'avg'; field: string } \| … +2 more` | optional | The statistic each lane shows at its foot. `{ type: 'count' }` counts the lane records; `{ type: 'sum', field: 'amount' }` totals a number field over all of the lane records, `avg` averages it, and `min` / `max` show its smallest / largest value, each computed by the query (a field the reader may not read shows no figure); `{ type: 'none' }` shows nothing. A list view board whose lanes come from a lookup field draws one page of records: its `sum`, `avg`, `min` and `max` still cover every record of each lane, and its `count` counts that page. Only on a board handed its records whole, without their query, does `sum` total the records handed in and the other three show nothing. Takes precedence over summarizeField. Omit to keep summarizeField's sum, or no statistic without it. |
10471047
| **showFieldLabels** | `boolean` | optional | Whether each card names its fields beside their values. Omit for true (names shown); false shows the values alone. |
10481048
| **hideEmptyFields** | `boolean` | optional | Whether a card leaves out a field that holds no value. Omit for true (left out); false keeps the field with an empty value. |
10491049
| **titleField** | `string` | optional | Field displayed as the card title. Omit to fall back to the record display name (ADR-0079 resolver chain) |
@@ -1511,7 +1511,7 @@ An any-of group: `{ or: [rule, ...] }` matches a record when ANY of its rules ma
15111511
| **groupByField** | `string` | ✅ | Field to group columns by (usually status/select). NO leading or trailing whitespace: the board reads this name off every card verbatim, so a padded spelling collapses the whole board into one `Uncategorized` lane. |
15121512
| **lanes** | `string[]` | optional | The lanes the board draws, in this order: stored option values of the groupByField field (the option `value`, not its label). Omit to draw one lane per option in the options' own order. A record whose value is not listed is not hidden: it lands in the `Uncategorized` lane, as a record whose value matches no lane does. To keep records off the board, filter the view. List each value once. |
15131513
| **summarizeField** | `string` | optional | Field to sum at top of column (e.g. amount) |
1514-
| **summary** | `{ type: 'none' } \| { type: 'count' } \| { type: 'sum'; field: string } \| { type: 'avg'; field: string } \| … +2 more` | optional | The statistic each lane shows at its foot. `{ type: 'count' }` counts the lane records; `{ type: 'sum', field: 'amount' }` totals a number field over all of the lane records, `avg` averages it, and `min` / `max` show its smallest / largest value, each computed by the query (a field the reader may not read shows no figure); `{ type: 'none' }` shows nothing. Known gap: on a board given its records by its host instead of querying them (in a list view, lanes over a lookup field or a view with grouping), `sum` totals the records handed in, one page, unmarked, and the other three show nothing. Takes precedence over summarizeField. Omit to keep summarizeField's sum, or no statistic without it. |
1514+
| **summary** | `{ type: 'none' } \| { type: 'count' } \| { type: 'sum'; field: string } \| { type: 'avg'; field: string } \| … +2 more` | optional | The statistic each lane shows at its foot. `{ type: 'count' }` counts the lane records; `{ type: 'sum', field: 'amount' }` totals a number field over all of the lane records, `avg` averages it, and `min` / `max` show its smallest / largest value, each computed by the query (a field the reader may not read shows no figure); `{ type: 'none' }` shows nothing. A list view board whose lanes come from a lookup field draws one page of records: its `sum`, `avg`, `min` and `max` still cover every record of each lane, and its `count` counts that page. Only on a board handed its records whole, without their query, does `sum` total the records handed in and the other three show nothing. Takes precedence over summarizeField. Omit to keep summarizeField's sum, or no statistic without it. |
15151515
| **showFieldLabels** | `boolean` | optional | Whether each card names its fields beside their values. Omit for true (names shown); false shows the values alone. |
15161516
| **hideEmptyFields** | `boolean` | optional | Whether a card leaves out a field that holds no value. Omit for true (left out); false keeps the field with an empty value. |
15171517
| **titleField** | `string` | optional | Field displayed as the card title. Omit to fall back to the record display name (ADR-0079 resolver chain) |

‎packages/spec/src/ui/view.zod.ts‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,12 +2384,13 @@ export const EmptyStateSchema = lazySchema(() => strictObject({
23842384
* cards a lane has loaded, so a lane longer than its page still shows the
23852385
* whole lane's figure. A field the reader may not read shows no figure.
23862386
*
2387-
* One carve-out, a known gap: a board that does not query its own cards adds
2388-
* up a `sum` over the cards its host hands it (the other three draw nothing
2389-
* there). The list view hands a board whose lanes it cannot know before the
2390-
* query — lanes over a lookup field, or a view with grouping — the page of
2391-
* records it fetched, so on that board `sum` totals that page, not every
2392-
* record of the lane, and says nothing to mark it.
2387+
* objectstack#36871: the list view hands a board whose lanes it cannot know
2388+
* before the query (lanes over a lookup field) the page of records it fetched
2389+
* AND the query of that page, so that board asks the same read and its four
2390+
* aggregates cover every record of each lane too. Its `count` counts the
2391+
* page it was handed, as its lane header does. Only a board handed its cards
2392+
* without their query (records handed in whole) adds up a `sum` over those
2393+
* cards, and draws none of the other three.
23932394
*/
23942395
export const KanbanLaneSummarySchema = lazySchema(() => z.discriminatedUnion('type', [
23952396
strictObject({
@@ -2515,9 +2516,10 @@ export const KanbanConfigSchema = lazySchema(() => strictObject({
25152516
+ '`{ type: \'sum\', field: \'amount\' }` totals a number field over all of the lane records, '
25162517
+ '`avg` averages it, and `min` / `max` show its smallest / largest value, each computed by the query '
25172518
+ '(a field the reader may not read shows no figure); `{ type: \'none\' }` shows nothing. '
2518-
+ 'Known gap: on a board given its records by its host instead of querying them (in a list view, '
2519-
+ 'lanes over a lookup field or a view with grouping), `sum` totals the records handed in, one page, '
2520-
+ 'unmarked, and the other three show nothing. '
2519+
+ 'A list view board whose lanes come from a lookup field draws one page of records: its `sum`, '
2520+
+ '`avg`, `min` and `max` still cover every record of each lane, and its `count` counts that page. '
2521+
+ 'Only on a board handed its records whole, '
2522+
+ 'without their query, does `sum` total the records handed in and the other three show nothing. '
25212523
+ 'Takes precedence over summarizeField. Omit to keep summarizeField\'s sum, or no statistic without it.',
25222524
),
25232525
/**

0 commit comments

Comments
 (0)