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
fix(spec): never materialize the currency precision default the schema itself refuses — bare fixed-JPY parse is idempotent (#11423) (#11766)
* fix(spec): never materialize the currency precision default onto a fixed currency whose fraction digits refuse it (#11423)
The CurrencyConfigSchema .overwrite() baked precision 2 onto a bare
fixed-JPY/KRW/KWD-class config; the superRefine refuses that spelling as
authored, and the two are indistinguishable by design - so parse output
rejected itself on the mainline ObjectSchema.create() -> defineStack
re-parse. One conditional in the .overwrite() (the #9689 master_detail
precedent one screen away): the refused combination parses to output that
OMITS precision; every other combination keeps byte-identity. parse(parse(x))
pinned idempotent at CurrencyConfigSchema, FieldSchema and the
create() -> defineStack chain; authored contradictions stay rejected with the
same message; bare fixed-USD still materializes 2 byte-identically.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rxnd8cyFnoU8V5y21PaTsy
* chore: changeset for the #11423 currency precision idempotency fix
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rxnd8cyFnoU8V5y21PaTsy
---------
Co-authored-by: Claude <noreply@anthropic.com>
`CurrencyConfigSchema` no longer materializes the `precision` default onto a configuration the schema itself would refuse as authored (#11423). A bare `currencyConfig: { currencyMode: 'fixed', defaultCurrency: 'JPY' }` used to parse to `precision: 2` — and the #7918 rule rejects an authored `precision: 2` against JPY's 0 fraction digits, with the materialized and authored spellings indistinguishable by design — so parse output rejected itself on the mainline `ObjectSchema.create()` → `defineStack` re-parse: `parse(parse(x))` threw for an input `parse(x)` accepts.
6
+
7
+
Mechanism (the #9689 idempotent-materialization ruling, applied to its recorded currency twin): one conditional in the `.overwrite()` — when `currencyMode` is `fixed`, no `precision` was authored, and the currency's ISO 4217 / CLDR fraction digits contradict the default `2` (the JPY/KRW/KWD class), the parsed output OMITS `precision` instead of baking a value the schema refuses. Renderers already derive display width from the currency when the key is absent (objectui#4361), so absent is the honest spelling. Every other combination keeps byte-identical output: an authored `precision` is untouched, a bare fixed 2-fraction-digit config (USD/EUR/CNY…) still materializes `precision: 2` at its shape position, and `dynamic` mode and non-CLDR codes (crypto/custom, fail-open) keep materializing — none of those can be refused. The #7918 rejection of an authored contradictory `precision` is unchanged, message and path included.
it('a bare fixed-USD config still materializes precision 2 byte-identically (the default keeps baking where it is legal — #7918 relocation intact)',()=>{
0 commit comments