Commit Graph
7 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 1027db4081 plugins: a README read once shows at once when its page opens again
The owner (10-30): closing a plugin's page and opening it again played
the loading bird over a README already read, and memory for them must
stay bounded, and a README changed since must not stay old.

detail() keeps each page read in a Map, the last 20 opened only: a new
read goes to the end and the oldest is dropped past 20. Opening a page
that is there draws its README and date at once, with no loader and no
bird, and reads the page again behind it; a README that changed takes
the old one's place, and a failed read keeps the one shown. A page never
read still loads under the bird, waiting for its three landings.

The core's scripts grow 677 bytes; coreScriptBudget is raised to the
exact size, 1,537,034, with no room added.

Run (mote, at 55299ee30 + this change):
- node --check plugins.js.
- node --test plugin-readme-bird, skeleton-bird, plugin-page,
  plugin-market, plugin-progressive, plugin-github-wait, plugin-local,
  plugin-release, tray-bird: 82 pass, 0 fail, chromium and webkit,
  the new test "a README read once shows at once when its page opens
  again, and a newer one takes its place" among them.
- go test -run Budget ./internal/gui/: ok. gofmt -l: clean.

Broken by hand:
- main's plugins.js under the new test: red in both engines (the
  reopened page shows the bird and no README).
- without the line that puts a changed README in: red, waiting for
  the newer README's "Paragraph 4.".

Not run: the full GUI suite and go test ./... (this touches plugins.js'
detail() and one test file only); the 20-page cap has no test of its
own, it is read from the code.
2026-10-30 04:17:35 +08:00
yetone 56bc3d515a plugins: a plugin's README waits for its bird to land on three lines
The owner (10-30): opening a plugin's page, the README came so fast that
the bird dropped in and flew straight off, the same flash the skeleton
bird had (9b4d0bda8 fixed that one only; this loader is plugins.js's
bounceLoader, a bird of its own that comes at once, with no 450ms wait).

The loader now has a ready promise: it is kept once the bird has landed
on its third line (drop 300ms, three landings, two hops: ~1.7s), at once
with reduced motion or the Loading bird off, when the box is gone, and
after 3s at most for a window that draws no frames. detail()'s fill waits
for it before the README goes in, then the bird flies off over it as
before. A dialog closed while it waits is left alone.

The core scripts' budget is raised to 1,532,602, the exact size, with no
room added, after the loader's comment was cut down.

Run on mote (macOS 27), at this tree on origin/main 9b833205f:
- plugin-readme-bird, skeleton-bird, tray-bird, plugin-page,
  plugin-market, plugin-progressive, plugin-github-wait, plugin-local,
  plugin-release, both engines: 80 pass, 0 fail. New: "a README back at
  once waits for the bird to land on three lines" (three lines lit when
  the README went in, after more than 1.3s and less than 3.5s).
- Broken by hand on main's plugins.js: the new test fails in both engines
  (README in after 18ms and 10ms, no line landed on).
- go test -run Budget ./internal/gui/: ok. gofmt -l: clean.

Not run: the full GUI suite (another session's full suite holds mote),
Linux and Windows.
2026-10-30 03:36:14 +08:00
yetone f463a8aaf7 gui: Settings has Loading bird, which keeps magpie's bird off skeletons and stops looking for them
Yayoi_no_yume on X, agreed by GymlinZhu: they run magpie on a 1-core,
1GB server and asked for a way to turn the loading bird off. The owner
wanted the bird, so it stays on by default. Settings -> General now has
"Loading bird" (Off / On), below Reduce motion.

- settings.json keeps noBird (omitted when the bird is on), and boot.js
  passes it. A POST that leaves it out keeps it, as with the other prefs.
  theme.js sets data-bird="off" on <html> before the first paint, and
  applyPrefs changes it.
- skelBird (app.js): with the bird off, nothing looks for skeletons at
  all. No 250ms interval and no observer run. Turning it off mid-hop ends
  the hops, and the bird flies off.
- With the bird on, the look is driven by events. Before, the 250ms
  setInterval ran forever, scanning the DOM for .skeleton whether or not
  one existed. Now a MutationObserver watches for an added node that is or
  holds a skeleton, the 250ms look runs only while one is in the page,
  and the look stops itself once none are left.
- The README's bird (plugins.js bounceLoader): with the bird off, the four
  lines stand straight with no bird, and the box goes when the README
  comes.
- Strings are in en, zh, zh-TW, ja and de. App.js is 1,294,016 bytes, under
  its budget, which is not raised.

Tests:
- skeleton-bird.test.cjs adds three tests:
  - with no skeleton left, the look stops, and a skeleton added later
    starts it again;
  - with the setting saved off, no bird, no dip and no look ever starts
    (setInterval is wrapped to count the look);
  - the Settings row shows On by default; Off posts noBird:true, stops a
    running look, and a skeleton added after that starts none; On posts
    false and the look starts again.
- plugin-readme-bird.test.cjs: with the setting off, the lines stay
  straight, no .sk-bird is drawn, and the box goes at once.
- settings-general: #birdSegs is in the list of bare rows.
- TestSettingsNoBird: off by default, kept by a POST that leaves it out,
  cleared by false, in settings.json and boot.js.

Run at this head (rebased on e15b2277c):
- mote: go test -run "Budget|TestSettings|TestBoot|TestI18n"
  ./internal/gui ./internal/settings: ok. GOOS=linux, windows and darwin
  go vet -tags nogui of both: clean (on the pre-rebase base aad6546cd,
  with no Go change between the two). gofmt -l: clean.
- wsl-run (Linux), both engines: skeleton-bird, plugin-readme-bird,
  settings-general, reduce-motion and i18n-keys: 43 of 44 pass. The one
  red is skeleton-bird's original hopping test in WebKit. It is red 2 of
  2 on origin/main e15b2277c in the same place, filed as #4176 (also one
  line of #4120).
- Before the rebase, on mote in Chromium, the same five files all passed.
- wsl-run Chromium: settings-groups, settings-lines-wrap, settings-search,
  settings-sections, settings-shortcut, settings-tabs-stick, text-size,
  menu-scroll and i18n-keys: 76 of 76 pass.

Broken by hand:
- With birdOff() always false, the three new off tests go red (README,
  skeletons, Settings row).
- With the look never stopping itself, "with no skeleton left" goes red.

Not tried:
- WebKit on mote. Playwright's WebKit never launched there (180s launch
  timeouts at load 65-300), so macOS WebKit wasn't run; WebKit ran only on
  Linux.
- The whole GUI suite (970 files), because mote was under heavy load.
- The real app on any OS, and a real 1c1g server. The CPU saved wasn't
  measured.
2026-10-29 13:12:36 +08:00
yetone e9c1066c4b gui test: the README bird's leave is measured at the swap
TestPluginReadmeBird read the leaving box and the README's top after
"Paragraph 11." showed. By then the dialog had moved some frames on
its spring (holdModal) while the box stays where it was, so the two
were 4.5 to 5.5px apart in webkit, over the 4px bar: 1 of 6 alone on
origin/main 9809a8ac9 and on this branch. A MutationObserver now takes
both at the swap itself, which is what "leaves from where it was"
means.

Run: the file alone, both engines, 6 times: 12 of 12 ok.
Broken by hand: the box placed 20px lower in fill() fails it in both
engines (boxTop 481 vs mdTop 461).
2026-10-26 23:10:09 +08:00
yetone ed5cc959a7 gui: every slow page's skeletons get magpie's bird hopping bar to bar
The owner, after the Plugins page's README bird (722483c08): every
skeleton loader should have it, the slow pages most of all (Sessions,
Usage, Masking, Library).

app.js keeps one bird for the window (skelBird). Every 250ms it looks
for .skeleton and the Plugins page's ghost cards' .sk bars. When some
have stayed 450ms or more and at least one can be seen (in the
viewport, elementFromPoint at the bar landing on it or a box it sits
in, since ghost bars let clicks through), the bird drops onto one. The
bar dips under it, and it hops to the next bar it can see, in page
order. When the bars are gone it flaps off up and to the right and is
removed. It is position: fixed with pointer-events none, so nothing
under it moves or stops taking clicks. A quick load (under 450ms)
never shows it. A hidden window and reduced motion skip it.

The README's bird (plugins.js bounceLoader) now draws from the same
markup (BIRD) and styles (.sk-bird, sk-flap in app.css). plugins.css
loses its .pm-bird copy.

Budgets: app.js 1,321,319 -> 1,325,845, core 1,537,645 -> 1,541,967,
the exact bytes, no room added.

Run at origin/main 9809a8ac9 (load 100-150):
- skeleton-bird.test.cjs (new), both engines: a held market read
  shows the bird within 3s, over 30 places and dips, and gone 2s after
  the reply. A 150ms reply shows none. Reduced motion: no bird, no dip.
- plugin-readme-bird, i18n-keys, gateway-key-limit, the Budget tests:
  ok (the README bird's one webkit red is main's too, fixed in the
  next commit but one).
- Probe with every /api read but state held, per page: the bird shows
  on Sessions (4 bars), Library (31), Providers (20), Gateway (39),
  Usage (15), Masking (2) and Plugins (48). Screenshots looked at for
  Library, Usage and Sessions.
- The whole GUI suite at a6c808b68 (concurrency 6, load ~170): 128
  reds on this branch, 130 on main, over the same 36 files. Run alone
  twice per tree, the only test red on this branch and not on main was
  gateway-key-limit's chromium narrow check, a ResizeObserver race,
  fixed in the next commit.
Broken by hand: with the bird never spawned, the slow test is red.
Not tried: the Routing window page, which draws its stage at once and
has no skeleton (the tray panel's routing tab does); the tray panel
itself; the real app (only Playwright's engines).
2026-10-26 23:10:08 +08:00
yetone 722483c089 plugins: a plugin's README loads under magpie's bird bouncing down its lines
The owner found the plugin page's pulsing skeleton bars boring and picked
concept F (Trampoline) from the design round. While the README loads,
the skeleton's four lines are strings. magpie's bird drops onto the first,
bounces down them, and each string bends under its feet and wobbles after
it as a damped spring. A string it has landed on turns faintly to the
accent colour. From the last string it is thrown off the top and drops in
again. When the README comes, the strings fade and the bird flies off
up-right while the dialog grows to the README on its spring, as before.
With reduced motion the strings are drawn straight and the bird sits on
the first one.

How it fits the dialog:
- The leaving box goes into #modal, beside the dialog, not inside it.
  Anywhere in the dialog (a scroller), an absolutely positioned box made
  WebKit lay the fields out 8px short until it was removed, so the
  dialog's last frame jumped 8px and modal-centred-late's "centred in
  every frame" went red at 820px in WebKit. Tried in the README and in
  the dialog first; both were red.
- Its marks are data-* attributes, not classes, so holdModal's
  MutationObserver (class/hidden/open) doesn't run on every hop. It is
  removed 200ms after the 570ms height spring would end.
- The README fades in alone (n, not the readme box), so the bird isn't
  faded with it.
- Only the README skeleton changes; the small .skeleton bars elsewhere
  are as they were.

Core budget: 1,537,016 -> 1,542,244, the bytes plugins.js grew, with no
room added.

Run at 42ec2700b plus this change; rebased onto 5214d5114, whose two
commits touch the Claude gateway and provider code, not internal/gui:
- New tests/plugin-readme-bird.test.cjs, chromium and webkit: four
  strings and the bird; over 2s a string bends >4px, the bird takes >20
  places and >=2 strings light; when the README comes the box is marked
  gone, is out of the README, leaves from where it was, the README takes
  the top, and the box is gone within 2s. Reduced motion: nothing moves
  in 400ms, strings straight, box gone at once.
- modal-centred-late both engines (16/16 with the new test, twice).
- GUI: plugin*, market-*, modal-*, i18n*: 728 of 730. The red is
  plugin-card-update webkit en (#3079): it passes 2 of 3 alone at this
  head and fails 2 of 3 alone on origin/main 42ec2700b under load 40-77.
- go test ./internal/gui -run Budget; gofmt -l clean.
- Screenshots in light and dark at 980x820, through the loop and the
  flight off.

Broken by hand: the leaving box kept inside the README, and inside the
dialog: modal-centred-late webkit 820px red both ways (the last frame's
8px jump), green with it in #modal.

Not tried: the real Wails app (WebKitGTK on Linux, WebView2 on Windows);
only Playwright's chromium and webkit.
2026-10-26 02:18:40 +08:00