Commit Graph
3 Commits
Author SHA1 Message Date
yetone c3a9574de4 gui: a key's row keeps its controls shown and stays put under the pointer
tenacious_eagle_96548 (Discord, #general): in a provider's editor a key's
row showed its controls only under the pointer, so it kept growing and
shrinking, and moving away to fill in something else collapsed it.

Cause: app.css (#841) gave a key's unset controls (No limit at once, No
spend cap, Set balance, Switch off, Remove) no room off the pointer. A
hover made the row wrap from 38px to 59px and pushed the rows below
down. With Set balance open and typed into, moving the pointer to the
Name field collapsed the other pills, and the field moved 158px right
and 25px up under the caret (real magpie web, sandbox HOME on mote).

Fix: the list is drawn only in the provider's editor, where every key is
there to be set, so a key's row now shows every control, laid out the
same under the pointer as off it, as a phone's already did. The name and
the masked key stay whole; what doesn't fit beside them goes under the
row's first line. The "held" class that kept a clicked row open is gone
with what it worked around. Subscription accounts' rows (opacity only,
no shift), grips and the ⋯ menu are unchanged.

New key-row-steady.test.cjs: chromium and webkit, en/zh/zh-TW/ja/de, app
560/1000px and tab 420/1000px. Every control is shown off the pointer,
nothing in any row moves with the pointer over any row, and a balance
being typed keeps its place, caret and "100" when the pointer goes to the
Name field. key-row-chips-fit's "one line when not hovered" became "laid
out the same hovered or not"; stale hover comments updated in
key-own-balance, key-spend-cap, key-switch, key-gemini and key-plan.

Run (mote, through mote-run, at this head on origin/main c736906b1):
- go test ./internal/gui -run Budget: ok. gofmt -l internal/gui: clean.
- GUI key-*.test.cjs (44 files, both engines): 457 pass, 5 red:
  key-replace webkit 420px "Change key puts the new value" in all five
  languages, red the same on origin/main c736906b1 (#4126, ebody holds).
- key-row-steady: 40/40.
- Real app: rows 58/59/59px with the pointer off and over each row; the
  balance field's rect unchanged and focused after the pointer left.

Broken by hand: with origin/main's app.css and app.js, key-row-steady and
key-row-chips-fit failed 80 of 100 ("Set balance is hidden off the
pointer", "no proto shown"); with those visibility checks taken out,
"the pointer over k1 moved k1's row" 15 of 15. The 420px tab passed
either way (a phone already showed everything). A first cut let the
masked key shrink: key-weight-fit at 900px went red ("its masked key is
cut"), fixed here by keeping it whole.

Not run at push: the full Go suite and the full GUI suite (queued on
mote behind other sessions' suites under suite.lock; reds go to issues).
Not tried: Linux WebKitGTK and Windows WebView2 apps (CSS only, no new
API or motion).

Sibling left alone: a gateway key's unset quotas badge takes room only
under the pointer on the Gateway page (#5676).

Reported-by: tenacious_eagle_96548
2026-11-08 14:11:10 +08:00
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 00e0fd11b7 gui: a key switches off and on again by name, beside Remove (wei_VC on X)
wei_VC on X: "我希望可以 disabled 某些 key,现在只有移除,后面我想使用只能
再次新增". magpie could already keep a key off (KeyAccount.Off, the
caller key's Off), but the only switch was the tick dot at the row's
start, drawn with cursor: default and no word, so no one read it as
one. Remove was the only thing with a name.

- A provider's keys: each row has Switch off (on hover, beside Remove,
  as Remove is) or, when the key is off, Switch on, always shown. The
  first key too, while another key is on: keys/off gives its place to
  the next one on (provider.SetKeyOn's promote, unchanged). The last
  key on has none, as it has no Remove; the provider's own switch is
  for that.
- Gateway keys (the caller keys on the Gateway page): Disable key /
  Enable key is the first item of the key's … menu, above Rotate key
  and Remove.
- Words reused, already in all five languages ("Switch off"/"Switch
  on", "Disable key"/"Enable key"). No new i18n keys, no Go change.

The gateway already skips an off key on every route: providers'
keys go out only through Provider.KeysOn (fallback, key_models, video,
groups, remote key limits) and the first key is always on; an off
caller key is refused in access. Not changed.

Run:
- New internal/gui/tests/key-switch.test.cjs: Chromium + WebKit, en,
  zh, zh-TW, ja, de, 420 and 900px: 20/20 ok on mote. It switches the
  first key off, the off key on, the first back on, checks the posts
  are keys/off and keys/on (never keys/remove), no scroll, the button
  inside the row, and no Switch off on the last key on.
- gateway-card.test.cjs (now checks Disable key, Enable key, Rotate
  key, Remove and the off-key/on-key posts) and api-key-theme: 46/46
  ok with key-switch on mote.
- Broken by hand: key-switch on origin/main's app.js 0/10 (Chromium);
  gateway-card on origin/main's keys.js 0/10 (Chromium).
- gofmt -l clean; go vet ./... darwin and GOOS=windows ok;
  GOOS=linux go vet -tags nogui ./internal/{gui,provider,gateway}/...
  ok (GOOS=linux ./... without nogui stops in Wails' cgo files on a
  cross build, as before).
- go test -timeout 45m ./internal/provider/... ./internal/gateway/...
  ./internal/gui/... on mote at 65bd4e4f7 + this change: provider ok,
  gateway ok, gui red only in TestMainWindowCorners/macOS_26_SDK on
  macOS 27 (#3949, open, AppKit, not this change). Rebased onto
  f6263439a (gateway text to speech) after; this change has no Go.
- The whole GUI suite (989 files, Chromium + WebKit) was started on
  the Linux box (wsl-run, magpie-desktop) at this head and was still
  running when this was pushed; the coordinator asked to push without
  waiting. Its result goes on the tweet thread report, and any red it
  names gets its own issue.

Not tried: the real desktop app with real keys (the rows are the
same page the tests load, with the API faked).
2026-10-29 20:56:05 +08:00