Commit Graph
3 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 689cf41423 plugins: a row's picture is asked for as it nears the screen (#909, #1956, #2459)
Each SVG an <img> draws is a document of its own in the webview (its
own Page, style engine and DOM, ~0.6 MB), kept while the window is
open. Opening Plugins drew 122 pictures at once, 57 of them SVGs, so
the renderer took 58 documents more, most for rows far below the fold.

icon() takes a lazy flag that sets loading="lazy" on the <img> it makes
for a stored picture or a -color/PNG icon; Plugins' rows and cards pass
it, the plugin's own page header (big) does not. Menus and other pages
keep loading at once, so nothing that opens on screen waits a frame.

Measured in Chromium against a dev backend with a copy of the real
library and its stored icons, every page visited then on Settings
(memory-infra dump of the renderer, then ps RSS):
- documents: 81 -> 37
- malloc 90.3 -> 81.7 MB, blink_gc 41.7 -> 39.7, partition_alloc
  25.4 -> 20.5, image cache 5.3 -> 1.3
- renderer RSS 256-289 -> 243 MiB
Scrolled to the bottom of Discover, all 122 pictures load in Chromium
and WebKit (screenshot checked); before scrolling, 52 and 18.

Run at this head:
- go test ./internal/gui -count=1 -timeout 45m: ok 125s
- GUI: tests/plugin*.test.cjs, models-add-and-icons, mono-icon-redraw,
  routing-log-icons, tray-logos, i18n-keys: 691 of 693 pass; the one
  red is webkit en of plugin-card-update, waiting 5s for the Update
  button under load 10 (#3079, filed on main 75e769a9f), and 3 of 3
  alone pass.
- plugin-own-icon now checks a row's picture is lazy and loads on
  screen, and the page header's is not: 22 of 22.
Broken by hand: logo() without the flag turns plugin-own-icon red.
Not tried: WebView2 and WebKitGTK themselves (both support
loading=lazy; an engine without it loads at once as before).
2026-10-26 17:36:38 +08:00
yetone 0738154520 plugin, gui: an installed plugin's row and page show its own magpie.icon, not its first provider's (#1775)
peterroe's plugin signs in to several providers. Each provider gets its own
picture from the auth hook, and package.json's magpie.icon is the picture
for the plugin itself. Settings → Plugins → Installed only took a plugin
picture from the market listing. A plugin that isn't listed (installed from
a path, git or an unlisted npm package) had none, so its row and its page
showed its first provider's picture.

- plugin.InstalledIcon reads magpie.icon from the installed package.json.
  It goes through the same ownIcon check as a listing's icon (data: or
  https only).
- pluginsState stores the picture through provider.RepoIcons, as listed
  plugins' pictures are, and returns it as `icon` on each plugin entry.
- plugins.js: the installed row and the detail page use the listing's
  icon, then the plugin's own, then its first provider's, as before.
- Docs (en, zh, ja): magpie.icon is the plugin's picture (Discover card
  and Installed row) and the fallback for providers without their own. A
  plugin of several providers gives each provider auth.icon.

Run:
- go test ./internal/plugin ./internal/gui: ok.
  TestPluginsStateGivesThePluginsOwnIcon covers a data: icon (kept), no
  icon and a plain-http icon (both "").
- internal/gui/tests/plugin-own-icon.test.cjs: Chromium and WebKit, en,
  zh, zh-TW, ja, de, at 980 and 420 wide. It fails on the old plugins.js
  (the row shows pa.png).
- The plugins GUI tests: 34/34 in each engine.
- gofmt; go vet darwin, windows, and linux -tags nogui.
- Full go test ./...: the only red is gateway OTel timing under load ~79.
  That's #1794, commented there; alone it passes 3/3.

Not tried with peterroe's real package; the fixture follows the layout
the issue describes.
2026-10-12 19:38:20 +08:00