Port upstream 0.67.0: add twelve preferred currencies from one shared catalog (stacked on #609) - #679
Draft
Finesssee wants to merge 1 commit into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Summary
Stacked on #609 (preferred display currency). Adds twelve currencies to the preferred-display-currency catalog: NZD, SEK, NOK, DKK, PLN, BRL, MXN, ZAR, THB, IDR, VND, UAH, appended after TRY in that order with upstream fallback rates. Picker labels are now
CODE (symbol)for every entry (e.g.VND (₫),TRY (₺),USD ($)), matching upstreampickerLabel.Picker order, symbols, and offline rates now come from one catalog:
CURRENCIESinrust/src/currency.rs. The frontend imports a generated module (apps/desktop-tauri/src/lib/currencyCatalog.generated.ts) instead of the two hand-maintained lists #609 added. A Rust test regenerates the module text and fails if the checked-in file differs (UPDATE_CURRENCY_CATALOG=1 cargo test -p codexbar currency_catalogrewrites it), so the two sides cannot drift.Live rate refresh already filters to supported codes (
parse_exchange_rates,clean_rates), so live rates for the new codes follow from the catalog with no other change.Display formatting:
formatDisplayCurrencyno longer forcesmaximumFractionDigits: 2;Intl.NumberFormatnow uses each currency's own minor units. This keeps zero-decimal currencies (VND, JPY, KRW) from showing fractional units. Note that ICU treats IDR as a 2-decimal currency, so IDR keeps two decimals.Upstream reference
v0.67.0):Sources/CodexBarCore/CurrencyExchange.swift(currenciestable,pickerLabel);PreferencesGeneralPane.swift(PreferredCurrencyOption); testsUsageFormatterTests.swift,SettingsStoreCoverageTests.swift.currenciestable (open.er-api.com, 2026-09-24).Ported / Deferred
Ported: catalog extension,
CODE (symbol)labels, single source of truth, USD-pivot conversion for each new code,normalize_preferred_currencyacceptance, picker order, zero-decimal formatting.Deferred: nothing from the spec. The upstream Swift
requiresLiveRates/ UserDefaults caching has no local delta (already covered by #609'scurrency-rates.jsoncache).Validation
All cargo commands on
+1.98.0, E-core wrapper, slot-2.cargo +1.98.0 fmt --all: cleancargo +1.98.0 clippy --workspace --all-targets -- -D warnings: passcargo +1.98.0 test -p codexbar currency: 15 passed (includes new order/rate/pivot/normalize/live-parse tests and the generated-catalog sync test)cargo +1.98.0 test -p codexbar(full): 2143 passed, 0 failed, 1 ignoredcargo +1.98.0 test -p codexbar-desktop-tauri currency: 3 passedvitest run(full): 68 files, 413 tests passed (includeslib/currency.test.ts,GeneralTab.test.tsxpicker order and labels)pnpm run lint: no findings in touched files (existing warnings elsewhere unchanged)pnpm run build: passAffected areas
preferredCurrencyCodevalues)UI proof
Pending: coordinator will capture CUA proof on a fresh build (Settings > General preferred currency picker showing the new options, one selection such as VND applied to a cost amount).