Repository navigation
Commit af566c2
feat(spec): count_true / count_false — a boolean column's Yes / No counts in the list footer (#35944)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4Uu2rdPF6kmGfUJf93RWp8ZKf)_
Fixes #35702
Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: none — no page under `skills/**` lists the column summary
members; the docs that do (`content/docs/ui/views.mdx`, the generated
`content/docs/references/ui/view.mdx`, the `plugin-grid` README) are
updated here
repo:objectstack#1 · os-sales · session_01L6bhgVspkxqkUdkYxY1RHf
Flow: dev-thread rule (maintainer 2026-11-20 09:22:50Z 「所有 p1
都按照新规则执行」): the card thread builds itself; L1 and the isolated L2 run in
parallel at hand-back, the maintainer's 09:22Z ruling for every p1 card
(deviates from contract-review.md:18 until the skill card lands).
The second and last PR of #35702 (PR 1 #35919, merged f909734, left
exactly this): the boolean 「是」/「否」 counts the card's 要做的 lists —
「补两种计算:布尔字段的「是」的条数、「否」的条数」. Clause-② is a widening:
`ColumnSummarySchema` gains two members, and the derived rows of
`ColumnSummaryAggregation` gain a `reads` list (`from` stays, the first
of them). Contract face, L2 at `CONTRACT_REVIEW_TIER`.
Null-cell ruling: record 7051689474 on #35702 — the maintainer chose
「不算,未填单独算「空」」 (option A, 2026-11-20 22:01:58Z). `count_true` counts the
cells holding `true`, `count_false` the cells holding `false`
(`count_FIELD` − `sum_FIELD`, never the record count); a cell with no
value is in neither and shows under 「空」 (`count_empty`), so 是 + 否 = the
filled count; with every value null, or no rows, 「是」 reads 0. That is
what this PR builds.
## 维护者速读
- 列表底部计算行里,开关(布尔)列的菜单最前面多了「「是」的条数」「「否」的条数」两项,选了显示成「是 12」「否
3」。这两个数目前只出现在底部计算行:服务端已能在分组标题上算出它们,但控制台的分组标题读的是另一套汇总设置,还没有画出来。
- 属于「列表页重做」专题里「列表底部计算行」这张卡的最后一部分,做完这张卡就关闭。
-
没填值的记录两边都不算,算在「空」里(按你在决策卡上的选择);别的类型的列菜单里不会出现这两项,元数据里硬写到数字列上会在校验时被拒;出问题撤回这个改动即可。
- 无。
## What changes
- **Spec** (`packages/spec/src/ui/view.zod.ts`,
`view-grouping-query.ts`). `ColumnSummarySchema` gains `count_true` and
`count_false`. Both map by DERIVATION, the fork-i route the four filled
/ empty members took — no new `AggregationFunction`, no driver change:
booleans aggregate as numbers on every backend (ruling #11152,
`aggregation-conformance`'s `sum(flag)` row on six backends), so
`count_true` = `SUM(field)` and `count_false` = `COUNT(field) −
SUM(field)`. `COLUMN_SUMMARY_AGGREGATION`'s derived rows carry `reads`,
every node the member reads (`count_true`: `['sum']`; `count_false`:
`['sum', 'count']`; the four filled / empty: `['count']`).
`columnSummaryNodeFunctions(mapping)` is the one reading of a row's
nodes; the group header compiler uses it, and so do the footer's
whole-set query and the lint below. `deriveColumnSummary` reads
`count_true` as the sum, `0` when the sum answered no value (no non-null
cell), and `count_false` as the non-null count less the sum.
`COLUMN_SUMMARY_FIELD_TYPES` / `isColumnSummaryCompatibleWithFieldType`
restrict the two members to the boolean class (`boolean`, `toggle`,
pinned equal to `BOOLEAN_VALUE_TYPES`).
- **Lint** (`packages/lint/src/validate-list-view-field-refs.ts`).
`columnSummaryRefusal` judges a restricted member by that table:
`count_true` / `count_false` over any other type is
`list-view-summary-field-type-refused` (`error`). The aggregate door
ACCEPTS `SUM(field)` over a number, so without this the footer would
print a total under the label 「是」 and nothing would refuse it. Its `os
explain` entry gains the paragraph.
- **Footer** (`ui/packages/plugin-grid`). `offeredColumnSummaries` lists
Count of Yes / Count of No first on a boolean or toggle column, and only
where the spec's table allows them. `wholeSetSummaryNodes` asks every
node a member reads (one `SUM(approved)` and one `COUNT(approved)` serve
both counts and `count_empty`). The page fallback computes them off the
rows as the cell reads them: only a real `true` / `false` is a value, so
a null cell is neither, as on the server. The figure is drawn as `Yes
12` / `No 3`, a plain count.
- **i18n.** `grid.summary.countTrue` / `countFalse` (the footer word,
the pack's own Yes / No) and `menuCountTrue` / `menuCountFalse` (the
menu entry) in all eleven packs.
- Docs: `content/docs/ui/views.mdx`, the `plugin-grid` README; generated
`content/docs/references/ui/view.mdx`, `api-surface/ui.json`,
`export-origins/ui.json`. Changeset `35702-boolean-yes-no-counts.md`
(`@objectstack/spec` and `@objectstack/lint` minor, `Metadata-protocol:
added`; `@object-ui/plugin-grid`, `@object-ui/i18n` patch).
Read first, by risk: `packages/spec/src/ui/view-grouping-query.ts` (the
`reads` rows, `deriveColumnSummary`'s new branch,
`summaryAggregationNodes`' loop),
`packages/lint/src/validate-list-view-field-refs.ts`
(`columnSummaryRefusal`'s restricted arm, which now resolves the field
before the aggregate-kind early return),
`ui/packages/plugin-grid/src/useWholeSetSummary.ts`
(`wholeSetSummaryNodes`).
## Tests
New:
- `packages/spec/src/ui/view-grouping-query.test.ts` — `count_true /
count_false`: the compiled nodes (one `sum_approved`, the shared
`count_approved`); per group, a null cell in neither count and `true +
false = filled` (3 / 2 / 1 null; all null reads 0 / 0; no true reads 0);
a sum that answered no value reads 0 true, a missing column reads
`undefined`, a string-spelled sum reads as a number; the field-type
table (boolean class only, pinned to `BOOLEAN_VALUE_TYPES`, fail-closed
on shape); `columnSummaryNodeFunctions` over every row kind; the alias
collision on a field named `sum_approved`. The mapping-table pin carries
the two new rows and `reads` on every derived row.
- `packages/rest/src/list-view-grouping-query-door.test.ts` §7b — the
real aggregate door, on driver-sql (better-sqlite3) and the in-memory
tier: the compiled grouped query and the footer's whole-set query (no
`groupBy`) answer each unit's and the whole set's true / false / empty
counts, tallied off the seeded rows (every fourth unset); the one-row
unit with no true reads 0.
- `packages/lint/src/validate-list-view-field-refs.test.ts` — refuses
the two members over a number and a text field (object form too),
accepts them on booleans, and agrees with the spec's table over every
`FieldType`.
-
`ui/packages/plugin-grid/src/__tests__/footerCalculationPicker-35702.test.tsx`
— the boolean / toggle offer (the two counts first, no arithmetic);
never on number, currency, text, select, date, lookup; a boolean
column's menu lists Count of Yes / Count of No first, a pick draws `Yes
1` then `No 1`.
- `ui/packages/i18n`: `zh-Hant.ts` regenerated from `zh-Hans.ts`
(`gen:zh-hant`; the first CI run's Test UI 8/16 red was this file
hand-written).
-
`ui/packages/plugin-grid/src/__tests__/footerSummaryScope-12081.test.tsx`
— 300 rows over pages of 25: the yes / no / empty counts read the whole
set off one `SUM` and one `COUNT` node; with no aggregate door they are
the page's, labelled `(this page)`, and an unset cell is neither.
Migrated: the `COLUMN_SUMMARY_AGGREGATION` pin (`reads` on the derived
rows), `view.test.ts`'s member list, the `ui/packages/types` parity list
(two members added). Voided: none.
<details><summary>Local runs</summary>
Head `5107231a` (the last commit is the generated `zh-Hant.ts` only;
every run below is on `1d91bf50` or later unless named):
- `@objectstack/spec`: `vitest run src/ui/view-grouping-query.test.ts
src/ui/view.test.ts` — `Test Files 2 passed (2)`, `Tests 550 passed
(550)`, lock `VERDICT command-exit 0`. `typecheck` (incl.
`check:test-typecheck`) exit 0. `check:api-surface`, `check:docs`,
`check:export-origins` were red before `gen:api-surface` / `gen:schema`
+ `gen:docs` / `gen:export-origins`, green after;
`check:authorable-surface`, `check:liveness`, `check:llms-txt` exit 0.
- `@objectstack/lint`: `validate-list-view-field-refs`,
`validate-sortable-fields`, `rule-explanations` — `Test Files 3 passed
(3)`, `Tests 316 passed (316)`; `typecheck` exit 0.
- `@objectstack/rest`: `list-view-grouping-query-door.test.ts`
(driver-sql better-sqlite3 + in-memory) — `Test Files 1 passed (1)`,
`Tests 55 passed (55)`; `typecheck` exit 0.
- `ui`: `plugin-grid` (`footerCalculationPicker-35702`,
`footerSummaryScope-12081`, `useColumnSummary`,
`useColumnSummary.i18n-4024`, `column-features`) +
`types/spec-subschema-parity` — `Test Files 6 passed (6)`, `Tests 141
passed (141)`; the whole `packages/i18n/` project after the regeneration
— `Test Files 105 passed (105)`, `Tests 1957 passed | 13 skipped`;
`vitest run scripts/` — `Test Files 172 passed | 2 skipped`.
- Derived gate families (`dispatch-gates --commands`, 120 on this tree):
`--ran` reads 118 run, 2 NOT MEASURED, 0 UNRUN. NOT MEASURED:
`check:dual-build-cjs-loads` (PREREQUISITE NOT MET: dists of untouched
packages absent), `check:type-check-debt` (ran past the local 300 s
window). One recorded red is the container, not the diff:
`check:dts-closure` names `packages/cli`, `plugins/organizations` and
`verify` `.d.ts` missing, packages this PR does not touch, built
`OS_SKIP_DTS=1` here for the browser stand. CI's runs are the reading
for all three.
- NOT MEASURED locally: `@object-ui/plugin-grid` / `@object-ui/i18n`
`type-check` (the ui dependency closure's declarations are not built in
this container: every error is TS2307 on an `@object-ui/*` import or
downstream of one, none in the two changed source files); Type Check UI
is the reading.
</details>
## Acceptance notes
- Card acceptance 「布尔列有「是」「否」的条数」: the boolean column's menu offers
both, first; they draw at once, over the whole matched set (the existing
whole-set read) or the page, labelled as the page's.
- Disclosed, not in scope: the record edit form draws an unset boolean
as an unticked box
(`ui/packages/fields/src/widgets/BooleanField.tsx:124,139`), while the
list cell draws it as "No value". Under A an unset value is not counted
as 「否」 even though the form shows it unticked.
- A `count_true` / `count_false` column's whole-set figure waits for the
object's field catalogue, as every `sum` node does (`isMoneyAggregate`:
a `record`-mode currency check, ADR-0144 D6); the page figure shows
until then, labelled as the page's.
- The group header compiler reads no field types, so a hand-written
`count_true` over a number reaching the server unlinted would answer
that column's sum. The lint is the refusal (`os validate`, `os build`,
the save door through the reference-integrity suite), the same tier the
aggregate × field-type pairs are judged at.
## Verification
Browser (showcase, own backend :43744 + console dev :53744 off this
branch, admin), evidence in `/mnt/project-files/build-seat1/35702-pr2/`:
- Field Zoo's list, the Boolean column's footer menu: Count of Yes,
Count of No, then Unique, Filled, Empty, Percent filled, Percent empty,
None (`b-02-boolean-menu.png`). The Number and Rating columns' menus
list Sum / Avg / Min / Max and the counts, the Name and Select columns
the counts only — no Count of Yes / No on any of them.
- On a personal view of Field Zoo (Name, Boolean, Number): pick Count of
Yes → `PATCH /api/v1/data/sys_personal_view/ID` 200 with only
`f_boolean` gaining `summary: "count_true"` → the cell reads "Yes 1"
(`b-12`) → reload → still "Yes 1" (`b-13`) → pick Count of No → PATCH
200, "No 1" (`b-14`). The two seeded rows hold `true` and `false`.
- The runtime's aggregate door on the same stand, `POST
/api/v1/data/showcase_field_zoo/query` with the footer's nodes answers
`{ count: 2, sum_f_boolean: 1, count_f_boolean: 2 }` (Yes 1, No 1).
- The package view `showcase_field_zoo.default`: the pick's draft save
answers 403 and the pick is taken back, PR 1's documented behaviour for
a view a read-only package ships.
- NOT MEASURED in the browser: a null boolean cell (the showcase's Field
Zoo refuses a new row without its required master-detail) and the
whole-set path over more than one page (two rows); both are pinned on
the real door (§7b) and in the 300-row footer suite.
Two-minute check: on any object with a boolean field, open its table
view as an admin, click under the boolean column — the menu starts with
"Count of Yes" / "Count of No"; pick one, the cell reads "Yes N" at
once.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic
beyond the pure mapping helpers that already live there.
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; the repo-wide `pnpm lint` is CI's.
- [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: its generated artifacts are
regenerated and committed.
- [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 with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgVspkxqkUdkYxY1RHf
<!-- signed: repo:objectstack#1 · os-sales ·
session_01L6bhgVspkxqkUdkYxY1RHf -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent e3e202a commit af566c2
30 files changed
Lines changed: 554 additions & 55 deletions
File tree
- .changeset
- content/docs
- references/ui
- ui
- packages
- lint/src
- rest/src
- spec
- api-surface
- export-origins
- src/ui
- ui/packages
- i18n/src/locales
- plugin-grid
- src
- __tests__
- types/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 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
144 | 146 | | |
145 | 147 | | |
146 | 148 | | |
| |||
157 | 159 | | |
158 | 160 | | |
159 | 161 | | |
160 | | - | |
| 162 | + | |
161 | 163 | | |
162 | 164 | | |
163 | 165 | | |
| |||
725 | 727 | | |
726 | 728 | | |
727 | 729 | | |
728 | | - | |
| 730 | + | |
729 | 731 | | |
730 | 732 | | |
731 | 733 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | | - | |
| 231 | + | |
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4283 | 4283 | | |
4284 | 4284 | | |
4285 | 4285 | | |
| 4286 | + | |
| 4287 | + | |
| 4288 | + | |
| 4289 | + | |
| 4290 | + | |
| 4291 | + | |
4286 | 4292 | | |
4287 | 4293 | | |
4288 | 4294 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1593 | 1593 | | |
1594 | 1594 | | |
1595 | 1595 | | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
1596 | 1624 | | |
1597 | 1625 | | |
1598 | 1626 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
375 | 383 | | |
376 | 384 | | |
377 | 385 | | |
| |||
466 | 474 | | |
467 | 475 | | |
468 | 476 | | |
469 | | - | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
470 | 484 | | |
471 | 485 | | |
472 | 486 | | |
| |||
924 | 938 | | |
925 | 939 | | |
926 | 940 | | |
| 941 | + | |
| 942 | + | |
927 | 943 | | |
928 | | - | |
929 | | - | |
| 944 | + | |
930 | 945 | | |
931 | 946 | | |
932 | 947 | | |
933 | 948 | | |
934 | 949 | | |
935 | 950 | | |
936 | 951 | | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
937 | 963 | | |
938 | 964 | | |
939 | 965 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
144 | 146 | | |
145 | 147 | | |
146 | 148 | | |
| |||
154 | 156 | | |
155 | 157 | | |
156 | 158 | | |
| 159 | + | |
| 160 | + | |
157 | 161 | | |
158 | 162 | | |
159 | 163 | | |
| |||
283 | 287 | | |
284 | 288 | | |
285 | 289 | | |
| 290 | + | |
286 | 291 | | |
287 | 292 | | |
288 | 293 | | |
| |||
806 | 811 | | |
807 | 812 | | |
808 | 813 | | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
809 | 856 | | |
810 | 857 | | |
811 | 858 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| |||
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
| 129 | + | |
128 | 130 | | |
129 | 131 | | |
130 | 132 | | |
| |||
556 | 558 | | |
557 | 559 | | |
558 | 560 | | |
| 561 | + | |
559 | 562 | | |
560 | 563 | | |
561 | 564 | | |
| |||
578 | 581 | | |
579 | 582 | | |
580 | 583 | | |
| 584 | + | |
581 | 585 | | |
582 | 586 | | |
583 | 587 | | |
| |||
0 commit comments