From 9a1ea7002839f672e4a741562fdb15505cea114d Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 7 Jul 2026 04:50:23 +0000 Subject: [PATCH] fix(service-settings): drop hard-coded USD platform default for workspace currency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `localization.currency` setting defaulted to 'USD', and that value is applied to any currency-typed field that omits its own code (execution-context currency → dataset measure enrichment → field/cell rendering). So every code-less amount surfaced a "$"/"US$" symbol even when nothing — field, measure, or workspace — named a currency (reported on the HotCRM executive dashboard, whose `amount` field is Field.currency() with no code). Remove the platform default so a code-less amount renders as a plain number unless the workspace explicitly picks a Default currency (or the field declares its own code). Fields/measures with an explicit currency are unaffected. Verified: service-settings suite green (129 tests), incl. the updated manifest assertion (currency default now undefined). The stamp site (rest-server execution-context: `localization.currency ? { currency } : {}`) and resolve-execution-context both gate on truthiness, so an unset value simply falls away. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01VWr8Sgey8LY5nbWYPaYH6z --- .changeset/localization-no-default-currency.md | 9 +++++++++ .../src/manifests/localization.manifest.test.ts | 5 ++++- .../src/manifests/localization.manifest.ts | 9 +++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 .changeset/localization-no-default-currency.md diff --git a/.changeset/localization-no-default-currency.md b/.changeset/localization-no-default-currency.md new file mode 100644 index 0000000000..a11e104570 --- /dev/null +++ b/.changeset/localization-no-default-currency.md @@ -0,0 +1,9 @@ +--- +'@objectstack/service-settings': minor +--- + +Localization: drop the hard-coded `USD` platform default for the workspace **Default currency** setting. + +Previously the `localization.currency` setting defaulted to `'USD'`, and that value was applied to any `currency`-typed field that omits its own code — so every code-less amount surfaced a `$`/`US$` symbol even when nothing (field, measure, or workspace) actually named a currency. The setting now has **no platform default**: a code-less currency amount renders as a plain number unless the workspace explicitly picks a default currency (or the field declares its own). + +Migration: a workspace that relied on the implicit USD default and wants to keep showing `$` should set **Settings → Localization → Default currency** to `USD` explicitly. Fields/measures that declare their own currency code are unaffected. diff --git a/packages/services/service-settings/src/manifests/localization.manifest.test.ts b/packages/services/service-settings/src/manifests/localization.manifest.test.ts index 72ee73d755..b47814f1f0 100644 --- a/packages/services/service-settings/src/manifests/localization.manifest.test.ts +++ b/packages/services/service-settings/src/manifests/localization.manifest.test.ts @@ -21,7 +21,10 @@ describe('localizationSettingsManifest', () => { const byKey = (k: string) => specs.find((s) => s.key === k); expect(byKey('timezone').default).toBe('UTC'); expect(byKey('locale').default).toBe('en-US'); - expect(byKey('currency').default).toBe('USD'); + // No platform default currency: a code-less currency field renders as a + // plain number unless the workspace explicitly sets one (avoids surfacing + // an unwanted "$"/"US$" on every amount that omits its own code). + expect(byKey('currency').default).toBeUndefined(); expect(byKey('date_format').default).toBe('YYYY-MM-DD'); expect(byKey('first_day_of_week').default).toBe('monday'); expect(byKey('fiscal_year_start').default).toBe('january'); diff --git a/packages/services/service-settings/src/manifests/localization.manifest.ts b/packages/services/service-settings/src/manifests/localization.manifest.ts index 3d9b33d070..748b782022 100644 --- a/packages/services/service-settings/src/manifests/localization.manifest.ts +++ b/packages/services/service-settings/src/manifests/localization.manifest.ts @@ -111,8 +111,13 @@ export const localizationSettingsManifest: SettingsManifest = { // ── Finance ─────────────────────────────────────────────────────────── { type: 'group', id: 'finance', label: 'Finance', required: false }, { - type: 'select', key: 'currency', label: 'Default currency', required: false, default: 'USD', - description: 'ISO 4217 code applied when a currency field omits its own.', + type: 'select', key: 'currency', label: 'Default currency', required: false, + // No platform default: when a currency field omits its own code AND the + // workspace has not set a default here, amounts render as plain numbers + // rather than inheriting a guessed symbol (previously hard-defaulted to + // 'USD', which surfaced an unwanted "$"/"US$" on every code-less amount). + // A workspace can still pick a default to apply org-wide. + description: 'ISO 4217 code applied when a currency field omits its own. Leave unset to render code-less amounts as plain numbers.', options: [ { value: 'USD', label: 'USD — US Dollar' }, { value: 'EUR', label: 'EUR — Euro' },