The phone head commit (usage: a phone's head is the tabs over one line
of days, sum and refresh) put a phone's days behind a menu over a hidden #period, so the
360px test's click on Today waited 5s on a hidden button in every engine
and language (10 of 10 red in the whole suite). It now checks that the menu
says Today there; a wide window still clicks the strip. On mote: 10 of 10
green.
claude-switch-only set page.setDefaultTimeout(5000) and then called
page.goto with no timeout of its own, so Playwright held the first load
of app.js, i18n.js and the plugins to the 5s bar meant for clicks. On a
busy box (a whole-suite run at load 130-160) that load took longer and
goto timed out. The same pattern is in 988 GUI test files (1174 pages):
every one of them now also sets setDefaultNavigationTimeout(60000) on
the same page, right after its default, so goto, reload and waitForURL
wait on the load itself with room, while clicks and waits keep their
short bar. group-from-model-add's own 20s navigation bar is raised to the
same minute. claude-switch-only also gives its first provider row (drawn
from the page's first reads) a minute before clicking it.
nav-timeout.test.cjs (no browser) reads every GUI test file and names
each page given a default under a minute without a navigation timeout of
at least a minute, so a new file can't bring the pattern back.
What was run (WSL magpie-desktop, Playwright 1.62.0, load 70-260 from
other sessions):
- node --check on every file in internal/gui/tests: all parse.
- nav-timeout.test.cjs against origin/main's test files: red (names the
1174 pages); against this tree: its only reds were my own probe copies
of the old files, since removed.
- By hand: claude-switch-only with app.js served 7s late (a busy box's
first load), --test-name-pattern "1100 en": origin/main's file 4 of 4
red with "page.goto: Timeout 5000ms exceeded"; this file 4 of 4 green.
- claude-switch-only.test.cjs, both engines, en/zh/ja/de, 1100 and 420:
32 of 32. group-from-model-add, usage-access-key-card and i18n-keys:
green. agent-plugin-agents: Chromium green; WebKit's de 420 subtest red
on a 5s waitForFunction at line 115 (a wait after load, not the
navigation), at load ~230.
Not tried: the whole GUI suite (about 1000 files; the change is one
mechanical line per page), Windows or mote (mote's browsers, #4125).
The Usage page's credits a day (#568) counted WorkBuddy alone: its
allow-list named the provider, and it read one "Credits" window's display.
moxuanchen asked for it on every subscription that sells credits, and
tnt1223 asked again on Discord.
A window is now counted by what it is, not whose it is: a meter whose unit
or name says credits (credits, 积分, 積分, 点数) or money (usd/$, cny/¥,
eur/€), with a used and a total, read from the plugin's amount/limit, or
else from its display ("x / y", units, currency signs, thousands
separators, compact k/M/万, e-notation, a trailing "· note" cut). A share
alone, a text row, an unlimited, family or aside window (when the card has
another), a card with an error or an old reading is not counted; of
several same-unit windows over a span (OpenDesign's 5 hours and Week) the
longest is. Each window keeps its own ledger, keyed provider|user|window,
so Qoder's Credits and Add-on credits don't mix; the card carries daily
(the first) and moreDaily (the rest), each with its window and, for money,
its unit. WorkBuddy's ledger under the old provider|user key still shows,
and moves to its Credits window's key on the next reading. A total that
drops counts nothing that day, never a negative.
GUI: a card shows a row per pool, named after the window when it has
several; money says "Spent per day" in the unit's currency. Strings in
zh, zh-TW, ja and de.
Not changed: API-key plan cards (PlanQuotas) aren't passed through the
ledger; ZCode's buckets carry no unit, so only one named "Credits" counts.
Run:
- go test ./internal/gui ./internal/usageapi (-timeout 45m): ok.
./internal/provider dies in TestUnreadLoginsWriteErrorsKeepCredentials
with "close of synctest channel from outside bubble" (#3632, red on
origin/main, filememo.Forget); with that test skipped: ok. New TestCreditWindowShapes (22 plugin window
shapes from the plugins repo's packages, plus Copilot's premium
requests not counted), TestDailyCreditsEveryVendor (Trae CN with no
display, Qoder's two pools, CodeArts' aside buckets, OpenDesign's
spans, resets, errors, Command Code's dollars),
TestDailyCreditsKeptBefore (an old WorkBuddy ledger shown before and
after a reading, then moved).
- GUI credit-days.test.cjs, chromium and webkit: the WorkBuddy cases and
a new one at 360px in en, zh, zh-TW, ja, de (Trae CN, Qoder's two
pools named, Cursor's On-demand spent in $, no sideways scroll);
i18n-keys, gui-zh-tw, gui-ja, gui-de, quota-pools, quota-credits,
plan-credits, usage-accounts, panel-usage, quota-name-translated,
credits-run-out: 57/57 ok.
- gofmt -l clean; go vet darwin, GOOS=linux/windows -tags nogui ok.
- Real use: magpie built from this tree in a sandbox HOME, the fake
plugin (a copy of internal/plugin/testdata/fake) signed in with a key,
two windows read from a file: Credits 100/1000 then 137.5/1000, and
Add-on credits "5 / 50 credits" then "9 / 50 credits". The card
showed "37.5 today" and "4 today", one row per pool, at 900px and
360px; credits-daily.json held fakeco|api key|Credits and
fakeco|api key|Add-on credits. Credits then dropped to 2/1000: the day
stayed 37.5.
Broken by hand: with origin/main's credits_daily.go the three new Go
tests and TestDailyCredits fail (14 shapes "counted false", [null]
days, the old key not moved); with origin/main's app.js the new GUI
case fails in all five languages.
Not tried: a real account of any vendor other than the fake plugin;
Windows and Linux GUIs.
Reported by moxuanchen.