Skip to content

Analytics: totals/subtotal rows have no raw-value drill sidecar (drillRawRows covers result.rows only) #3214

Description

@os-zhuang

Context

Follow-up from the #1750 re-evaluation (closed as completed).

ADR-0021 D2 drill metadata (#2080) snapshots each row's raw grouped values into a parallel drillRawRows array before resolveDimensionLabels overwrites row[dim] with the display label — so a report drill on a data row filters by the stored value (FK id, select option value).

But the snapshot only covers result.rows. The totals/subtotal rows added in #1753 also carry dimension values (a row subtotal is keyed by its row bucket), and they DO go through label resolution — analytics-service.ts resolves each grouping's subset right after the main rows (see the for (const total of result.totals ?? []) loop) — yet no raw values are captured for them.

Net effect: a subtotal row ends up in exactly the pre-#1750 state — display label only, raw value lost. If a host ever drills from a subtotal row (e.g. clicking the "Q2 · Backlog" subtotal in a matrix report to open its records), a lookup/select dimension can't be exact-match filtered:

  • select — would need the fragile label→value reverse-map again;
  • lookup / master_detail — the label is a record name, not the FK id, so the dimension gets skipped and the drill lands on a superset.

Current state

  • objectui's ReportView.handleDatasetDrill consumes drillRawRows for data rows only; subtotal drill is not wired up today, so this is latent, not user-visible.
  • Blocking nothing; filed so the gap is on record instead of rediscovered.

Proposal

When drill metadata is attached, snapshot raw values for totals rows too — e.g. a parallel drillRawTotals aligned to result.totals[i].rows (same shape as drillRawRows, restricted to each grouping's drillable dims), captured in the same pre-label-resolution pass. Purely additive extra props on the result, same as #2080 (no spec-contract change).

Affected

  • framework: packages/services/service-analytics/src/analytics-service.ts (the ADR-0021 D2 block + the totals label-resolution loop), query-dataset.test.ts
  • objectui (consumer, only if/when subtotal drill ships): ReportView.handleDatasetDrill

Refs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions