checkin: a ZCode or Qoder captcha stands for the day, not asked again every 30 minutes (plugins#503)
ZCode's check-in is rechecked (pluginRechecks, 430005726): the loop
asked again 30 minutes after every answer, a captcha included. A
captcha answer means the plugin's claim got 3007 and the plan has to be
claimed in the ZCode app; asked again, the plugin GETs the feed and
POSTs the same claim, and ZCode answers 3007 again. MiniFullC's log
(plugins#503) has an account asked six more times after its captcha in
one evening, followed by 3012 on two accounts. The plugin itself
already says captcha stands for the day (its RECHECK comment); magpie
overrode it.
Now, under a recheck, a captcha or own-app answer (both wait on the
user in the vendor's app) is settled for the day for the loop. A press
still asks at once, and the next Beijing day asks again. inactive,
ineligible, done and claimed are rechecked as before, so a plan dropped
into the feed later in the day is still found. The provider-plugins
page now names ZCode among the rechecking plugins, which it left out.
Run on mote: go test ./internal/provider/ ok (120s); go vet for
darwin, linux and windows ok; gofmt clean.
Broken by hand: with the old recheck line, the new
TestPluginCheckinRecheckLeavesCaptcha is red in all four subtests
(zcode and qoder, captcha and own-app: asked again at 22:47).
Not tried: a real ZCode account (none here); the full suite runs after
the push.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -3,9 +3,9 @@ package provider
|
||||
// A daily check-in, whichever vendor's: WorkBuddy's (workbuddy_checkin.go)
|
||||
// and Trae CN's (trae_checkin.go). Each account in use is checked in once
|
||||
// a Beijing day, except Qoder's campaigns and ZCode's gift plans,
|
||||
// rechecked every 30 minutes,
|
||||
// and an answer that may be the vendor's day before (provisional, #3326),
|
||||
// asked again every 30 minutes until a claim or an answer from noon on.
|
||||
// rechecked every 30 minutes but for a captcha or own-app answer, which
|
||||
// waits on the user, and an answer that may be the vendor's day before
|
||||
// (provisional, #3326), asked again every 30 minutes until a claim or an answer from noon on.
|
||||
// A press asks the vendor again for a done, inactive or ineligible one.
|
||||
// What came of it is kept in the vendor's file by its key for reuse
|
||||
// (see workbuddy_checkin.go for when a failure is tried again).
|
||||
@@ -108,7 +108,13 @@ func (c checkiner) checkinNow(ctx context.Context, soon bool) []WorkBuddyCheckin
|
||||
settled = now.Sub(prev.At) < wbCheckinEvery
|
||||
}
|
||||
if c.recheck {
|
||||
settled = settled && !soon && now.Sub(prev.At) < wbCheckinEvery
|
||||
// a captcha or own-app answer waits on the user, in the
|
||||
// vendor's app, so the loop leaves it for the day: asked
|
||||
// again every 30 minutes, ZCode's claim only answered 3007
|
||||
// again, and the reporter's accounts went on to 3012
|
||||
// (plugins#503). A press still asks.
|
||||
waits := prev.Outcome == CheckinCaptcha || prev.Outcome == CheckinOwnApp
|
||||
settled = settled && !soon && (waits || now.Sub(prev.At) < wbCheckinEvery)
|
||||
if prev.Checked() && !prev.ValidUntil.IsZero() {
|
||||
settled = settled && now.Before(prev.ValidUntil)
|
||||
}
|
||||
|
||||
@@ -545,6 +545,49 @@ func TestPluginCheckinQoderRechecksCampaigns(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// plugins#503 (MiniFullC): a ZCode account whose claim asked for the
|
||||
// app's captcha was asked again every 30 minutes, the claim posted and
|
||||
// answered 3007 each time, six more times in one evening. A captcha, or
|
||||
// an own-app answer, waits on the user, so the loop leaves it for the
|
||||
// day under a recheck too; a press still asks, and the next day asks.
|
||||
func TestPluginCheckinRecheckLeavesCaptcha(t *testing.T) {
|
||||
for _, id := range []string{"zcode", "qoder"} {
|
||||
for _, first := range []string{CheckinCaptcha, CheckinOwnApp} {
|
||||
t.Run(id+"/"+first, func(t *testing.T) {
|
||||
claudeHome(t)
|
||||
now := time.Date(2026, 11, 3, 14, 16, 0, 0, time.UTC) // 22:16 Beijing
|
||||
outcome, calls := first, 0
|
||||
p := pluginCheckinCounter(id, &outcome, &calls)
|
||||
run := func(press bool) WorkBuddyCheckin {
|
||||
t.Helper()
|
||||
got := p.checkiner(func() time.Time { return now }).checkinNow(context.Background(), press)
|
||||
if len(got) != 1 {
|
||||
t.Fatalf("at %s: %+v", now, got)
|
||||
}
|
||||
return got[0]
|
||||
}
|
||||
run(false)
|
||||
outcome = CheckinClaimed
|
||||
for _, step := range []time.Duration{31 * time.Minute, 31 * time.Minute, 30 * time.Minute} {
|
||||
now = now.Add(step)
|
||||
if r := run(false); r.Outcome != first || calls != 1 {
|
||||
t.Fatalf("loop at %s: %+v after %d asks; want %s kept after 1", now.In(beijing).Format(time.TimeOnly), r, calls, first)
|
||||
}
|
||||
}
|
||||
if r := run(true); r.Outcome != CheckinClaimed || calls != 2 {
|
||||
t.Fatalf("press: %+v after %d asks", r, calls)
|
||||
}
|
||||
outcome = first
|
||||
now = time.Date(2026, 11, 4, 14, 0, 0, 0, time.UTC) // the next Beijing day
|
||||
run(false)
|
||||
if calls != 3 {
|
||||
t.Fatalf("the next day: %d asks, want 3", calls)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Every other plugin's check-in is settled for the Beijing day by a claim,
|
||||
// or by a done, inactive or ineligible answered from noon Beijing on: the
|
||||
// loop doesn't ask again after 30 minutes (#2696 changes Qoder's, plugins#503 ZCode's).
|
||||
|
||||
Reference in New Issue
Block a user