Skip to content

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
codex/port-0.64.1-preferred-currencyfrom
port/micro-0.67.0-preferred-currencies
Draft

Finesssee wants to merge 1 commit into
codex/port-0.64.1-preferred-currencyfrom
port/micro-0.67.0-preferred-currencies

Conversation

@Finesssee

Copy link
Copy Markdown
Collaborator

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 upstream pickerLabel.

Picker order, symbols, and offline rates now come from one catalog: CURRENCIES in rust/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_catalog rewrites 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: formatDisplayCurrency no longer forces maximumFractionDigits: 2; Intl.NumberFormat now 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

  • Release: CodexBar 0.67.0, preferred currency catalog extension.
  • Tag-pinned (v0.67.0): Sources/CodexBarCore/CurrencyExchange.swift (currencies table, pickerLabel); PreferencesGeneralPane.swift (PreferredCurrencyOption); tests UsageFormatterTests.swift, SettingsStoreCoverageTests.swift.
  • Rates in the table are copied verbatim from the tagged currencies table (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_currency acceptance, picker order, zero-decimal formatting.

Deferred: nothing from the spec. The upstream Swift requiresLiveRates / UserDefaults caching has no local delta (already covered by #609's currency-rates.json cache).

Validation

All cargo commands on +1.98.0, E-core wrapper, slot-2.

  • cargo +1.98.0 fmt --all: clean
  • cargo +1.98.0 clippy --workspace --all-targets -- -D warnings: pass
  • cargo +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 ignored
  • cargo +1.98.0 test -p codexbar-desktop-tauri currency: 3 passed
  • vitest run (full): 68 files, 413 tests passed (includes lib/currency.test.ts, GeneralTab.test.tsx picker order and labels)
  • pnpm run lint: no findings in touched files (existing warnings elsewhere unchanged)
  • pnpm run build: pass

Affected areas

  • Settings UI (preferred currency picker options and labels)
  • Config file / settings persistence (accepted preferredCurrencyCode values)
  • Provider-specific behavior (cost display conversion only)
  • Tray panel
  • CLI
  • Installer / release packaging
  • Startup / background behavior
  • Documentation

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).

@coderabbitai

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant