Skip to content

Units of measure R1: refuse at build a raw total over a record-mode quantity unless it groups by the unit field #35491

Description

@objectstack-fleet

repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB

Units of measure, release R1 (ADR-0158 U7). Parent: #35339. The ADR is the governing text: ADR-0158 (merged PR #35370, 35bd360). Filed on seat 5's word, 2026-11-19.

What to build

R1 member "a build-time refusal of a raw aggregate over a record-mode quantity unless it groups by that quantity's unit field". It mirrors ADR-0144 D6 and its currency refusal.

Open items this card carries

Blocked

Blocked-by: #35489

Waits on the unitConfig and membership card, because the refusal reads unitConfig. It does not hang on OI8, since a quantity is always the subject here.

Done when

A dataset or report that sums a record-mode quantity without grouping by its unit field is refused at build with a named code. The grouped form and a fixed-mode quantity pass. ADR-0158 is amended with the raw-aggregate set.

Grade

p2 · area:data · domain:server.


Generated by Claude Code

Activity

  1. added
    priority:p2
    pm:blocked
    domain:server
    on Nov 19, 2026
  2. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    2026-11-20T22:47Z · Unblocked: its only Blocked-by: #35489 is closed. pm:blocked → pm:queue; grade p2 and lane unchanged. (#35490 stays blocked on #35498.)

  3. added
    pm:queue
    and removed
    pm:blocked
    on Nov 20, 2026
  4. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibvMi1U7R2kBd3JbTPu

    Claim: PM loop round 5 · card thread d7-D · 2026-11-21T11:16Z
    Ordered by: seat 7, 11:13Z today: take #35491 on d7-D (the maintainer's word at 11:10Z: keep working the data cards, at most 10 concurrent; no p1 data card is left, so seat 7 dispatches p2s)
    Area: d7-D
    Session: session_01L9qibvMi1U7R2kBd3JbTPu
    Account: os-tesla
    Branch: claude/project-thread-dr6px1, restarted from main (the dev builds on a local branch; the card thread pushes)
    Worktree: objectstack-issue-35491
    Domain: domain:server
    Seat: repo:objectstack#7
    File surface: the unit counterpart of each ADR-0144 D6 door, beside its currency twin: packages/objectql/src/** (the ObjectQL aggregate door beside record-currency-aggregate-door.ts, summary registration in the registry, the roll-up recompute path), packages/services/service-analytics/src/** (the cube measure door beside cube-record-currency-door.ts, dataset compile), tests beside each; scripts/adr-anchors/ (new anchor files only); one new changeset .changeset/35491-*.md. ⛔ No docs/adr/** (the ADR-0158 raw-aggregate line goes on the open weekly ADR revisions card after merge), no skills/**, no ui/**, no packages/spec/src/** unless a stop-and-report says why. Stop on breach and report.
    Container & model: M, mode:subagent, model: default (dispatch-gates --tier: no path-derived mandate), effort: high (four doors and their currency twins to mirror, M card)
    Clause-②: no
    Clause-② basis: the card refuses aggregates over a record-mode quantity. unitConfig has not shipped in any release yet (pending changeset 35489-unit-config.md; packages/spec 18.6.0's CHANGELOG has no unitConfig), so no published accept set narrows. If a release ships unitConfig before this lands, the dev re-declares no (narrowing) / narrowed and the narrowing path applies.
    Metadata-protocol: none (same basis: the refusal applies only to a declaration not yet released)
    Responsibility: n/a — not a defect card (ADR-0158 U7 R1 member)
    Thread-read: 7052502847
    Premise: holds on origin/main 8145424b53: no aggregate door reads unitConfig (only unit-code-backfill.ts, unit-code-membership.ts and the object door do), so a sum over a record-mode quantity of mixed units adds them today.
    Serial constraints cleared: none named; overlap-check.mjs runs on the committed branch before the push.
    Pre-claim lane: area:data seat 7 (#35557)
    Pre-claim deps: #35489 merged (only Blocked-by; unblocked by triage 7052502847)
    Scope-review: exempt — a ruled member (ADR-0158 U7 R1, mirrors ADR-0144 D6)
    Prior rulings read: ADR-0158 U7, L3 (the summary bullet: in R1 a summary over record-mode child quantities is always refused), Open items 3, 9 and 12 (#35469: the backfill half settled 7014013098; the raw-aggregate set is this card's); ADR-0144 D6 and its amendment, Open item 10 (sum, avg, min, max; count reads no amount); the currency doors record-currency-aggregate-door.ts, cube-record-currency-door.ts

  5. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 21, 2026
  6. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibvMi1U7R2kBd3JbTPu
    os-dev-report

    2026-11-21T12:07Z · PR #36060

    {
      "issue": 35491,
      "status": "done",
      "pr": 36060,
      "branch": "claude/project-thread-dr6px1 (pushed by the card thread from the dev's local branch claude/issue-35491-unit-raw-aggregate), head f01bd3db4e8ba25f7bc4e7b011a5e706bce7d4da on origin/main 8145424b53",
      "session": "session_01L9qibvMi1U7R2kBd3JbTPu",
      "premise_still_valid": true,
      "summary": "ADR-0158 U7 R1 built as a mirror of the three ADR-0144 D6 currency doors, each beside its twin: (1) ObjectQL aggregate door record-unit-aggregate-door.ts, INVALID_FIELD/400; (2) summary registration recordUnitSummaryRefusal, INVALID_METADATA/422, every roll-up over a record-mode quantity refused in R1 (ADR-0158 L3), no recompute bypass; (3) analytics cube measure door cube-record-unit-door.ts, INVALID_FIELD/400 at all four call sites. Raw-aggregate set: sum, avg, min, max; count and count_distinct not judged; grouping by the quantity's own unitField admits; fixed-mode and plain number pass. No new wire code. Before (real engine, SqlDriver/better-sqlite3): sum over 10 KGM + 10 LBR = 20, summary stored 20, dataset and inferred cube 20. After: refused at each door; grouped forms KGM 10 / LBR 10; count 2. Dataset compile mirrors currency (refusal rides each query selection). Declaration check at final head: unitConfig in no released CHANGELOG, changeset 35489-unit-config.md pending, so Clause-②: no, Metadata-protocol: none. Changed lines 1043 (+1032/-11, 11 files).",
      "tests": "record-unit-aggregate-door.test.ts 8/8; record-unit-analytics.test.ts 23/23 (both strategies). objectql 625 files / 14223 tests pass; service-analytics 222 files / 5674 pass, 345 skipped. Typecheck and eslint exit 0. Ablation per door (committed first, blob-equal restore): aggregate 2 red, summary 3 red, cube 17 red.",
      "gates": "dispatch-gates --commands: 84 derived; --ran reconciliation 84 run, 0 NOT-MEASURED, 0 UNRUN (check:dual-build-cjs-loads exit 3 before a workspace build, exit 0 after). check-changeset-no-major --event exit 0 (patch). check:adr-anchors exit 0.",
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "0 by the dev; push, pr_create and this report by the card thread",
      "open_questions": [
        {
          "question": "Dataset compile: refuse at compile (DATASET_INVALID) a raw measure over a record-mode quantity when the dataset declares no unit-field dimension?",
          "recommendation": "A: keep the currency mirror (per-query INVALID_FIELD). A compile guard for both families would be its own card. Taken by the card thread: A."
        },
        {
          "question": "Derived measures combining a record-mode quantity with another quantity (currency guard 2's twin)",
          "recommendation": "A: leave to a later card; no ruling covers it. Taken by the card thread: A, noted in the PR's Acceptance notes."
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · the ADR-0158 Open item 12 aggregate-half line goes to the weekly ADR revisions card after merge (set stated in the PR body)",
        "carrier: none · objectql pins for the two engine doors share one file, as their currency twins share record-currency-guards.test.ts"
      ]
    }
  7. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibvMi1U7R2kBd3JbTPu

    Claim amendment: claim 7061790933, the declaration only · 2026-11-21T12:39Z
    Branch: claude/project-thread-dr6px1 (PR #36060)
    Clause-②: yes
    Clause-② basis: widening. AnalyticsServiceConfig is a root type export of @objectstack/service-analytics, and its sourceFieldMeta answer gains the optional key unitField, which AnalyticsServicePlugin relays for a number under unitMode: 'record'. Precedent a35fc66 (homeAmountField on the same answer, Clause-②: yes (widening)). The narrowing basis of the claim still holds: unitConfig is in no released CHANGELOG, so no published accept set narrows. Found by L1 7062716121 (R1).
    Metadata-protocol: none
    Contract review: owed at TIER_DEFAULT (the Clause-②: yes declaration face), run by L1-b on the redeclared head.
    Everything else in the claim stands unchanged.

  8. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibvMi1U7R2kBd3JbTPu

    2026-11-21T12:43Z · Route (seat 7's call): the per-query refusal at the cube door (as currency does on main) ships in PR #36060; the build-time DATASET_INVALID guard for currency and units, plus the derived-measure unit twin, moves to #36083. PR #36060 keeps Fixes #35491. The grid footer's whole-set summary over a record-mode quantity is #36082 (area:ux), to land before unitConfig ships in a release.

  9. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibvMi1U7R2kBd3JbTPu

    Close-out: #35491 shipped in PR #36060 · 2026-11-21T14:23Z

    Merged 2026-11-21 14:18:19Z as c59ee99 (landing record 7063092283 on #36060).

    What changed: sum, avg, min and max over a number with unitConfig: { unitMode: 'record' } are refused unless grouped by the quantity's own unitField, at the ObjectQL aggregate (INVALID_FIELD / 400), at summary registration (INVALID_METADATA / 422; every such roll-up refused in R1 per ADR-0158 L3) and at the analytics cube measure door (INVALID_FIELD / 400, every cube path and the draft preview). count and count_distinct are not judged; a fixed-mode quantity and a plain number pass. No new error code. Measured before: 10 KGM + 10 LBR summed to 20 at every door.

    Declaration: Clause-②: yes (widening) for AnalyticsServiceConfig.sourceFieldMeta's optional unitField (amendment 7062726625); no published accept set narrows while unitConfig is unreleased.

    Reviews: L1 REWORK 7062716121 → delta ACCEPT 7062776145 · L2 at TIER_DEFAULT PASS 7062833476 → delta PASS 7062871169.

    Carried, per route 7062776103: the dataset compile-time half and the derived-measure unit twin → #36083; the grid footer's whole-set summary → #36082 (land before unitConfig ships); the ADR-0158 amendment with the raw-aggregate set → row on #36086, prerequisite now met.

  10. removed
    pm:dispatched
    on Nov 21, 2026
  11. added a commit that references this issue on Nov 22, 2026
    c59ee99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:datadomain:serverpriority:p2

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions