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.
When /status says the check-in is on and today's isn't in, and /claim
answers 9074 「当前参与用户太多,请稍后再试」, the check-in is now saved
with a new outcome, own-app, instead of failed. Like every answer other
than failed it settles the Beijing day: the loop doesn't claim again
after the 30-minute retry, and Check in now isn't offered (a press
wouldn't claim either). The next day is asked as before.
Why: Trae CN pays check-in credits only to a device registered through
its own device-register service and security SDK. The plugin's device id
isn't, so 9074 is permanent for it; across ~5 days on #808 no retry ever
succeeded, and repeated claims from an unknown device may read as abuse.
What the user sees, in en/zh/zh-TW/ja/de: the Usage card's check-in row
and the Settings "Daily check-in" line say "Trae CN only gives check-in
credits to its own app; check in in the Trae CN app" (zh: Trae CN 只给自己的
客户端发签到积分,请在 Trae CN App 里签到), with Trae's own message in the
tooltip. The TUI and `magpie accounts checkin` say the same.
Unchanged: 9074 on /status (before any claim) and every other code keep
their handling; WorkBuddy, MiniMax, Qoder and plugin check-ins untouched.
docs/subsystems/provider-plugins.md describes it.
Run:
- TestTraeCheckin9074IsOwnAppOnly with trae_checkin.go at HEAD fails:
"same day, soon=false, asked again after 9074: [POST /status POST
/claim]"; with the change it passes.
- usage-checkin.test.cjs new case on old app.js fails (row said "Check-in
failed; magpie tries again later · 当前参与用户太多…"); with the change all
28 pass in Chromium and WebKit, en and zh. plugin-checkin 16/16,
i18n-keys, gui-ja, gui-de, gui-zh-tw pass.
- go test -tags nogui ./internal/provider ./internal/gui ./internal/tui .
under a sandbox HOME: ok.
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui on the
touched packages: clean.
- Not tried against a real Trae CN account (none here); the 9074 bytes
are the reporter's from #808.