Commit Graph
5 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 9b4d0bda82 gui: the loading bird lands three times before the page fills, and a stray read never sends it off
v0.1.2095 (8cbd0a9c9) held a read for the bird's first landing and then
flew it off whenever any read was waiting. Every GET through api() counts,
so a poll landing then sent the bird away over skeletons still up; it came
back after 450ms and did it again. The owner saw it fly off twice and hop
only the third time (10-30), and asked for a longer minimum: two or three
hops, not one.

Now a read back before the bird's third landing (drop 300ms, two hops,
~1.6s) waits for it. At that landing the held reads go in, the bird stands
160ms while the page fills, and then carries on as before: it hops to the
next bar while there is one and flies off only when none is left. The cap
for a window that draws no frames is 3s, up from 1.5s. Comments cut so
app.js stays inside both budgets (app.js 1,311,561 of 1,311,735).

Run on mote (macOS 27), at this tree on origin/main f5dd4e142:
- skeleton-bird, tray-bird, plugin-readme-bird, both engines: 28 pass,
  0 fail. New: "a read of something else, as the bird lands, doesn't send
  it off while skeletons are up" (four api("/api/state") reads during the
  drop; one bird, still hopping 2.5s later). Changed: a load done as the
  bird comes waits for three landings, more than 1.3s and less than 3.5s.
- Broken by hand on v0.1.2095's app.js: the stray-read test fails in both
  engines (the bird flew off and came again), and the three-landings test
  fails in both (363ms, 444ms).
- 20 GUI files around loading pages (modal-centred-late,
  plugin-github-wait, plugin-progressive, usage-focus-steady,
  usage-stale-answer, routing-js, routing-day-window, routing-time,
  usage-refresh, library-loading, sessions-overview, plugin-market,
  providers-fetching, gateway-card, panel-usage, agent-models-loading,
  plugin-page, i18n-keys, reduce-motion, held-animations): 209 pass, 0
  fail.
- 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 02:14:36 +08:00
yetone 8cbd0a9c91 gui: once the loading bird comes it lands before the page fills
The owner (10-30): a load that finished just as the bird came had it
appear over no skeleton and streak off, which read as a bug. The bird
still comes only after ~450ms of skeletons. Once it has come, a GET read
through api() (and routing's history fetch) that comes back before its
first landing waits for it: the skeletons stay, the bird drops and lands
(about 0.5s), then flies off as the content goes in. A read back later
isn't held. The hold lets go after 1.5s at most, for a hidden window that
draws no frames. If its bar goes during the drop anyway (a read not
through api()), the bird fades where it is instead of flying across the
content. Reduced motion and Loading bird off never hold anything, since
no bird comes.

Run on mote (macOS 27), at this tree on origin/main 81bdca1fe:
- skeleton-bird, tray-bird, plugin-readme-bird, both engines: 26 pass,
  0 fail, the new "a load done as the bird comes keeps its skeletons
  until the bird has landed once" included.
- Broken by hand: the new test on the old app.js fails in both engines
  ("the bird landed on a bar before the skeletons went").
- 22 GUI files around loading pages (modal-centred-late,
  plugin-github-wait, plugin-progressive, usage-focus-steady,
  usage-stale-answer, routing-js, routing-steady, routing-day-window,
  routing-time, usage-ledger, usage-refresh, library-loading,
  sessions-overview, plugin-market, providers-fetching, gateway-card,
  panel-usage, agent-models-loading, plugin-page, i18n-keys,
  reduce-motion, held-animations): 237 pass, 8 fail. The 8 are
  routing-steady (#3412) and usage-ledger's "newest live route needs no
  return-to-live button" (#3104, #4078), which fail the same at
  81bdca1fe without this change.
- go test -run Budget ./internal/gui/: ok, no raise. gofmt -l: clean.

Not run: the full GUI suite (another session's full suite was running on
mote; one per machine), Linux and Windows.
2026-10-30 01:31:51 +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 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