Skip to content

Commit 1276434

Browse files
committed
chore(changeset): record-currency analytics — spec and service-analytics minor, the two compile guards declared breaking with their ADR-0087 disposition
Claude-Session: https://claude.ai/code/session_01Utp6Ca8jzC2P7EAQvqjNBb Co-authored-by: Claude <noreply@anthropic.com>
1 parent aff056f commit 1276434

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
'@objectstack/spec': minor
3+
'@objectstack/service-analytics': minor
4+
---
5+
6+
feat(spec,service-analytics): analytics over a record-currency amount — grouped answers name a per-row currency, an ungrouped amount aggregate is refused, and two compile-time measure-currency guards (ADR-0144 D2, D6)
7+
8+
Clause-②: yes (widening)
9+
Metadata-protocol: added
10+
11+
A measure column over a `currencyMode: 'record'` amount now carries `fields[].currencyField` on a `queryDataset` answer: the name of the dimension column that groups by the amount's code field. Each row's currency is that row's value of it, and the column carries no `currency`. Before, a breakdown by currency labelled every group with one code.
12+
13+
- `AnalyticsResult.fields[].currencyField` (`@objectstack/spec/contracts`) and the same key on `AnalyticsResultResponseSchema` (`@objectstack/spec/api`).
14+
- The cube door refuses a `sum`, `avg`, `min` or `max` over a record-mode amount whose query does not group by the code field, with `INVALID_FIELD` / 400 naming the measure, the field and its object. A `totals` grouping that drops the code, the grand total included, is refused the same way. `count` reads no amount and is served.
15+
16+
**BREAKING** (`@objectstack/service-analytics`): two compile-time refusals, `DATASET_INVALID` / 400, for dataset metadata that compiled before and printed a wrong label or a wrong number.
17+
18+
- A measure `currency` that contradicts its field: a code other than the `fixed` field's own, or any code over a record-mode amount. The column printed the field's amounts under the measure's code. A code equal to the `fixed` field's is still accepted, and a measure `currency` over a `dynamic` field is not judged.
19+
- A derived measure whose monetary operands are in currencies that provably differ (two different codes, or a record-mode amount against anything but itself), for every op. The derived value combined bare numbers in two currencies and carried no currency at all. A count operand is not compared, so a revenue-per-deal ratio still compiles.
20+
21+
Each refusal names the measure and says what to delete or change. No in-tree dataset declares either shape.
22+
23+
<!-- adr-0087: not-required (no-migration-prescription) the two refusals reject a contradiction in a dataset's own measures at compile and name the fix in their message; there is no stored shape to convert and no key is removed -->
24+
25+
⛔ Not released alone: this ships in the same release as the record currency mode, its write refusals and the per-row display.

0 commit comments

Comments
 (0)