Skip to content

service-analytics: refuse at dataset compile a raw measure over a record-mode amount or quantity with no code/unit dimension, and the derived-measure unit twin (ADR-0144 "at build") #36083

Open

Description

@objectstack-fleet

repo:objectstack#7 · os-tesla · session_01L9qibvMi1U7R2kBd3JbTPu

Filing gate: ① a product defect with a named landing, measured · Source: fleet (L1 7062716121 on PR #36060, R2 item 2)

维护者速读

  • 问题:ADR-0144 规定,数据集里对「按行币种金额」不分组直接求和的度量,要在编译数据集时就拒绝(DATASET_INVALID)。现在主干只在每次查询时拒绝,数据集本身能保存、能编译。单位那边(PR feat(objectql,service-analytics): refuse a raw aggregate over a record-mode quantity unless grouped by its unit field #36060)照着币种的实际做法做,也是查询时拒绝。
  • 影响:作者保存一个永远查不出结果的数据集也不会被提示,要到查询时才报错;ADR 和代码说的不一致。另外,把按行单位数量和别的数量相加的「派生度量」,目前没有人检查。
  • 这一步做什么:数据集编译时,对按行币种金额和按行单位数量上的原始聚合度量,如果数据集没有按代码字段或单位字段分组的维度,就拒绝;并给派生度量补上单位版的跨单位检查。
  • 要你做的:可能要你点头。币种一半已经发布,在编译时拒绝会让现在能保存的数据集保存不了(收窄),需要 ADR-0087 的处置说明;单位一半在 unitConfig 发布前合并就不算收窄。

What is wrong (measured)

ADR-0144's dated "At build" note: "a dataset measure at compile, with existing codes (DATASET_INVALID at compile)". On main, the record-currency guards at compile (packages/services/service-analytics/src/measure-currency-coherence.ts) judge a measure's currency key and derived measures across currencies only. A dataset whose measure is an ungrouped sum over a record-mode amount compiles, and the refusal rides each query selection through the cube door (cube-record-currency-door.ts, INVALID_FIELD / 400). Measured by the #35491 dev on a real engine (SqlDriver / better-sqlite3): such a dataset compiles; an ungrouped query answers INVALID_FIELD / 400.

PR #36060 (ADR-0158 U7 R1) mirrors that per-selection shape for record-mode quantities; L1 accepted it as that PR's deviation. So ADR-0144's text and main differ for both families. A derived measure combining a record-mode quantity with another quantity (the unit twin of currency guard 2) is judged nowhere.

reach: the public door: a dataset with such a measure saves and compiles (os validate, metadata save) and then can never serve that measure ungrouped.

Business reason

An author, or an AI writing a metadata app, gets a dataset that saves clean and fails at every query; the refusal belongs where the declaration is written (contract tightening at publish over runtime tolerance).

Ask

  • At dataset compile, refuse DATASET_INVALID a raw measure (sum/avg/min/max) over a record-mode currency amount or record-mode quantity when the dataset declares no dimension over its code or unit field. Keep the per-selection cube refusal.
  • The unit twin of guard 2: a derived measure that adds a record-mode quantity to another quantity of a different or unknown unit.
  • The currency half narrows what compiles today (released): Clause-②: no (narrowing), its ADR-0087 disposition, and the maintainer's approval at landing. The unit half is no narrowing only while unitConfig is unreleased.

Order

After PR #36060 merges. The ADR-0144 / ADR-0158 texts stay as ruled; this card brings code to them.

Grading: area:data · Bug · ADR-ruled behaviour main does not implement.
Suggested grade: p3 (no wrong number reaches anyone: every ungrouped query is already refused; the cost is a late refusal).

Dedupe: repo:objectstack-ai/objectstack is:issue DATASET_INVALID record currency compile (14 hits: #27579, #28019, #28194 fixed-currency guards, closed; #27187 the cube door, closed; #35491), dataset measure record-mode compile (#35046, #27579, #27187, closed) → no card for the compile-time record-mode refusal.

Activity

  1. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibvMi1U7R2kBd3JbTPu

    2026-11-21T12:52Z · Order (L2 N1 on PR #36060, 7062871169): land the unit half before .changeset/35489-unit-config.md ships in a release. Until then the unit compile guard narrows nothing published; once unitConfig ships, it becomes a published narrowing too and needs the same Clause-②: no (narrowing), ADR-0087 disposition and maintainer approval the currency half already needs.

  2. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in domain:server (service-analytics) · pm:queue; rationale: area:data · Bug · ADR-0144 says a raw measure over a record-mode amount with no code dimension is refused at dataset compile, but main refuses only per query, so a dataset that can never answer saves; the unit twin and derived measures are unchecked; measured → p3 as filed · size M. The currency half is a narrowing of a shipped behaviour and needs an ADR-0087 disposition, possibly the maintainer's nod; the unit half is not a narrowing if it lands before unitConfig ships.

  3. added
    domain:server
    pm:queue
    on Nov 21, 2026
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

    area:databugdomain:serverpm:queuepriority:p3

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions