From 527f63ef4d9aaf6aa382592ed64cf02fea908e2f Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 14 Nov 2026 18:08:18 +0000 Subject: [PATCH] docs(skills): parent-path record-currency amounts admit no grouping; data eval for the parent-path currencyField The dashboards rule said a record-currency amount refuses sum/avg/min/max unless grouped by its code field; a master_detail child amount whose currencyField is the parent path admits no grouping on main (the engine's aggregate door and the analytics cube door both refuse it). Say so, point to objectstack-data for the declaration, and name the home field or the parent's summary as the shapes to measure. Paid for by deleting two clauses whose home is the package source. Add the objects-fields-relationships eval case for an invoice whose lines follow its currency. Claude-Session: https://claude.ai/code/session_01FEkQ5kJc3VU2HmGSE78u8t Co-Authored-By: Claude --- ...-skills-parent-currency-path-follow-ups.md | 10 ++++++++++ .../evals/objects-fields-relationships.json | 19 +++++++++++++++++++ skills/objectstack-ui/rules/dashboards.md | 8 ++++---- 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 .changeset/32392-skills-parent-currency-path-follow-ups.md diff --git a/.changeset/32392-skills-parent-currency-path-follow-ups.md b/.changeset/32392-skills-parent-currency-path-follow-ups.md new file mode 100644 index 00000000000..b667566866e --- /dev/null +++ b/.changeset/32392-skills-parent-currency-path-follow-ups.md @@ -0,0 +1,10 @@ +--- +'@objectstack/skills': patch +--- + +docs(skills): the dashboards rule says a parent-path record-currency amount admits no grouping, and the data evals measure the parent-path `currencyField` + +Clause-②: no +Metadata-protocol: none + +`objectstack-ui`'s dashboards rule said a `currencyMode: 'record'` amount refuses `sum` / `avg` / `min` / `max` "unless grouped by its code field". For a `master_detail` child amount whose `currencyField` is the parent path (`'invoice.currency_code'`), no grouping is admitted: the engine's aggregate door refuses it whatever it groups by, and the analytics cube door never matches a dimension to a dotted code field. A dashboard author who grouped by the path was refused. The rule now says so in one parenthesis, points to `objectstack-data` → Field Types → Currency for the declaration, and names the two single-currency shapes to measure instead: the amount's `homeAmount` field or the parent's `summary`. To pay for it, two clauses whose home is the package source are deleted from the same comment: what a result column carries (`AnalyticsResult.fields` in `@objectstack/spec/contracts`) and the "not judged" list of the measure-currency check. `objectstack-data`'s `objects-fields-relationships` evals gain a case for an invoice whose line amounts follow the invoice's currency, with the `lookup` path refused. No schema or runtime change. diff --git a/skills/objectstack-data/evals/objects-fields-relationships.json b/skills/objectstack-data/evals/objects-fields-relationships.json index a5139405206..65461dbb767 100644 --- a/skills/objectstack-data/evals/objects-fields-relationships.json +++ b/skills/objectstack-data/evals/objects-fields-relationships.json @@ -291,6 +291,25 @@ "class: 'telemetry'" ] } + }, + { + "id": 17, + "prompt": "Each `invoice_line` belongs to an `invoice` (deleting the invoice deletes its lines), and the invoice carries `currency_code`. The line's `amount` must always be in its invoice's currency without storing a code on the line, and the invoice shows a subtotal of its lines. A teammate suggests making `invoice` a plain `lookup` instead. How do I declare the amounts?", + "expected_output": "Keep `invoice` a `master_detail` and declare `amount` with `currencyMode: 'record'` and `currencyField: 'invoice.currency_code'`: on a `master_detail` child the code may be one hop to the parent's `iso_4217_currency` field, so the line stores no code. A `lookup` path is refused, so the teammate's change would refuse the amount. The invoice's `subtotal` is a `summary` with `function: 'sum'` over the lines' `amount`, and it must declare its own `currencyMode: 'record'` with `currencyField: 'currency_code'`. A blank invoice code refuses the line's amount (`ERR_CURRENCY_CODE_REQUIRED`), and once a line follows it the invoice's `currency_code` cannot change until none does.", + "files": [], + "assertions": { + "must_contain": [ + "master_detail", + "currencyField: 'invoice.currency_code'", + "iso_4217_currency", + "summary", + "ERR_CURRENCY_CODE_REQUIRED" + ], + "must_not_contain": [ + "currencyMode: 'fixed'", + "Field.lookup('invoice')" + ] + } } ] } diff --git a/skills/objectstack-ui/rules/dashboards.md b/skills/objectstack-ui/rules/dashboards.md index 2b801185e34..da050cc355d 100644 --- a/skills/objectstack-ui/rules/dashboards.md +++ b/skills/objectstack-ui/rules/dashboards.md @@ -304,13 +304,13 @@ defineDataset({ // measure `currency` → the field's `defaultCurrency` (`fixed` only) → // tenant `localization.currency`; omit it for counts. A // `currencyMode: 'record'` amount refuses `currency`, and sum/avg/min/max -// unless grouped by its code field; then the column carries -// `currencyField` (the per-row code column); a `count` never does. A `fixed` +// unless grouped by its code field (a parent-path `currencyField` admits +// none, objectstack-data → Field Types → Currency: measure its `homeAmount` +// field or the parent's `summary`). A `fixed` // field, or a derived sum/difference over one `fixed` code, refuses another // `currency` (delete it, the column takes that code; restating is fine); a // derived measure refuses operands in two `fixed` codes (derive from one -// currency or drop one). Not judged: `currency` over a `dynamic` field, a -// `fixed` code against the tenant's. +// currency or drop one). // The widget just selects the dimension by name: const signedByMonth: DashboardWidget = { id: 'signed_by_month', type: 'line',