ac4af582301a4e8a29245dbba767eba31334ddf9
7
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
bceeabd93a |
gui: a subscription's warm-up, check-in and resets are in its provider's editor
The owner, 11-07: "这些配置难道不是应该在对应的Provider那个弹窗里面吗?为什么会散落在Settings里?"
Settings › Allowances no longer holds Codex's auto-use resets and how
early before one expires, Codex's and Claude's warm-ups, or the daily
check-in of WorkBuddy, Trae CN, MiniMax, Qoder and the plugins that check
in themselves. Each is in its own provider's editor (PROV_PREFS: the lists
move from a hidden holder into the editor's .prov-prefs box and back).
Settings' search still finds them, each a row whose Open goes to the
editor. Task-done alerts stay in Settings. "Codex: auto-use resets" and
"Codex: how early before one expires" lose their "Codex:" in the editor.
In the editor a press inside a part that redraws moved the page: the
modal hold moved the dialog, which can't move once it meets the window's
edge, and lost a pressed element a redraw replaced. The hold now scrolls
the editor's body by what is left, and finds the replacement by its path
or by tag, class and text under its id'd ancestor. In a browser the
editor's body keeps its bar's room, as the app's already did: WebKit kept
the grid's columns from before a bar that came with a grown field, and
the editor scrolled 10px sideways.
Budget: app.js grew with the editor's parts; paid for by comments cut
(curlOf, scrollCloses, unrollSheet, quotaRange, ledGroupSpeed, the
Settings tabs, the warm-up and fold notes), no raise.
Run at this head (704fd85f3 before this message, on origin/main):
- mote: go test -count=1 ./internal/gui/ ok (TestCoreScriptBudget
included); go vet ./..., GOOS=windows go vet ./... and GOOS=linux go vet
-tags nogui ./... clean.
- mote: settings-groups and i18n-keys GUI files. i18n-keys' "a plugin's
words are its own" fails the same on origin/main (#5332, #5327, #5482).
- WSL, both engines, the files this can reach, mine vs origin/main
|
||
|
|
0acba61a35 |
gui: a lone plugin's check-in tab is named for it, not "Plugins"
ljq906416 and justrun_way on X couldn't find WorkBuddy's daily check-in after it moved to its plugin. The WorkBuddy plugin (0.2.0 on) checks in itself, so magpie hides its own WorkBuddy tab under Settings › Usage's check-in tabs and the switch sits under a tab labelled "Plugins" (插件), which nobody looking for WorkBuddy reads. With one plugin checking in, the tab now carries that plugin's name (WorkBuddy), as a built-in's tab does; two or more still share "Plugins". The label is set through data-en, so a language change keeps it. Run (wsl-run, Linux, Chromium + WebKit, en/zh/zh-TW/ja/de): plugin-checkin, checkin-reason, checkin-reason-once and i18n-keys: 64 pass, 0 fail. The new two-plugin test checks the shared tab's translated name and both rows; the 440px test checks the lone tab reads "FakeCo". Broken by hand: with the old app.js the 440px test fails in chromium en and zh (expected FakeCo, read "Plugins"); the two-plugin test passes there, as it guards the shared case. Size budgets summed by hand the way TestCoreScriptBudget does (the Go package needs cgo, which wsl lacks): app.js 1,308,499 of 1,316,874, core 1,529,963 of 1,533,802, no raise. Not tried: the real app with a signed-in WorkBuddy plugin. |
||
|
|
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). |
||
|
|
63a361b5ff |
gui: a plugin that took over Trae's, WorkBuddy's, MiniMax's or Qoder's check-in keeps that switch after a state refresh (#1912)
The previous commit reads the saved pluginCheckins map before /api/settings' list, but /api/state has neither the list nor, for a provider whose own switch was never set, a map entry. Such a plugin follows the built-in check-in it took over (provider.PluginCheckinOn: traeCheckin for trae-cn, workbuddyCheckin, minimaxCheckin, qoderCheckin), so a refresh still drew it off while the scheduler kept checking in. pluginCheckinOn now falls back to that built-in's switch, from PLUGIN_CHECKIN_INHERITS. Run: plugin-checkin.test.cjs gains cases for the inherited switch in /api/state's shape (red with the fallback removed) and a test that the map names the same ids and settings keys as Go's PluginCheckinOn (red with an extra entry); plugin-checkin, i18n-keys, gui-zh-tw, gui-ja, gui-de in Chromium and WebKit: 32 pass. No new strings. |
||
|
|
762db7c5a2 |
gui: a plugin's saved auto check-in stays on after a state refresh (#1912, 1939323749)
Reported by 1939323749 with a custom provider plugin on Windows. Read the persisted pluginCheckins map before the derived settings-only list, preserving explicit false and the existing default fallback. Verified plugin-checkin tests in Chromium and WebKit across en, zh, zh-TW, ja and de, plus all three translation GUI suites. The WebKit English Usage-card regression fails without the fix: saved auto check-in stays on after a state refresh (false !== true). Reviewed and landed from the reporter's branch (755c1f0): with the old pluginCheckinOn the new refresh assertion fails in WebKit for every language; with it, plugin-checkin, i18n-keys, gui-zh-tw, gui-ja and gui-de pass in Chromium and WebKit. |
||
|
|
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. |
||
|
|
87487c5ef0 | plugin, provider: a plugin can press its vendor's daily check-in itself (auth.checkin), and magpie runs it as its own check-ins (Lemon on Discord #feedback: provider 每日签到的方法能放到插件里面去做吗; ARNO earlier asked for Qoder's) — the check-ins magpie had (WorkBuddy, Trae CN, MiniMax Code, Qoder) are each written in magpie against the vendor's endpoint, even for a subscription that moved to its plugin, so a plugin author had no way to give their provider one. A plugin's auth hook may now have checkin(getAuth, provider) beside usage: the host lists the provider with checkin: true (plugin.Provider.Checkin) and answers checkin({provider, account}) (plugin.AccountCheckin), refreshing the account as usage does, with {outcome, credit, streak, message}; outcome is claimed, done, ineligible, inactive, captcha or failed, and a throw or an outcome outside these is failed with the reason. internal/provider/plugin_checkin.go runs these through checkin.go's checkiner, as the built-ins are: each signed-in account in use once a Beijing day (first look 2 minutes after start, then every 30), a failure asked again after wbCheckinRetry, every other outcome settled for the day, results kept in plugin-checkin.json by provider|account; a failure is recorded as failed and resets nothing. captcha is new (CheckinCaptcha): the vendor wants a captcha, which magpie never solves, so it is said as "check in in its own app", not as a failure, and not asked again that day. The results mark the account's Usage card (checkinBy "plugin:<provider>", WithCheckins), so the card's check-in row, its Auto check-in and Check in now work for it (POST /api/settings/plugin-checkin {provider, on}, POST /api/usage/plugin-checkin {provider}); Settings → Usage gains a Plugins tab, shown while such a plugin is signed in, a Daily check-in row per provider with Off/On and how each account went; magpie accounts checkin and c on the TUI's Usage page include them (the TUI's "no account" line names check-in plugins). The switch (settings.PluginCheckins, by provider) is off by default; for WorkBuddy, Trae CN, MiniMax Code and Qoder it follows that vendor's existing switch until set on its own, and magpie's own check-in through the plugin's fetch leaves a provider whose plugin checks in to it (pluginChecksIn), so no account is checked in twice. The Settings page's save carries PluginCheckins over (TestSettingsSaveKeepsWhatItDoesNotSend's fixture names it). No plugin declares the hook yet; Qoder's check-in stays magpie's own here. TestPluginCheckinRunsAsTheBuiltinsDo (the fake plugin with FAKE_CHECKIN, five accounts answering claimed, done, captcha, a throw and an unknown outcome: off presses nothing; on, each outcome kept with its vendor; a minute on nothing pressed again; past the retry only the two failures; the next day all five; PluginCheckins and the cards marked; another provider's press asks none) and TestPluginCheckinTakesOverTheVendors (a qoder plugin without the hook leaves magpie's Qoder check-in its account, with it none; PluginCheckinOn's fallbacks) pass -race -count=10, and the latter fails with pluginChecksIn stubbed false; TestTUIChecksPluginsIn passes -race -count=20. plugin-checkin.test.cjs (the card's row with the captcha said, Auto check-in posting {provider, on}, no page move; the Settings Plugins tab at 440px with the row fitting, no sideways scroll, On posting) passes on Chromium and WebKit in en, zh, ja and de; usage-checkin, i18n-keys, gui-ja, gui-de and settings-* pass. go test -tags nogui ./internal/..., go vet, gofmt -l, linux (nogui) and windows builds pass. Not tried with a real plugin or account: no published plugin has the hook yet. docs/subsystems/provider-plugins.md (the hook's contract) and docs/reference.md say it. |