Changing a key's balance from $ to ¥ meant clearing the balance, switching
Settings' currency, then typing it again (a bare number kept the old
balance's currency). The balance field now has a currency button beside it
(USD/CNY, the app's menu, not a native select). It starts at the balance's
own currency, else Settings' one, which stays the default for new
balances. Picking keeps the typed number and posts nothing; Enter or
leaving the field saves, and the pill then reads ≈¥40.00 left. A typed ¥
or $ flips the button as you type. Nothing is reinterpreted: Settings'
currency still never touches a saved balance, and usage and cost displays
are unchanged. No server or API change; keybalance.js is lazy-loaded, so
app.js and the core budget are untouched.
Run (mote):
- key-own-balance.test.cjs: 20 of 20 ok (chromium + webkit, narrow width,
every language), with new cases: $40 → CNY picked → Enter posts
{balance:40,currency:"cny"}; ¥100 → Escape posts nothing; → USD, Tab
away posts {balance:100}; no row runs past the window.
- Whole GUI suite (earlier run at this change): every file ok except
i18n-keys "a plugin's words are its own", red on main already and filed
(#5327, #5332, #5426, #5482).
- Real GUI, sandbox HOME on mote (go build -tags nogui, ports 3591/3592):
typed 40 → ≈$40.00 left; Enter balance…, picked CNY, field kept 40,
Enter → ≈¥40.00 left, no page errors; `magpie provider key-balance`
read ¥40.00 typed. Screenshots taken.
Broken by hand: the old keybalance.js against the new test times out
waiting for the currency button; dropping the blur guard (saving when
focus moves to the button) makes the menu pick time out because the field
saved and redrew under it (chromium and webkit). Both red, restored.
Not run to the end: the full Go and GUI suites are queued under
suite.lock on mote behind ~20 other sessions' suites (~/runs/bc-suite);
no Go file changed. Not tried: the real desktop window, WebKitGTK on
Linux, Windows.
Reported-by: tenacious_eagle_96548