You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e2c5077
Browse filesBrowse the repository at this point in the historyBrowse files
fix(spec,objectql): word the currency scale refusal's remedy as ruled
The refusal of `scale` on a `currency` field, its ADR-0087 semantic entry
`field-currency-scale-refused`, the `scale` describe, the changeset and the
validator's comments now prescribe one thing: delete the key. A currency's
decimal places are the currency's: its ISO 4217 minor unit decides its
display, and its write allowance stays unconstrained (today's contract). No
other key is named as a place to move the value.
What is refused and what is accepted do not change. The spec pins now hold
the ruled wording on the message (first sentence, both ruled clauses) and
the absence of any other key, beside the firing and dark controls. The
registry is regenerated with gen:migration-registry.
Claude-Session: https://claude.ai/code/session_013RDBh5DqXd2xnLwvHLgLFr
Co-authored-by: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .changeset/19629-currency-scale-retired.md
+7-8Lines changed: 7 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,26 +9,25 @@ Clause-②: no (narrowing)
9
9
10
10
**BREAKING** — an accept-set narrowing on a published authoring surface, shipped as `minor` under the repo's launch-window convention for accept-set narrowings. A `currency` field that declares `scale` — any value, `scale: 0` included — no longer parses. The hand-migration prescription is registered under protocol major 18 as `field-currency-scale-refused`.
11
11
12
-
On a currency field the key was three-faced. The metadata-admin field designer offered it as stored metadata; the amount's cell never read it, because a currency amount's fraction digits come from its currency's own ISO 4217 minor unit; and the record validator's `max_scale` branch still refused writes carrying more decimals. An author who set `scale: 3` bought a narrower write contract and no visible change. The maintainer's ruling retires the key from the type rather than aligning the money faces to it.
12
+
A currency's decimal places are the currency's, not a setting. On a currency field the key was three-faced. The metadata-admin field designer offered it as stored metadata; the amount's cell never read it, because a currency amount's fraction digits come from its currency's own ISO 4217 minor unit; and the record validator's `max_scale` branch still refused writes carrying more decimals. An author who set `scale: 3` bought a narrower write contract and no visible change. The maintainer's rulings retire the key from the type rather than aligning the money faces to it.
13
13
14
-
**`@objectstack/spec`** — `FieldSchema` refuses `scale` on `type: 'currency'` with a located issue at `scale` whose remedy names `currencyConfig.precision`. No alias and no grace window. `scale` on `number`, `percent`, `rating`, `slider` and `formula` is untouched, and the key's describe now names that set.
14
+
**`@objectstack/spec`** — `FieldSchema` refuses `scale` on `type: 'currency'` with a located issue at `scale`. Its remedy: delete the key; the currency's ISO 4217 minor unit decides how the amount displays, and the field's write allowance stays unconstrained. The remedy names no other key to carry the value. No alias and no grace window. `scale` on `number`, `percent`, `rating`, `slider` and `formula` is untouched, and the key's describe now names that set.
15
15
16
-
**`@objectstack/objectql`** — the record validator's `max_scale` branch no longer reads `scale` for `currency`, so the type leaves the enforced set. A field definition that reaches the validator without passing `FieldSchema` (stored before this release, or built by hand at runtime) therefore narrows nothing either. `min`, `max` and the finite-number check still apply to `currency`, and `number` / `percent` / `rating` / `slider` still refuse over-scale writes exactly as before. A currency write with more decimals than a former `scale` is now ACCEPTED. Enforcing `currencyConfig.precision` on writes instead was offered to the maintainer and not taken.
16
+
**`@objectstack/objectql`** — the record validator's `max_scale` branch no longer reads `scale` for `currency`, so the type leaves the enforced set. A field definition that reaches the validator without passing `FieldSchema` (stored before this release, or built by hand at runtime) therefore narrows nothing either. `min`, `max` and the finite-number check still apply to `currency`, and `number` / `percent` / `rating` / `slider` still refuse over-scale writes exactly as before. A currency write with more decimals than a former `scale` is now ACCEPTED: the write allowance stays unconstrained, the contract every currency field without `scale` already had. Enforcing a currency width on writes instead was offered to the maintainer and not taken.
Delete the key by default. Move the value to `currencyConfig.precision` only on a field that already declares a `currencyConfig`. ⛔ Never add a `currencyConfig` just to carry the value: that block materializes `currencyMode: 'dynamic'` and `defaultCurrency: 'CNY'`, and the second changes the currency the field resolves. Under `currencyMode: 'fixed'` a moved value that contradicts the fixed currency's ISO 4217 digits is refused there in turn.
25
+
The one-line fix: delete `scale` from every `currency`field. Nothing replaces it, so ⛔ do not re-declare the value under any other key. The currency's ISO 4217 minor unit decides how the amount displays.
27
26
28
27
What an upgrade changes beyond the refusal:
29
28
30
29
-**Writes.** A currency value with more decimals than the deleted `scale` is accepted where it used to answer `VALIDATION_FAILED` with field code `max_scale`.
31
-
-**Two console faces, until the console catches up.**In the console version pinned when this landed, the grid summary footer and the dashboard metric widget read a currency column's `scale ?? 0`. A deleted `scale: 2` therefore renders those two faces with zero decimals until the console derives them from the currency the way the cell does. The cell and the edit widget are unaffected.
30
+
-**Two console faces.**At the console pin measured when this change was written, the grid summary footer and the dashboard metric widget read a currency column's `scale ?? 0`. This change lands only after the console derives both faces from the currency, the way the cell does, and after this repository's console pin has moved past that console change. So in the console bundled with this release, deleting `scale` changes neither face.
Copy file name to clipboardExpand all lines: content/docs/protocol/objectql/schema.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -289,7 +289,7 @@ fields:
289
289
| `valueDomain` | `string` | `text` | Standard the written value must belong to: `iana_time_zone`, `iso_4217_currency` or `iso_3166_alpha2` (the closed vocabulary shared with settings specifiers). |
| `scale` | `number` | `number`, `percent`, `rating`, `slider` | Decimal places, enforced on writes. Refused on `currency`: a currency amount's decimal places come from its currency'sISO 4217 minor unit. |
292
+
| `scale` | `number` | `number`, `percent`, `rating`, `slider` | Decimal places, enforced on writes. Refused on `currency` — delete it there: a currency amount's decimal places are its currency's, so its ISO 4217 minor unit decides the display. |
0 commit comments