… query, rows paged per group (objectui#7189) (objectstack-ai#10878)
Fixes objectstack-ai#7189
Clause-②: yes — measured on this branch, where the claim reads `no`. No
metadata or schema key moves (`GroupingConfig` is unchanged), but
published TypeScript surface does: `DataSource` in `@object-ui/types`
gains the optional member `queryGroupHeaders`, `ObjectStackAdapter`
implements it, and `@object-ui/plugin-grid`'s exported `GroupEntry` (new
`count`, `keyValues`), `AggregationResult.value` (now `number | null`)
and `useGroupedData` (optional fifth argument) change shape. The seat
corrects the claim line.
## What this does
Maintainer ruling A on this card: grouping on a list view is
server-side. The set of groups and every number in a group header are
properties of the query, not of the fetched page; rows inside a group
are paged. This PR is the objectui half, on top of the spec half
(objectstack#14556) and the platform half (objectstack#15330).
- **Transport (`@object-ui/types`, `@object-ui/data-objectstack`).**
`DataSource.queryGroupHeaders(resource, query)` answers the header query
`compileListViewGroupQuery` compiles. Presence is the capability. The
ObjectStack adapter posts it verbatim to the existing `POST
/data/:object/query` door and answers its `records`; it never degrades
(a refusal throws with the server's code and status; a body without
`records` is refused, not read as zero groups). The adapter already had
an undeclared spec-shape branch on `aggregate()`; it was not reused
because `AggregateParams` does not declare that shape and the other
adapters would answer it with garbage, so a new optional member is the
smallest honest addition.
- **Grid (`@object-ui/plugin-grid`).** A grouped grid that fetches its
own rows from such a source no longer fetches a flat window. It asks one
compiled header query per grouping level (outer headers are their own
level's numbers; `avg` / `count_distinct` do not fold) and pages each
open group's rows with that group's compiled row query
(`compileListViewGroupRowsQuery`: view filter AND group key, `limit` /
`offset` per group). Each group larger than the page gets its own pager.
A collapsed group costs no row query. `aggregations` ride the header
query (mapped onto the spec's column summaries and read back with
`deriveColumnSummary`). A reference-typed grouping key (a raw id on the
wire) is labelled from the referenced record. The view filter is lowered
once to a `FilterCondition` (`parseFilterAST`) and handed to both
compilers, so header numbers and rows answer the same question; a filter
that does not lower is refused, never dropped. Grouping keys the
principal may not read are not sent as keys.
- **`useServerPagination`.** The grouped exclusion goes for a
server-grouped grid: its rows are paged by the server (per group) and
its sort is the server's.
- **`useGroupedData`.** With the server's header rows it builds the
group tree from them and never buckets `data`. Without them it still
groups rows the grid holds.
- **`Partial` marker.** Retired where counts are server-true: a
server-grouped grid never renders it. See the open question below for
the one shape that still reaches it.
- **ListView (`@object-ui/plugin-list`).** The console mounts the grid
through `ListView`, which fetched one window and handed it down as
`data`, so the grid could only group a page (and the objectstack-ai#7226 marker never
fired on that path, because no total was handed down for grouped grids).
When the data source can answer the header query, `ListView` now hands a
grouped grid NO rows, passes it the effective filter (authored + toolbar
+ chips, the same value the self-querying views get), and draws no
record-count bar over it. While a toolbar search is active it keeps
hosting the window as before (see the out-of-scope finding: the
aggregate door drops `search`). This is outside the claim's named file
surface; it is where the page-scoped rows actually came from in the
console.
## Step zero, measured before any grid code (G0)
The installed `@objectstack/spec` 17.4.0 (read from this worktree's
`node_modules`) compiled the header query for the 186-row, five-unit
fixture, posted through objectstack's real `RestServer` route over
`ObjectStackProtocolImplementation` + `ObjectQL` + in-memory SQLite,
from a throwaway objectstack worktree at `origin/main` `d3958bac`
(removed afterwards):
- header query
`{"groupBy":["business_unit"],"aggregations":[{"function":"count","alias":"count"},...]}`
answered five rows 86 / 61 / 31 / 7 / 1 in both the contiguous and the
interleaved object, `total: 5`;
- the compiled row query for the 86-row group paged 50 + 36 (`total: 86`
on both pages), 86 distinct ids;
- control on the same door: grouping the first 100 stored rows gives 86
/ 14 (contiguous) and 31 / 31 / 30 / 7 / 1 (interleaved).
Then end to end with this branch's BUILT adapter and the installed
`@objectstack/client`, wired by a fetch shim into the same real routes:
`queryGroupHeaders` answered 86 / 61 / 31 / 7 / 1, and paging every
group through `adapter.find` with the compiled row query reached all 186
rows (86 as 50 + 36). The empty group (nine rows with a NULL key) was
reached through the `is_null` predicate, and a `status = done` view
filter moved header numbers and rows together (28 / 20 / 10 / 2, one
unit gone).
## Pins
- `packages/plugin-grid/src/__tests__/serverGrouping-7189.test.tsx`
(11): five headers 86 / 61 / 31 / 7 / 1 and no marker in both row
orders; the header query equals the spec compiler's output and no flat
window is fetched; the 86-row group shows 86 rows under a 100-row
window; under a 50-row window it pages 50 then 36 (union 86); all 186
rows reachable through the group pagers; a per-group `sum` is the
query's; a collapsed group costs no row query; two-level headers come
from one query per depth; a lookup key is labelled from the referenced
record; CONTROL: a source without the header query still renders 86 / 14
with the marker.
- `packages/data-objectstack/src/queryGroupHeaders-7189.test.ts` (4):
verbatim body to the door, records answered, refusal without `records`,
no fallback on a 400.
-
`packages/plugin-list/src/__tests__/ListView.groupedGridOwnsFetch-7189.test.tsx`
(4): grouped grid gets no rows and the effective filter, no record-count
bar; controls for a source without the header query and for an ungrouped
grid.
- `groupedPartialDisclosure-7189.test.tsx` is NOT retired: its data
sources declare no `queryGroupHeaders`, so it now pins the fallback
(header updated to say so). `groupedPagination.test.tsx` needed no
rewrite (inline rows).
**Ablation** (prediction written before the run): forcing
`serverGroupedFetch` to false in `ObjectGrid.tsx` turned
`serverGrouping-7189.test.tsx` to exactly `Tests 10 failed | 1 passed
(11)` as predicted, the one pass being the control. Mutation landed on
disk through `ablation-replace.mjs` (anchor 1 to 0, blob `957bad075ca7`
to `6324d33743e9`), restored and proven by blob equal to HEAD and empty
`git diff HEAD`. No build stands between edit and run: the test imports
`../ObjectGrid` and the root vitest config aliases
`@object-ui/plugin-grid` to `src`. A first attempt was refused by the
tool before running (the replacement contained the anchor), so it
measured nothing.
## Tests and gates, at `8427ae3`
- `turbo run build type-check` for types, data-objectstack, plugin-grid,
plugin-list: `Tasks: 20 successful, 20 total`. The new test files are
inside the type-check programs (`--listFiles`, one hit each).
- `vitest run packages/plugin-grid/`: `Test Files 164 passed (164)`,
`Tests 1536 passed (1536)`.
- `vitest run packages/plugin-list/ packages/data-objectstack/
packages/types/`: `Test Files 432 passed (432)`, `Tests 7594 passed
(7594)`.
- Gates, each exit 0 with its own verdict line: changeset-no-major,
changeset-presence (11 source files of 4 released packages, 1
changeset), changeset-overwrite, changeset-claims (report-only),
control-bytes, new-line-citations (0 new), doc-component-types,
prompt-component-keys, doc-fences, doc-example-ids, doc-links,
vi-mock-specifiers, vi-mock-inherit, vi-mock-override-shape,
test-path-roots, pending-changeset-literals, lockfile-integrity (base
`fab627f`, clean), lockfile-dedupe.
- `check:spec-floors`: zero findings against the four touched packages
(all built); it exits 1 only on `no-artifact` for ten untouched packages
not built locally. CI builds them.
- ESLint, narrowed and declared: the 11 changed `.ts` / `.tsx` files
(count from `--format json`), 0 errors; `eslint.config.js` sets no
`parserOptions.project`, so type-aware linting is off and this diff
cannot move a verdict in an untouched file. The repo-wide run is CI's.
- NOT MEASURED: `check:readme-exports`, `check:doc-snippets`,
`check:published-dist`, `check:node-esm-load` (each needs the whole
workspace built; this diff adds no package export and no fenced block to
any document). A live browser run of the console against a running
backend was not made; the in-process route probe above stands in for it.
## Semver
`minor` on types, data-objectstack, plugin-grid and plugin-list (fixed
group, no `major` per this repo's policy); the breaking semantics are
stated in the changeset. The floors of plugin-grid and data-objectstack
move to `@objectstack/spec` `^17.4.0`, the first release carrying the
compilers. The pending
`.changeset/7189-grouped-grid-partial-disclosure.md` carries two
sentences this makes false: "That is a correct implementation of
client-side grouping and is **unchanged** here" and "Server-side
grouping — the durable fix — is deliberately NOT part of this ...
nothing here builds toward it or changes the fetch." Following this
repo's precedent for a pending changeset a later change makes false,
both halves are done: the new changeset says it supersedes that
paragraph, and a dated note (2026-09-28, naming objectui#7189 and this
PR) is appended at the end of
`.changeset/7189-grouped-grid-partial-disclosure.md` correcting those
sentences and the one before them (that `useGroupedData` buckets the
rows the browser already holds). The existing paragraphs and the
frontmatter are byte-identical; `check-changeset-overwrite` reports the
edit as a touched pre-existing changeset declaring the same packages, a
deliberate correction.
## Open question for the seat
A data source that declares no `queryGroupHeaders` (the generic
`ApiDataSource`, `ValueDataSource`, any host adapter) cannot give
server-true counts. This PR keeps its old behaviour, grouping the
fetched page, and keeps the `Partial` marker there because only there
are the counts page slices, so the `grid.grouping.partial*` i18n rows
are retained, not retired. The alternative is to refuse grouping loudly
on such a source. Recommendation: keep, as done here. It is honest, it
adds no code, and a refusal would break every grouped grid on a custom
adapter with no server able to do better.
## Acceptance notes
- Out of scope, measured: `POST /data/:object/query` with `groupBy` +
`aggregations` + `search` answers the same five full-count groups as
without `search`, while the same `search` on a flat query narrows to one
row. The aggregate branch of `findData` composes `where` / `groupBy` /
`aggregations` / `having` only, so the search is dropped silently. That
is why `ListView` keeps hosting a searched grouped grid. Reported for
filing in objectstack.
- `ListView` still issues its own window fetch for a grouped grid it
hands over (it feeds the filter chips' option counts and the client
export), so a grouped console view makes one extra request.
Written by the dispatched `os-dev` agent, session
`https://claude.ai/code/session_01MCg3z5cGrV51xEddpGcxEY`.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01MCg3z5cGrV51xEddpGcxEY)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
Part of #7189 — the disclosure half only.
A grouped grid now states, where the group counts are, that it grouped a page.
The card's numbers were stale, so here is today's
mainobjectui#7179 landed as
a6d8b8d44after the card was written, and it changedwhat the card measures: the projection now carries the grouping field, so the
groups resolve and the
(empty)collapse is gone. The card's table (fourgroups for five units, 33 / 3 / 46 / 18) cannot be reproduced and nothing
here was built against it.
Re-measured on
a6d8b8d44— 186 records over five business units sized86 / 61 / 31 / 7 / 1,
$top: 100,$selectconfirmed to carrybusiness_unit:In both, the document contained no
186, no "partial", no "loaded". Whichshape you see is a property of row ordering, not of the tree — the defect is
the same one either way, and the disclosure has to be true of both.
The paging footer the card quotes is not the grid's:
Showing first N records. More data may be available.lives inpackages/plugin-list/src/ListView.tsx(list.dataLimitReached), a differentcomponent in a different package. A standalone grouped grid renders no footer
at all.
What this adds
useGroupedData's grouping and aggregation algorithm is untouched — it iscorrect for what it does, and the counts above are still page slices
afterwards. What was missing is any statement that client-side grouping is
what you are looking at.
Partialmarker beside every group count, at every nestingdepth, carrying the whole sentence as its
titleand its accessible name;than in the paging footer, which is not a statement about what was grouped.
Is a result-set total reachable where the group headers render? Yes
resolvedTotalMatching(ObjectGrid.tsx:3769) is in scope at the grouped rendersite (~4688 / ~4755), and it is the same ONE derived value the pager and both
bulk-bar sites already read — deliberately not re-spelled here, per the note
objectui#4464 left on it. It resolves from the grid's own
result.totalwhenthe grid owns the fetch, and from a host's
rowCountwhen a host does. Bothpaths are pinned.
So the strong wording is supported, and the trigger never outruns what the
component knows:
plugin-list's own footer draws when no total is knownThat last row is the point of the whole thing: a marker that is always on says
nothing.
Deliberately NOT here
Server-side grouping. It is the card's own preferred durable fix, an
API-surface decision open on #5560, and out of scope for this branch: nothing
builds toward it, no flag anticipates it, the fetch is unchanged. That half of
#7189 stays open.
No metadata contract was widened
No schema key was added — the condition is derived from data the grid already
holds.
GroupRow(exported from this package) gains two optional props,partialLabelandpartialTitle;@objectstack/specis untouched.Tests — 13 new pins, and an ablation in both directions
packages/plugin-grid/src/__tests__/groupedPartialDisclosure-7189.test.tsx.Prediction was written before either leg ran and both matched exactly.
groupingIsPartial = false(disclosure removed)groupingIsPartial = isGrouped(marker unconditional)Leg B goes red on the controls only — fits-in-one-page, inline rows,
short window — which is what makes the eight positive pins worth anything.
Each leg: mutation proved on disk by injected-marker line count (1) and
removed-expression line count (0) and a blob hash moved off
HEAD:packages/plugin-grid/src/ObjectGrid.tsx(
eaab121121273aea4e6304d96d82f6fa0da6b06d); restore bygit checkout HEAD -- ABSOLUTE_PATHand proved by state —git diff HEAD,git diff --cachedandgit status --shortall empty and the blob hash backto HEAD's — with the restore trapped on
EXIT INT TERM. No rebuild was neededor performed:
vitest.config.mts:288aliases@object-ui/plugin-gridtopackages/plugin-grid/src, verified by reading the alias table.jsdom caveat, closed rather than assumed. jsdom applies CSS media-query
rules irrespective of
innerWidth, so a width-dependent reading in it is not ameasurement. This disclosure is not width-dependent: it carries no responsive
visibility utility, and grouping never reaches the width-driven branch —
if (useCardView && data.length > 0 && !isGrouped). The last pin assertsthat gate in source rather than trusting the reading.
Verification, all at
1d8fd9e65(the final commit)pnpm exec vitest run packages/i18n/ packages/plugin-grid/— 166 files,1912 tests, all passed. Includes
all-locales-key-parity, which owns theten-pack key sets the three new
grid.grouping.*strings had to satisfy.turbo run type-check --filter @object-ui/plugin-grid --filter @object-ui/i18n— 15/15 tasks.tsc -p tsconfig.test.json --listFilesconfirms the new test file and both edited sources are in that program, so
"typecheck clean" actually covers them.
@object-ui/plugin-grid(namedexplicitly, because the
...prefix means opposite things in pnpm andturbo): app-shell, console, plugin-designer, plugin-report, plugin-view,
plugin-list —
turbo run type-check, 41/41 tasks.check:i18n-keys,check:i18n-drift(0 en values changed, 3 keys added),check:control-bytes,check:doc-types,check:doc-fences,check:changeset-presence— all exit 0 at1d8fd9e65..ts/.tsxfiles: 0 errors; thenew test file is 0 errors / 0 warnings. Type-aware linting is not enabled in
eslint.config.js(noparserOptions.project), so this diff cannot move averdict in a file it did not touch — the narrowing is a measurement, not a
skip. The repo-wide scan is CI's.
check:doc-snippetsandcheck:readme-exports. Both exit on an explicit precondition — 21packages unbuilt in a fresh worktree — and both judge only fenced code
blocks. This diff adds zero fenced blocks to any document (measured:
zero added lines carrying a fence). CI builds and runs them.
Changeset
@object-ui/plugin-gridand@object-ui/i18n, bothminor. The docs editsride along in the same PR, so no separate empty-frontmatter changeset is owed —
that form is for a docs-only change, where a
patchwould falsely claim areleased package moved.
Generated by Claude Code