Commit Graph
2 Commits
Author SHA1 Message Date
yetone ce8b67de37 gui tests: a page's first load gets a minute, not a click's 5s (#4470)
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).
2026-10-31 02:09:18 +08:00
yetone 4976561743 provider, gui: a provider imported under a subscription's name comes in beside it, and a colliding name can be changed in the picker (#1487, Dudung1018)
Dudung1018's CC Switch had third-party providers named as magpie's
subscriptions are: a Pi proxy "workbuddy", an OpenCode relay "Claude".
Reproduced in a sandbox GUI with a CC Switch db in cc-switch's real
schema:
- the default import answered 400 "workbuddy is the id of the workbuddy
  subscription; pick another name", after some picks had already been
  written. That is why the reporter later saw "already added" and couldn't
  find where the key went.
- the "Replace it" choice on a row named "claude" wrote the relay's models
  as the Claude subscription's picks, and dropped its key and address.

What changed:
- importapps: a row whose id is a subscription's (signed in or not), or
  magpie's own, is marked reserved. It is picked like a new one and added
  under a free id beside the subscription. Replace is refused for it, and
  key mode never joins an account or a provider at another address.
- the picker has a name field on every row whose name collides. A renamed
  row is added under its new name, and Replace is no longer offered for it.
  "Add as another key" names the provider the key went to.
- import links (magpie://import, magpie import) named or id'd as a
  subscription get a free id.
- the new sub-line is in en, zh, zh-TW, ja and de.

What was run:
- sandbox GUI on the old build (the 400, the partial write, the Replace
  case), then on the new one. The same picks gave 200 ["Relay 1487",
  "Claude (findcg)", "workbuddy"]: findcg got one more key, and relay-1487
  and workbuddy-2 were added at their own addresses.
- importapps_reserved_test.go: 4 tests on the real cc-switch schema, all
  red on the old code.
- import-collision.test.cjs: chromium and webkit, in en/zh/zh-TW/ja/de, at
  900 and 390px, 20/20 passing and red on the old assets.
  provider-discovery.test.cjs still passes.
- go test -tags nogui ./... green, gofmt -l, and GOOS=linux and windows go
  vet for internal/provider and internal/gui.
2026-10-10 23:17:22 +08:00