fix(service-settings): drop hard-coded USD platform default for workspace currency#2672
Merged
Merged
Conversation
…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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 6 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
os-zhuang
marked this pull request as ready for review
July 7, 2026 06:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
The workspace Default currency setting (
localization.currency) hard-defaulted to'USD', and that value is applied to anycurrency-typed field that omits its own code. The chain:localization.currency(manifest defaultUSD) → 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 showedUS$2,528,600. Traced end-to-end (live app), thetotal_amountdataset measure came back from/api/v1/analytics/dataset/querystampedcurrency: "USD"purely because HotCRM'samountfield isField.currency()with no code of its own → it inherited this platform default.Change
Remove the
default: 'USD'from thecurrencyspec in the localization manifest. With no platform default, a code-less currency amount renders as a plain number unless:currency/currencyConfig.defaultCurrency), orBoth 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 test→ 129 passed (incl. the updated manifest assertion:currencydefault is nowundefined).localization.currencyexplicitly (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 Revenuemeasure additionally usesformat: '$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