You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f4d568b
Browse filesBrowse the repository at this point in the historyBrowse files
fix(plugin-report,plugin-dashboard): report, chart and table drills list the records a filtered measure counted (#30651)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuUdRNQVD3k9LXPSp1pEBp9r)_Fixes#30615
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
改了什么:报表(表格行、小计行、矩阵单元格)和看板(图表、表格、交叉表)的下钻,现在除了点中的分组和组件/报表筛选,还会叠加服务器给的该度量范围(drillScopes),点开列出的就是数字统计的那些记录。
- 为什么改:带条件的度量(如「已付款发票数」)以前点开会列出整个分组的记录,数字是 0 却列出 4 张发票,读者会不再信任看板。
- 风险与回滚:只动 plugin-report 和 plugin-dashboard 的下钻;没有范围条目的度量(派生度量等)和没有
drillScopes 的应答不再给下钻;一行里多个度量范围不一致时改为按单元格下钻。回滚即 revert 本 PR。
- 先看:ui/packages/plugin-dashboard/src/DatasetWidget.tsx 的
openDrill、表格行/单元格和
chartDrillMeasure;ui/packages/plugin-report/src/DatasetReportRenderer.tsx
的 drill / drillCell;两个新的小文件 measureDrill.ts、measureDrillScope.ts。
- 两分钟验证:打开 app-showcase 的 Revenue Pulse (filtered) 看板,在 Paid Rate by
Status 表的 Sent 行点 Paid Invoices(0),抽屉应为空;点同一行的 Invoices(4),应列出 4 张 sent
发票;Paid Rate 单元格不可点。
- 需要你做的:无,席位落地。
## What changes
- **The drill composes three legs, not two.** The list filter is the
clicked bucket AND the widget or report filter AND the answer's
`drillScopes` entry for the measure the click stands for (PR #30596's
sidecar). A `{}` entry hands the widget or report filter back untouched,
so a drill on an unfiltered measure is byte-identical to the drill it
was before.
- **What a click stands for.** A chart mark: its series' measure (a
pivoted chart: its one measure; a mark with no series key: the one
measure a single-series chart draws; a `MEASURE__compare` series:
nothing, it has no entry). A cross-tab or matrix cell: its column's
measure. A table row, a report line or a subtotal line: every measure it
holds.
- **A table row whose measures select different records drills cell by
cell.** When every measure of the row shares one scope, the row drills
as before (`dataset-drill-row`). Otherwise the row is not a drill
target, and each measure cell with an entry is (`dataset-drill-cell`),
drilling that measure's records. This is the case on
`table_rate_by_status`: `invoice_count` (`{}`) beside `paid_count`
(`status = paid`).
- **No list that does not match the number** (the #30080 ruling, comment
6631202970). A measure with no entry (derived, or a scope naming a
relationship path) is not clickable; neither is anything on an answer
that carries an `object` but no `drillScopes`; a chart none of whose
drawn measures has an entry gets no click handler.
- `ui/packages/plugin-dashboard/src/measureDrill.ts` (new, internal):
`sharedMeasureDrillScope` and `scopeDrillFilter`, reading entries with
the merged `readMeasureDrillScope` from `metricDrill.ts` (unchanged).
`ui/packages/plugin-report/src/measureDrillScope.ts` (new, internal):
the same two plus `measureDrillScope`, since plugin-report does not
depend on plugin-dashboard. Neither is exported from a package entry;
`@object-ui/core` is untouched.
- One root changeset: `@object-ui/plugin-report` and
`@object-ui/plugin-dashboard`, patch.
## Why
A dataset number is computed under the dataset's `filter`, the measure's
`filter` and the widget filter. The drills composed only the last one
with the bucket, so a filtered measure drilled to a superset. The server
now states the missing two per measure (PR #30596); the KPI tile reads
them since PR #30634. This PR makes the report, chart, table and
cross-tab drills read them too.
## What the drill does when the answer has no `drillScopes` (the reading
the claim asked for)
- Measured on the server: `queryDataset` sets `drillScopes` on every
dataset answer that has rows (`analytics-service.ts`, the block after
the drill ranges). It is absent on (1) an answer with no rows, where
there is nothing to click; (2) a draft-preview answer, which returns
before `dimensionFields`, `drillRawRows` and `drillRanges` are set, so
the widget's `canDrill` is already false there, and the Studio report
preview passes no `onDrill`; (3) a cube query answer, which these
consumers never request (they call `queryDataset` only).
- So on every answer a current server sends, "no `drillScopes`" never
meets a clickable bucket. The consumers treat a missing map like a
missing entry: no drill (the tile's rule in PR #30634).
- One exception, kept on purpose: a report answer with no `object` (a
server older than ADR-0021 D2) still hands `ReportView` its group-key
fallback drill, unchanged, as `drill: omits objectFilter when the server
returns no drill metadata (older server)` pins.
## Tests
On `f9543126` (the head):
- `pnpm --dir ui exec vitest run --maxWorkers=2
packages/plugin-report/`: Test Files 33 passed (33), Tests 313 passed, 7
skipped. VERDICT command-exit 0.
- `pnpm --dir ui exec vitest run --maxWorkers=2
packages/plugin-dashboard/`: Test Files 203 passed (203), Tests 1957
passed, 6 skipped. VERDICT command-exit 0.
- `pnpm --filter @object-ui/plugin-report --filter
@object-ui/plugin-dashboard run type-check` (`tsc --noEmit` and `tsc -p
tsconfig.test.json` each): VERDICT command-exit 0.
- New pins, each a top-level `describe` in a shared harness:
- `plugin-report/src/__tests__/DatasetReportRenderer.test.tsx`, "measure
drill scopes (#30615)": a filtered measure cell carries its scope; a
`{}` cell carries bucket and report scope only; a derived measure offers
no drill; an answer with an object and no `drillScopes` offers no drill;
a line of one filtered measure drills as a line with its scope; a matrix
cell carries its measure's scope and a no-entry measure's cell is not
clickable.
- `plugin-dashboard/src/__tests__/DatasetWidget.test.tsx`, "table drill
— measure drill scopes (#30615)": the same five table cases plus the
cross-tab cell, asserting the `$filter` the drawer's list sends.
-
`plugin-dashboard/src/__tests__/DatasetWidget.chartBucketIdentity.test.tsx`,
"chart drill — measure drill scopes (#30615)": a filtered series bar, a
`{}` series bar, a no-entry series (opens nothing) and an answer with no
`drillScopes` (no click handler).
- Existing drill fixtures gained a `drillScopes` entry of `{}` for their
measures (17 test files), which is what a current server answers for a
plain measure; their assertions are unchanged.
<details><summary>Ablations (two, one per package, on the scope
leg)</summary>
Both through `node scripts/ablation-replace.mjs` under the verify lock,
replacing ` return composeDrillFilter(runtimeFilter, scope);` with `
return runtimeFilter;` (anchor 1 to 0 each), restored to the HEAD blob
with `git diff HEAD` empty. ui vitest resolves `@object-ui/*` to source,
so there is no dist leg.
- `plugin-dashboard/src/measureDrill.ts` (blob db75569 to
902425afed01, re-run on `f9543126`): Tests 4 failed, 74 passed over
`DatasetWidget.test.tsx` and
`DatasetWidget.chartBucketIdentity.test.tsx`: the filtered bar, the
filtered table cell, the one-scope row, the cross-tab cell.
- `plugin-report/src/measureDrillScope.ts` (blob 3ada35c to
e47abefae51b): Tests 3 failed, 48 passed over
`DatasetReportRenderer.test.tsx`: the filtered cell, the one-scope line,
the matrix cell.
</details>
## Acceptance notes
- **The drawer's "Open in list" escape hatch still widens a
filtered-measure drill (not fixed here, outside the file surface).**
Measured live on the same cell after this change: the drawer lists 0
records, and "Open in list" navigates to
`showcase_invoice/data?filter[issued_on][gte]=2026-08-07&filter[issued_on][lte]=2026-11-05&filter[status]=sent`,
which lists the 4 sent invoices. `serializeDrillFilterParams`
(`ui/packages/app-shell/src/views/drillUrlFilters.ts`) writes one URL
param per field with `params.set`, so the scope's `status = paid` is
overwritten by the bucket's `status = sent`, and a list comparand
(`$in`, `$nin`) is skipped. Reported to the seat for a card.
- `ReportView`'s group-key fallback is now reached only for a report
answer with no `object`; it is unchanged.
- The two small helpers are deliberately package-local copies: a shared
one belongs in `@object-ui/core`, which this claim keeps read only.
- `drillRawTotals` is not passed through `@object-ui/data-objectstack`:
no totals row or total cell drills on any of these surfaces, so nothing
reads it.
## Verification
<details><summary>Live: app-showcase Revenue Pulse (filtered), table
"Paid Rate by Status", en-US, 1440 wide</summary>
`objectstack dev --fresh --seed-admin` app-showcase plus the Console
vite dev server. The answer's `drillScopes`: `{ invoice_count: {},
paid_count: { status: 'paid' } }`, no `paid_rate` entry. Rows: Paid
(Invoices 3, Paid Invoices 3, Paid Rate 100.0%), Sent (4, 0, 0.0%). The
seed has no `open` status; the Sent row is the card's case.
Before (`14c67d44`, main with PR #30634): both rows carry
`dataset-drill-row`. Every cell of the Sent row opens the same list,
`issued_on` window AND `status = sent`: 4 records, all `sent`, including
under Paid Invoices (number 0) and Paid Rate.
After (`ca694112`; the one later commit `f9543126` only drops a
duplicate type alias): no row carries `dataset-drill-row`; Invoices and
Paid Invoices cells carry `dataset-drill-cell`, Paid Rate cells none.
- Sent / Paid Invoices (0): list filter window AND `status = paid` AND
`status = sent`: 0 records.
- Sent / Invoices (4), the unfiltered control: window AND `status =
sent`: 4 records, all `sent`.
- Paid / Paid Invoices (3): 3 records, all `paid`. Paid / Invoices (3):
3 records.
- Paid Rate (derived): no drawer opens.
</details>
<details><summary>Gates on f954312</summary>
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 35 families on `f9543126` (the same
list as on `ca694112`). Each ran with its exit code captured before any
pipe; all 35 exit 0. `--ran` reconciliation: 35 derived, 35 run, 0
NOT-MEASURED, 0 UNRUN. Also `pnpm --dir ui run check:spec-symbols`: exit
0.
The first pass, on `ca694112`, was red on one family: `pnpm --dir ui
exec vitest run scripts/` failed
`one-authority-per-exported-name-6273.test.ts`, because both new helpers
declared a type named `MeasureDrillScope`. `f9543126` removes the
dashboard's alias (plugin-report keeps the name); the family re-ran
green there (Test Files 170 passed, 2 skipped; Tests 4970 passed), and
the 34 other families re-ran on `f9543126` too.
Families CI runs are read from this PR's check-runs.
</details>
Branch: `claude/project-thread-8u6mg4` is the card thread's
platform-assigned branch (claim 6667494492, amendment 6667568430), not
the `claude/issue-30615-*` convention.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes.
- [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_01L6bhgUBrAU6n2ZJWk6VmTV
---------
Co-authored-by: Claude <noreply@anthropic.com>
fix(plugin-report,plugin-dashboard): a report, chart, table or cross-tab drill on a filtered measure lists the records the number counted
7
+
8
+
Clause-②: no
9
+
Metadata-protocol: none
10
+
11
+
A drill used to list the clicked bucket AND the report or widget filter only. The number also carries the dataset's own `filter` and the measure's own `filter`, so a drill on a filtered measure listed a superset: on the app-showcase Revenue Pulse dashboard, the Paid Invoices cell of the Sent row reads 0 and its drill listed all 4 sent invoices. The drill now also ANDs in the answer's `drillScopes` entry for the measure it stands for (the server's per-measure list filter; `{}` adds nothing, so a drill on an unfiltered measure is unchanged).
12
+
13
+
-**What a click stands for.** A chart mark stands for its series' measure (a pivoted chart for its one measure), a cross-tab or matrix cell for its column's measure, and a table row for every measure it holds.
14
+
-**A table row whose measures select different records drills cell by cell.** When the row's measures all share one scope (one measure, or several plain ones), the row drills as before. Otherwise each measure cell with a scope is its own drill target (test id `dataset-drill-cell`) and the row is not.
15
+
-**No list that does not match the number.** A measure with no `drillScopes` entry (a derived measure, or a scope naming a relationship path) offers no drill, and neither does any measure of an answer that carries no `drillScopes`. A comparison (`<measure>__compare`) series opens nothing. A chart none of whose drawn measures has an entry gets no click handler.
16
+
-**Unchanged:** a report answer with no `object` (a server older than ADR-0021 D2) still hands the host its group-key fallback drill.
0 commit comments