Skip to content

fix(service-settings): drop hard-coded USD platform default for workspace currency#2672

Merged
os-zhuang merged 1 commit into
mainfrom
claude/localization-no-default-currency
Jul 7, 2026
Merged

fix(service-settings): drop hard-coded USD platform default for workspace currency#2672
os-zhuang merged 1 commit into
mainfrom
claude/localization-no-default-currency

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

What & why

The workspace Default currency setting (localization.currency) hard-defaulted to 'USD', and that value is applied to any currency-typed field that omits its own code. The chain:

localization.currency (manifest default USD) → resolved onto the execution context (resolve-execution-context.ts, rest-server.ts: ...(localization.currency ? { currency } : {})) → stamped onto dataset measure fields and read by field/cell renderers.

So every code-less amount surfaced a $ / US$ symbol even when nothing — field, measure, or workspace — actually named a currency.

This was reported on the HotCRM Executive Overview dashboard: the Total Revenue (YTD) KPI showed US$2,528,600. Traced end-to-end (live app), the total_amount dataset measure came back from /api/v1/analytics/dataset/query stamped currency: "USD" purely because HotCRM's amount field is Field.currency() with no code of its own → it inherited this platform default.

Change

Remove the default: 'USD' from the currency spec in the localization manifest. With no platform default, a code-less currency amount renders as a plain number unless:

  • the field declares its own code (currency / currencyConfig.defaultCurrency), or
  • the workspace explicitly sets Settings → Localization → Default currency.

Both the execution-context resolver and the rest-server stamp already gate on truthiness, so an unset value simply falls away — no other code change needed.

Migration

A workspace that relied on the implicit USD default and wants to keep showing $ should set Settings → Localization → Default currency = USD explicitly. Fields/measures that declare their own currency code are unaffected.

Testing

  • pnpm --filter @objectstack/service-settings test129 passed (incl. the updated manifest assertion: currency default is now undefined).
  • The execution-context resolution tests set localization.currency explicitly (EUR/CNY/JPY/junk) and don't rely on the removed default — unaffected.

Note for reviewers

This addresses the platform default half of the HotCRM currency report. The HotCRM Total Revenue measure additionally uses format: '$0,0' (a literal $), so that specific tile will still show a $ from the format string until the measure format is changed in the HotCRM app metadata (separate, app-side follow-up). This PR ensures the platform no longer invents a currency for code-less amounts.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VWr8Sgey8LY5nbWYPaYH6z


Generated by Claude Code

…pace currency

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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VWr8Sgey8LY5nbWYPaYH6z
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jul 7, 2026 4:54am

Request Review

@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation tests tooling labels Jul 7, 2026
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): packages/services.

6 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/automation/webhooks.mdx (via packages/services)
  • content/docs/kernel/runtime-services/audit-service.mdx (via packages/services)
  • content/docs/kernel/runtime-services/index.mdx (via packages/services)
  • content/docs/kernel/runtime-services/settings-service.mdx (via packages/services)
  • content/docs/plugins/packages.mdx (via packages/services)
  • content/docs/protocol/objectos/i18n-standard.mdx (via packages/services)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

@os-zhuang
os-zhuang marked this pull request as ready for review July 7, 2026 06:21
@os-zhuang
os-zhuang merged commit c4fd39f into main Jul 7, 2026
16 checks passed
@os-zhuang
os-zhuang deleted the claude/localization-no-default-currency branch July 7, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants