Commit Graph
2 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 87d83e7aba gui: Requests' head stays still on each refresh with Today picked, not shaking sideways in a window about as tall as the page (@LingYi_Stu on X)
The report: v0.1.1233, macOS, zh-CN, top nav, a narrow window with the
vertical scrollbar. On Usage > Requests with Today picked, the head's
right side (refresh, "5 秒", "≈$0.007") kept shaking left and right.

Cause: Usage's year heatmap (.heat-grid i { aspect-ratio: 1 }) makes the
page taller as it gets wider, for windows from about 720 to 1210px. So do
Sessions' calendar and the context waffle, which Routing's context card
uses too. With the window about as tall as the page, WebKit lays the
view out at full width under the 8px Mac bar (scrollWidth 1044 >
clientWidth 1036). On each redraw (Requests' 5s refresh with Today) it
lays it out 8px narrower for a few frames, so the head's right side
jumps 8px and back. Chromium doesn't do this. The reporter's "~1300" is
approximate: at 1300 the heatmap is at its widest and nothing shakes,
while 828 to 1044 at the page's own height does.

Fix: #view-usage and #view-routing keep the bar's room always
(overflow-y: scroll), as .modal .editor.framed > .ebody does. A short
page draws no thumb in either engine (checked by screenshot). The first
version applied this to every view, and agent-layout went red at 601px
(the identity column 148 < 150), so it is limited to these two views.

Test: usage-head-steady.test.cjs. Today, Codex rows, a year of heatmap
data and a cost that grows on each read, at 1044, 936 and 828 wide and
every height around the page's own. It clicks refresh and reads the
head's right edge, the interval's left edge and the view's
clientWidth/scrollWidth on every frame for 36 frames. It fails on the
old assets in WebKit for en/zh/zh-TW/ja/de (for example 1044x1109 zh)
and passes with the fix, 10 of 10, in Chromium and WebKit.

What was run (no Go was touched; baseline is origin/main b9c589ebb in
its own worktree; load 260-415 from other sessions):
- A WebKit probe from 600 to 1400px: shakes before, 0 after.
- usage-head-steady in both engines and 5 languages: red on the old
  assets in WebKit, green with the fix.
- agent-layout and account-arrange alone: pass.
- 159 related GUI files, 6 at a time (usage*, sessions*, context*,
  routing*, rt-*, view-*, gui-*, click-scroll, text-size, panel-usage,
  request-archive, tray-usage): 136 pass, including gui-zh-tw, gui-ja
  and gui-de. Each of the 23 reds was rerun A/B against b9c589ebb:
  - routing-context-fold (#1529) and usage-refresh (#2184) pass with the
    change and are red on base.
  - The rest are red on both sides, or vary case by case. Filed as #2211:
    routing-days-fit (red alone on base 4/4), failed-open, side-calls,
    agent-gone and hue-not-red WebKit 420, usage-agents-hide, and the
    agent-gone Chromium page.goto 5s timeout (8/8 alone on each side).
  - Already filed: #2115, #1905, #2163, #1864, #2200, #1612, #1544.
- Rebased on origin/main adf30aa63: usage-head-steady 10/10, and the 9
  GUI files changed since b9c589ebb (routing-rules-line, routing-compact,
  routing-pause, routing-pause-folder, routing-time, routing-intent-entry,
  menu-input-scroll, quota-refresh-order, usage-card-refresh) 93/93.
2026-10-14 23:06:25 +08:00