Skip to content

A recompute verb: the cube refuses to sum a measure that does not compose from members #41

Description

@phas02

What it buys

The cube totals a metric across dimension members with the verb it resolves for the grounding: sum for a flow, last per window for a stock, sum(num)/sum(den) for a ratio that serves its halves (crates/session/src/cube.rs:744-758, Fact::behavior_basis saying which). A distinct count, a median, a percentile composes from no member — distinct entities per member do not add up to distinct entities — and nothing in the record marks a served value as one of those. The default flow verb sums it: every member is right and the total is wrong, and metric_axes() reports behavior_basis: default as if nothing were at stake. The skills can only say "serve it without dimension columns" (skills/glossql-metrics/references/read-sql.md, ground.md — "A distinct count is the same class without halves"). A declared recompute verb lets the cube refuse the wrong total instead of computing it.

What stands

  • crates/session/src/cube.rs:744-758 — the verb resolution: ratio, marked, glossed, evidence, default; total_sql (:1675) is the aggregation that sums.
  • crates/glossary/src/schemas.rs:14 — the standard grounding schema's behavior enum: stock, flow; SPEC.md §5.2 (:275) is its bullet.
  • crates/scripts/functions/kpi_kit.glossql:43-45 — the kit's behavior aspect: stock, flow, none.
  • The marker's spelling is language — the grounding schema's enum and the kit's — and settles in SPEC.md §9, not here; this issue carries the machine half. The marker is declared: nothing reads count(DISTINCT out of the SQL (the standing no-text-matching rule).

Done when

  • A grounding carrying the recompute verb (spelling per the SPEC ruling) serves cells at the grounding's own scope only: the headline from a frame without dimension columns, members from a frame with them. The cube refuses the member total instead of summing it, the fact row's reason and behavior_basis saying so; the write's answer discloses the same.
  • The bands walk reads the same verb and walks the headline only.
  • Session suite covers a distinct count served with dimensions (members served, total refused) and without (headline served).
  • The metrics skill teaches the marker once the server accepts it, gated by the skills suite.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GcwygHDAJ9utNMHW7p7YrK

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ruling-candidateNeeds a project-lead ruling before code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions