feat(analytics): raw-value drill sidecar for totals/subtotal rows (#3214)#3215
Merged
Merged
Conversation
) The ADR-0021 D2 drill metadata snapshots each row's raw grouped values into a parallel `drillRawRows` array before `resolveDimensionLabels` overwrites `row[dim]` with the display label — but the snapshot only covered `result.rows`. The totals/subtotal rows (#1753) carry dimension values too and go through the same label resolution, so a lookup/select subtotal ended up label-only with the stored value lost — a subtotal drill had nothing to exact-match on. Snapshot raw values for totals rows too, in the same pre-label pass: `drillRawTotals` is aligned to `result.totals` by index and restricted to each grouping's drillable dims (the grand-total grouping `[]` yields empty maps). Purely additive result props, same as #2080 — no spec-contract change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vejtto9wLCMUjQ9NFrXqnK
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 6 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
os-zhuang
marked this pull request as ready for review
July 18, 2026 14:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #3214.
ADR-0021 D2 drill metadata snapshots each row's raw grouped values into a parallel
drillRawRowsarray beforeresolveDimensionLabelsoverwritesrow[dim]with the display label — so a report drill filters by the stored value (FK id, select option value). But that snapshot only coveredresult.rows.The totals/subtotal rows added in #1753 also carry dimension values (a row subtotal is keyed by its row bucket) and go through the same label resolution (
analytics-service.ts, thefor (const total of result.totals ?? [])loop). No raw values were captured for them, so a subtotal row ended up in the pre-#1750 state — display label only, stored value lost. A drill from a subtotal (e.g. clicking a "Q2 · Backlog" cell) then couldn't exact-match a lookup/select dimension.Changes
packages/services/service-analytics/src/analytics-service.ts— in the ADR-0021 D2 drill block (the pre-label-resolution pass), also snapshot totals rows into a newdrillRawTotalssidecar:result.totalsby index:drillRawTotals[i]↔result.totals[i],drillRawTotals[i][j]↔result.totals[i].rows[j].[]) contributes an empty map per row (which keeps the index alignment and drills the whole, unfiltered object).packages/services/service-analytics/src/__tests__/query-dataset.test.ts— two new tests:drillRawTotalsacross a subtotal grouping + grand total;minorfor@objectstack/service-analytics).Notes
objectui's
ReportView.handleDatasetDrillconsumesdrillRawRowsfor data rows only and subtotal drill isn't wired up yet, so this gap is latent today — this closes it on the framework side so the raw values are available if/when subtotal drill ships.Verification
vitest runfor@objectstack/service-analytics— 166 passed (14 files), including the 2 new tests.tsc --noEmit— no new type errors introduced (two unrelated pre-existing errors inanalytics-service.test.ts/native-sql-granularity-decline.test.tsare untouched by this change).🤖 Generated with Claude Code
https://claude.ai/code/session_01Vejtto9wLCMUjQ9NFrXqnK
Generated by Claude Code