readCheckins, the reader every daily check-in shares (WorkBuddy, Trae CN,
MiniMax Code, Qoder and the plugins' own), took a file it couldn't read
or parse as empty. The next check-in then asked the vendor again for
every account and wrote its answers over the file: an account could be
checked in twice in one day, and the entries it couldn't read were lost.
readCheckins now returns an error for a file that is there but can't be
read, or doesn't parse into entries (cut short, zeroed, empty, `[]`,
`null`). A file not there is still empty. On the error:
- checkiner.checkinNow asks nothing and writes nothing. Each account it
would look at is `failed` with the reason (the path and why), so the
loop tries again after 30 minutes and a press (GUI, TUI, `magpie
accounts checkin`) says why. The error is logged once while it stays
the same.
- The readers that only show results (WithCheckins, *Checkins(),
PluginCheckins) go through shownCheckins, which gives what last read
from the file in this process, so a card keeps its last good data.
- adoptLegacyPluginCheckins' own strict copy of the read now uses
readCheckins too.
Docs: providers-accounts.md no longer lists check-in marks among the
caches written over; provider-plugins.md says the plugin file's case.
Test: TestCheckinUnreadableFileLeftAlone writes a cut-short, zeroed,
empty, `[]` and `null` workbuddy-checkin.json, runs the loop and a press
against a fake WorkBuddy, and checks no status or claim request went out,
the file is byte for byte unchanged, and the result says the path; a
folder in place of plugin-checkin.json does the same through a plugin
checkiner. TestCheckinMissingFileIsEmpty and
TestCheckinUnreadableKeepsLastGood cover the other two sides.
Broken by hand (checkinNow taking the error as an empty map again): the
test went red, every case claimed (Asked true), and green once restored.
Run in a worktree at origin/main 62a1df801, sandbox HOME (testenv):
- gofmt -l . : clean
- go vet ./... (darwin), GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./... : all exit 0
- set -o pipefail; go test -timeout 45m ./... : exit 0, 68 packages ok,
none failed (internal/gateway 613s, internal/agent 529s,
internal/provider 262s)
No red seen, so no issue filed.
Qoder and Qoder CN campaigns run on [startAt, endAt) windows that cross Beijing midnight, so a campaign claimed yesterday could stand in for the whole new day and the next campaign was never claimed.
- A campaign is active by its upstream window, so one still open after Beijing midnight can be claimed.
- A saved result records the campaign's end in `until`, and is reused only on the same Beijing day, within 30 minutes and before that end; after that the list is read again (about 48 list reads per account per day, `inactive` included).
- Manual check-in always verifies upstream; failures and older records without `until` keep the old retry behaviour.
- Only Qoder sets `recheck`; WorkBuddy, Trae CN and MiniMax keep their once-a-day settlement.