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 4a4a90c237 gui: the sidebar's button stays in one place whether the sidebar shows or not (ztf4080 on X)
ztf4080: "左侧栏收起按钮在左上角,但是收起后展开按钮变了右下角". The button
to hide the sidebar sat in the page header to the right of the sidebar
(x=232 at 1280), and once hidden it was in the title bar after the magpie
(Mac x=175; Windows 14; Linux 93/14/40 as the brand folds). Each click
moved it.

Now #sideToggle is first in the title bar in both layouts, as Finder's,
Notes' and Mail's: layoutNav moves it with the brand, into .side-top when
the sidebar shows and to the front of .top when it doesn't. .side-top has
the header's height and left padding (Mac: after the traffic lights at
96px/zoom, as .top), so the button keeps its x, y and size. A sidebar too
narrow for the name keeps the bird (fitTop sets .side-top.tight). Windows'
10px .side-top is gone: the button needs that row there too. Nothing else
in the sidebar changed.

Run (on mote, through mote-run; NODE_PATH playwright 1.62.0, chromium and
webkit):
- Repro before the fix: a probe at 1280/900/640, en/zh/de, Mac/Windows/
  Linux chrome, gave the positions above.
- side-toggle.test.cjs gains "<os>: the button stays where it was" for
  Mac, Windows and Linux: every language (en, zh, zh-TW, ja, de) at 1280,
  900, 640 and a 168px sidebar; hide then show, x/y/w/h within 0.5px, the
  header fits, .side-top doesn't overflow.
- Broken by hand: the new test against origin/main's assets fails all 3
  OS subtests in both engines (18 pass, 8 fail); reverting layoutNav's
  append/prepend fails them too.
- side-toggle, side-width, header-centre: 49 pass, 1 fail (header-centre
  webkit, the ResizeObserver page error, #3479; the same on the base).
- The 22 GUI files that touch the sidebar, brand or toggle
  (--test-concurrency=2): 335 pass, 11 fail: header-centre webkit (#3479)
  and mobile-web's desktop compare against HEAD~1, which moved on purpose.
- mobile-web.test.cjs: until BASE_REF has the move, its desktop compare
  leaves the button, the magpie and the header out of both pictures, like
  its other "until BASE_REF has it" cases. Run in a git checkout on mote
  with BASE_REF=HEAD~1: 30 pass, 0 fail in chromium and webkit.
- At the head rebased on 9e8c22dad: side-toggle.test.cjs 26 pass, 0 fail;
  go test -run TestCoreScriptBudget ./internal/gui ok (app.js 1,315,308 of
  1,315,316, no raise; a comment in fitTop cut to fit after the rebase).
- go test ./internal/gui: TestMainWindowCorners/macOS_26_SDK red, #3949
  (macOS 27 box), not this change.

Not run: the whole GUI suite (mote was busy with other sessions' full
suites, load 45-110); the real app on Windows and Linux (the probe used
their chrome classes in Playwright).
2026-10-30 10:55:05 +08:00
yetone 778000326a gui: the sidebar sets off from rest and settles in a third of a second, as a Mac's does (wangye1644294 on X)
wangye1644294 (Windows, zh-CN, sidebar layout) found collapsing and
expanding the sidebar stiff. The morph ran .5s on cubic-bezier(.32,.72,0,1),
the spring the sidebar's lists open on. That curve leaves at speed: 8% of
the travel in the first frame, 92% by 184ms, then a 300ms creep. The frames
a webview drops as the view transition's pictures start to move (WebView2's
most) landed where the page moves most, and read as a jerk, followed by a
long tail.

The view-transition group, side-out and side-in animations now share
--morph-t (.32s) and --morph-ease (cubic-bezier(.42,0,.58,1), the Mac's
ease-in-ease-out). Largest per-frame step drops from 13.7% to 9% of the
travel, and the start, where frames drop, barely moves. End states,
reduced motion (no transition), Linux (no transition) and the 1500ms stuck
cut-off are unchanged. The other .32,.72,0,1 uses in app.js (lists, iOS
sheet, nav) are other animations and are left alone.

side-toggle.test.cjs now reads the running animations' computed timing:
the page, nav-usage group and side-out each last 250-350ms and their curve
starts from rest (x1>0, y1=0).

Measured (page card edge, 188px travel):
- Real WebView2 on the Windows box (Edge 155.0.4283.45, 125Hz, 1349x1128,
  DPR 1.1), 12 toggles each over CDP, a temporary build with
  AdditionalBrowserArgs (not committed):
  old: 63-67 frames over ~503ms, first step 7-8px, max step 14px, one 39px
       jump from frames dropped at the start
  new: 42-44 frames over 320-328ms, first step 0px, max step 9px, no long
       frames
- Mac, headed Chromium, ffmpeg avfoundation 60fps + mpdecimate, 3 rounds
  alternating:
  old: 25-27 changed frames over ~500ms, 4-7 gaps per toggle, first
       visible step 19-54px
  new: 14-20 changed frames over ~333ms, 0-5 gaps, first visible step
       4-18px (a busy shared desktop makes the gap counts noisy)

Run: side-toggle, side-width, header-centre in Chromium and WebKit, 44/44
pass (five languages; widths 1023 and 640 included). Broken by hand, each
red in the new test: the old .5s timing ("group(nav-usage) lasts 500ms"),
the old curve at .32s ("sets off from rest: cubic-bezier(0.32, 0.72, 0,
1)"), and side-out alone at .5s ("old(side) lasts 500ms").
No Go changed, so no gofmt/vet/go test. Not tried: the top-tab-bar layout
on Windows (it has no sidebar morph; covered by the existing tests), and
the reporter's own machine.
2026-10-14 18:10:48 +08:00
yetone f5dd4d604e gui: the Linux app's sidebar button switches the layout at once, no view transition, which WebKitGTK with compositing off crashed in (depravity_wings on X)
Since 18e82adc6 (v0.1.1197) the sidebar button, Ctrl+Shift+S and dragging
the sidebar's edge past its narrowest trade the two layouts in a view
transition (navMorph). Under Wayland magpie turns WebKitGTK's compositing
off (webkit_linux.go), and WebKitGTK 2.52 then crashes in the transition:
SIGSEGV on the GTK main thread inside libwebkit2gtk-4.1, from a
JavaScriptCore run-loop timer. The reporter saw the window freeze.

The Linux app (body.linux) now has the new layout at once, the path reduced
motion already takes; magpie web in a Linux browser keeps the motion. Other
webviews get a guard: a transition still going after MORPH_MAX (1.5s, three
times its length) is skipped, so one that never ends can't leave the window
on the old layout's picture.

Run:
- Reproduced on the omarchy VM (Hyprland/Wayland, webkit2gtk-4.1 2.52.6),
  v0.1.1207 under a scratch HOME: the button crashed the app 4 of 4 clicks;
  with WEBKIT_DISABLE_COMPOSITING_MODE=0 it didn't.
- The fixed build there (same Linux path, compositing at magpie's default):
  8 button clicks, 4 Ctrl+Shift+S and an edge drag past its narrowest all
  switched the layout, checked by screenshot each step; no crash, no freeze.
- side-toggle.test.cjs: "Linux: at once, no transition" and "a transition
  that never ends is cut short", chromium and webkit; both go red with the
  change undone by hand. side-toggle, sidebar, side-width, header-centre
  pass in both engines (60 tests). go test -tags nogui ./internal/gui ok.
Not run: the 1.5s guard on a real webview that never ends a transition
(none found); it is tested with a stub.
2026-10-12 19:13:14 +08:00
yetone 18e82adc62 gui: the window's pages down a sidebar in groups, the open page's tabs under it, and a button to have the header's tabs instead
From 1024 points wide (SIDE_AT) the window lays its pages down the left
as a Mac app's sidebar: Work (Agents, Sessions, Library), Models
(Providers, Routing, Gateway), Insights (Usage), Extend (Plugins), with
Settings and the gateway's address at the foot. The open page's own tabs
(Usage, Library, Plugins, Settings) are listed under it, opening and
folding on an iOS-like spring, and the page's strip is hidden. The header
becomes a breadcrumb, and pages whose head held only tools have them in
the title bar. Graphite: the open page is in the text's ink, not purple.
A pressed row darkens and never shrinks. The selection under the tabs
sets off as the row is pressed, on a 0.3s curve (it felt behind the
finger), and is the list's only shape: a sub-row hovered or pressed has
no ground of its own, which showed a block under the finger before the
selection slid there. The page's tab is clicked at once, so what is
typed next goes to it.

The title bar's button (or ⌃⌘S, Ctrl+Shift+S), there at every width,
picks the sidebar or the header's tabs. The choice is kept in
localStorage magpie.navLayout (side or top) at every width, so it is laid
out from the first frame; picked in a narrow window the sidebar is 184
points under 860. The two trade places in
a view transition: the sidebar slides, each tab flies to its place, and
the page slides as one. Without view transitions or under reduced
motion, the change is at once.

With nothing picked, narrower than 1024 the page beside a sidebar would
be narrower than Usage's requests table needs, so the header's tabs come
back. A resize
drops what a click held (heldWidth). Usage's KPI strip goes two to a line
by the room the page gives it (a container query), and Japanese counts
wrap there. Tests whose window is 1024+ were updated for the sidebar,
and docs/subsystems/gui-shell.md says how it works.

Run: sidebar.test.cjs and side-toggle.test.cjs 16/16 in chromium and
webkit, in en, zh, zh-TW, ja and de. Each was broken by hand (press
shrink, address cut, press glide, sub-row ground, view transition, kept
choice) and went red. Every page at 560 points with the sidebar picked,
zh and de, both engines: nothing scrolls sideways. session-identity's
ledger row sits under the footer beside the sidebar; WebKit's click
doesn't scroll to it, so the test wheels it up first. Animation frames were checked from a recorded video. The 105
affected GUI files in both engines; their reds were rerun alone and fixed
(filter-ime: the sub-row's click now at once; session-identity, above) or
fail the same on main (tray-logos). The full GUI suite in chromium, on
the rebase onto d5cae267a, was cut short at 352 tests on the owner's
"ship": 6 reds (account-alias, account-models, codex-auto-review,
codex-credits, context-text) each pass alone, here and on main d5cae267a,
so they are timing under the full run's load and are to be filed. After
rebasing onto e4e22b23e: sidebar, side-toggle, session-identity,
filter-ime, library-instr-busy, usage-speed-count and view-scrollbar,
50/50 in chromium and webkit. go build ./... passes.
2026-10-12 00:41:34 +08:00