Commit Graph
7 Commits
Author SHA1 Message Date
yetone bbb1250162 gui tests: every update-* file takes WebKit's ResizeObserver notice as #3942's four do
#3942 (8c983ee7b) filtered WebKit's "ResizeObserver loop completed with
undelivered notifications" page error out of update-download-percent,
update-hide, update-notes-ask and update-wait. The other update-* files
with the same errors check were left out. On WSL magpie-desktop
update-stuck's webkit "can't write to its folder" case went red on that
notice alone once in four runs, and update-check's webkit "an install
that failed says why in full" once in a run of every update-* file. This
gives the same filter to the eleven left: update-auto, -blocked,
-channel, -check, -download, -mirror, -network, -restart, -row-held,
-row-steady and -stuck. Only that notice is dropped; any other page
error still fails.

Run: wsl-run node --test of every update-* file, both engines, with the
filter: 294 pass, 4 red, none on the notice. The reds are two timing
tests filed as #4554 (update-check reads the POST count right after the
click) and #4555 (update-restart's ja at 420 WebKit case 1px off); both
passed in the run before. At origin/main e4c784177, update-stuck webkit
alone: 20/20 twice (the flake is about 1 in 4).
Not tried: a loaded run to count the rate after.
2026-10-31 17:28:37 +08:00
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 84c50f0328 update: an old "up to date" isn't said, and Settings' Version row asks again (RickyWei)
RickyWei (Discord, Windows, Chinese UI): Settings > 关于 said 版本 0.1.1402 ·
已是最新 with v0.1.1517 out on yetone/magpie-releases.

Cause, from the v0.1.1402 code (internal/gui/update.go is unchanged since):
state "latest" is set only when a check that worked found nothing newer,
and a failed read is state "error" ("Couldn't check for updates"), so the
row's claim is the answer of one check. Nothing aged it: the state stayed
"latest" until the next check, and the row only read it. v0.1.1402 was the
newest release from 13:14 to 13:37 UTC on 10-24 (v0.1.1403 at 13:37), so
a check then said up to date, and with automatic checks off (Settings'
"only when asked") or once a day that stood for the next day while ~115
releases went out. The feed itself is right: usemagpie.ai/api/latest,
with ?lang=zh too, answers 0.1.1517 (gh release list agrees), the version
order is numeric, and nothing on Windows skips the check. Hedged: the
user's settings aren't known, so the interval is inferred, not seen.

Now:
- jsonIn reports a "latest" older than freshAfter (5 min) as "" (not
  asked lately), so no surface says up to date from an old answer.
- GET /api/update?fresh=1, which only Settings' Version row sends, asks
  the feed again over a stale "latest" with automatic updates on; the row
  shows checking and reads again. With them off nothing is asked by
  itself, and the row says "Automatic updates are off" with Check.
  The header pill's reads don't ask, so the feed's cadence is unchanged
  for a window left open.
- app.js stays inside TestCoreScriptBudget: a comment word went.

Run, at this tree:
- TestStaleLatestIsNotUpToDate (new): 1402 checked while newest, then
  the feed at 1517 and the answer aged past freshAfter: the plain read
  isn't "latest" and asks nothing, the row's read finds 1517
  ("available"); with automatic updates off it is "" and asks nothing.
  Red on origin/main's update.go ("an old answer still says up to date"),
  green with it.
- update-check.test.cjs asserts the row reads with fresh=1: red on
  origin/main's app.js (4 of 4 language/engine cases), green now.
- go test -tags nogui ./internal/gui ./internal/update (sandbox HOME): ok.
- The 21 GUI files that fake /api/update plus i18n-keys, Chromium and
  WebKit, en/zh where they cover them: 299 of 300 pass. The red is
  header-centre webkit (ResizeObserver loop as a page error), red the
  same on untouched origin/main d58053720 2 of 2, filed as #3479.
- gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., go build: clean.

Rebased onto c888ef272 after that run: go test -tags nogui ./internal/gui
./internal/update (TestCoreScriptBudget in it), the Windows and Linux
vet of internal/gui and gofmt again there: ok.

Not tried: the full go test ./... and the whole GUI suite (load ~160);
a real Windows install; the clock's monotonic reading across a Mac or
Linux sleep (Windows' InterruptTime counts sleep, so it isn't this case).
A v0.1.1402 that says up to date finds the update with a click on 检查
(the click asks the feed itself); one with automatic checks off keeps
needing that click, or a download from usemagpie.ai.
2026-10-25 18:22:13 +08:00
yetone 8f9bc3fccf gui tests: the 37 other Settings tests act on rows once the page has drawn its last read of the settings, as the masking-rules tests do since #1653 (#1659)
Opening Settings reads the settings twice: the page's own read
(showView), then the window's load() once the state is in. Each read
redraws every row. A test that found a row after the first draw, and
then called scrollIntoViewIfNeeded or boundingBox on it, failed when the
second read landed in between. The errors were "Element is not
attached", or a null box. #1653 fixed the three masking-rules tests and
listed these 37 in #1659.

Each of the 37 now calls watchSettingsReads(page) before every
page.goto, and settingsDrawn(page) right after it. Right after goto is
exact for ?view=settings: at boot, show(view) asks for showView's read
before load() runs. load() sets load.done in the same run that then asks
for its own read, so settingsDrawn's "load.done and every read asked
for drawn" holds only once the second read is drawn. For a test opened
on another page that clicks into Settings later, load is done by then,
the click makes the only read, and the wait passes at once.
watchSettingsReads now watches a page once, however many times it is
opened, since some of these tests open one page several times. The
page is unchanged.

Reproduced with a generic injection (scratchpad inject1659.cjs, loaded
with NODE_OPTIONS=--require). A route added at each goto holds the
page's second GET /api/settings. It lets the read go just as the test
calls scrollIntoViewIfNeeded or boundingBox, or waits on the page with
waitForFunction (which settingsDrawn is), with a 4s timer as a backstop.
This is #1653's injection, made generic.

Before, injected, both engines, all languages:
- 5 files red with the issue's error:
  - github-token: null box.
  - member-model-setting, searcher-pick, search-first and update-wait:
    "Element is not attached to the DOM".
- 4 files red on a check of a row drawn from the first read:
  model-suffix-own, otel, readable-focus and warm-at-times.
- 28 green.

After, injected: 36 of the 37 files green, every held read let go by
settingsDrawn's wait. otel stays red in WebKit at 360px. It is red the
same way with no injection, on origin/main's own copy of the test. That
cause is separate (the narrow nav laid out after setViewportSize
returns) and has its own commit next.

Plain (no injection), both engines, all 37 files: 460 cases passed and
2 failed, both otel's WebKit 360px check above.

The 8 files red under injection before, injected again after,
5 rounds: 390 of 390 cases passed.
2026-10-12 03:25:47 +08:00
yetone 88cccc184e update: on Windows, an exe something holds open for a moment still goes aside for the new version, and one held for good says why in full, with the release page a click away (freecss on Discord: "0.1.628 已下载 · couldn't move magpie-windows-amd64.exe aside to put the new version in: rename C:\Us…") — InstallBinary renamed the running exe to .old once and gave up on the first error, which Go prints as "rename <exe> <exe>.old: <reason>", two full paths ahead of the reason, and the version row cut it off on one line, so what failed couldn't be read. A leftover .old was already handled (RemoveOld, then .old-2…, TestInstallBinaryBesideARunningOld), and Windows renames a running image (it is mapped with FILE_SHARE_DELETE), so the likely cause is another program holding the exe open without delete sharing — an antivirus scan, OneDrive or a similar sync client — or a folder that refuses the change (access denied); which one isn't known until the full message is read. moveAside now tries again for about 3 s (0.1, 0.2, 0.4, 0.8, 1.5 s apart), clearing a read-only attribute after the first failure, with a fresh .old name each try; a missing exe isn't retried. When it still can't, the message is the reason without the paths and what to do: ERROR_SHARING_VIOLATION/ERROR_LOCK_VIOLATION says another program has it open (often an antivirus or OneDrive), access denied names the folder Windows won't let magpie change, anything else says to download the new version; the download is kept for another try, as before. The version row wraps a failed install's or download's reason (.sub.wraps) with the whole text as its tooltip, and a ready-but-failed install offers Download, which opens the release page. The Windows test box wasn't reachable from this session (ssh key refused), so nothing ran on Windows; TestInstallBinaryHeldOpen (windows-only: an exe held open without FILE_SHARE_DELETE for 0.5 s still installs; held for good, the error says another program has it open and the download is kept) was cross-compiled with GOOS=windows go test -c but not run. TestMoveAsideTriesAgain and TestMoveAsideSaysWhy (portable, with a fake rename) and the new update-check.test.cjs case (webkit, en and zh: the reason is not cut off, its tooltip is the full text, Download opens the release page, a later state is one line again) fail without the change; Chromium couldn't launch here (its Playwright cache has no ICU data). go vet ./internal/..., go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build and vet, go test -tags nogui ./... pass (TestFXInState failed once on a TempDir cleanup race, passes on the rerun; untouched). 2026-10-02 13:26:54 +08:00
yetone 10da2936da gui: Settings is a page per part, under a tab each, the part kept in the address (#471: Settings is one long scroll of some 45 rows in 9 sections) — the page now opens with a tab list in the warm-ups' look (role=tablist, a tab each with aria-controls/aria-labelledby): General (appearance, language, text size, the icons, model names, login, Dock, session terminal), Usage (the menu bar's usage, refresh, logos, what usage shows, currency, number units, the two alerts, then the warm-up and check-in tabs), Network and sharing (proxy, local network), Models (images, web search), Privacy, Observability, Sync and backup, About; the part picked shows its rows alone. Every row, its id and what it saves are as they were; the duplicate heading of a one-section part and the Preferences heading are gone. The part is kept as ?view=settings&tab=<part> (dropped on any other view), so a reload or a link lands there, and remembered (magpie.settingsTab) for Settings opened again without one, as the tray's window/main?view=settings; an unknown one falls back to it. A part whose rows are all hidden on this system has no tab, and one picked falls back to the first shown. The arrows, Home and End move along the tabs, one in the Tab order; a click on a tab moves nothing on the page, the tabs staying where they were; a pill drawn while its part was hidden has its thumb put under its pick when shown (the warm-ups' fix, now shared). The tabs wrap to a line more when they don't fit (English in the 560x420 window, at 110 and 125%, a phone), no left-border stripe. The click hold also holds a click not yet held before taking the next (keys pressed within a frame on a tab list whose part shrank to the window: the second click was taken at the clamped top and the page stayed there). New strings General and Network and sharing are in i18n.js (常规, 网络与共享). Tests that reach a row now open or click its part: api-key-theme, currency, gateway-caller-keys, gateway-connect-keys, lan-docker, number-units, otel, redact-rule-row, s3-sync, search-api, settings-groups, sync-other-kind, tray-inuse, tray-logos, tray-usages, update-check, update-hide, usage-alert, webdav-settings-refresh, whats-new; those needing a scrolled page wheel a shorter window or in smaller steps, as a part is shorter than the whole page was. settings-sections.test.cjs (Chromium, WebKit, en, zh) fails without the change (10 of 10). go vet ./internal/..., go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass (TestAccountProxy as on main); settings-sections, settings-groups, click-scroll, old-webkit, text-size and every settings test listed above pass. 2026-10-02 05:50:24 +08:00
SadWoodandyetone 09abaeecf0 fix(gui): 版本检查进行中保留检查按钮 (#223)
连续点击版本检查时,后返回的 checking 会把这一行的按钮删掉。检查未结束时按钮保持禁用并忽略再次点击,迟到的 checking 不再覆盖已经返回的结果。

Co-authored-by: yetone <yetoneful@gmail.com>
2026-09-29 23:43:40 +08:00