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 6d7035f
Browse filesBrowse the repository at this point in the historyBrowse files
fix(objectql): a currency field written as an object is refused with the bare-number lesson
The record validator's numeric arm refused `{ value, currency }` on a
currency field with the plain `invalid_number` sentence. It now picks the
spec catalog's `invalid_number_currency_object` sentence for a plain
object on a currency field: a currency value is a bare number, and its
currency is declared in `currencyConfig` or is the tenant default
(ADR-0104). The wire code and the accept set are unchanged.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzenS8UJFmncftEGHsd
fix(objectql): a currency field written as an object, `{ value, currency }`, is refused with a sentence that says a currency value is a bare number
7
+
8
+
Clause-②: no
9
+
Metadata-protocol: none
10
+
11
+
<!-- adr-0087: not-required (no-migration-prescription) a refusal of a written VALUE at the record validator's numeric arm gains a second sentence: no authorable key, spelling or stored shape of metadata moves, and no schema, type or export changes. `packages/spec` gains one sentence in the built-in validation-message catalog (`invalid_number_currency_object`, a rendering variant of the existing `invalid_number` wire code, which is unchanged), and the accept set of the write door is the same before and after. A stored row keeps whatever it holds. The other categories are closed on facts: the packages publish (not `unpublished`); no ADR-0087 id covers a write-door value check (not `registered` / `already-registered`); and the change is a message, not a TypeScript declaration (not `runtime-interface-only` / `type-surface-only`). -->
12
+
13
+
The `{ value, currency }` shape was retired by ADR-0104 D1. A record write that still sends it to a `currency` field was refused with only "Amount must be a number", which does not say what to write instead.
14
+
15
+
-**`@objectstack/objectql`**: when a `currency` field's value is a plain object, the `invalid_number` refusal now reads: "Amount is a currency amount: write it as a bare number (e.g. 10), not an object such as { value, currency }. A currency field declares its currency in currencyConfig: the fixed mode's defaultCurrency, or under the dynamic mode (the default) the tenant default currency (ADR-0104)". The wire code stays `invalid_number`, with no new key on the error, so no client contract moves. A non-number string, an array, and an object on a `number` field keep the plain sentence.
16
+
-**`@objectstack/spec`**: the validation-message catalog carries that sentence as `invalid_number_currency_object`, in en, zh-CN, ja-JP and es-ES. A deployment can override it under `validation.field.invalid_number_currency_object`, like any other built-in message.
17
+
18
+
What to do: nothing. Writes that were accepted are still accepted, and writes that were refused are still refused with the same code.
invalid_url: '{{label}} must be a valid URL (scheme://...)',
113
113
invalid_phone: '{{label}} must be a valid phone number',
114
114
invalid_number: '{{label}} must be a number',
115
+
// `invalid_number`'s second sentence (#27236): a `currency` field written
116
+
// as an object, the retired `{ value, currency }` shape (ADR-0104 D1). The
117
+
// sentence names no currency code: the field's `currencyConfig` or the
118
+
// tenant default decides it (#27119 Q2 = X).
119
+
invalid_number_currency_object: '{{label}} is a currency amount: write it as a bare number (e.g. 10), not an object such as { value, currency }. A currency field declares its currency in currencyConfig: the fixed mode\'s defaultCurrency, or under the dynamic mode (the default) the tenant default currency (ADR-0104)',
115
120
invalid_boolean: '{{label}} must be true or false',
116
121
invalid_date: '{{label}} must be a valid date (ISO-8601)',
117
122
invalid_datetime: '{{label}} must be a valid datetime (ISO-8601)',
invalid_url: '{{label}} debe ser una URL válida (scheme://...)',
265
272
invalid_phone: '{{label}} debe ser un número de teléfono válido',
266
273
invalid_number: '{{label}} debe ser un número',
274
+
invalid_number_currency_object: '{{label}} es un importe de moneda: escríbalo como un número sin más (p. ej., 10), no como un objeto del tipo { value, currency }. El campo declara su moneda en currencyConfig: el defaultCurrency del modo fixed o, en el modo dynamic (el predeterminado), la moneda predeterminada del inquilino (ADR-0104)',
267
275
invalid_boolean: '{{label}} debe ser true o false',
268
276
invalid_date: '{{label}} debe ser una fecha válida (ISO-8601)',
269
277
invalid_datetime: '{{label}} debe ser una fecha y hora válidas (ISO-8601)',
0 commit comments