fix: preserve strategy intent and recover accounts automatically

This commit is contained in:
AttilaNet
2026-11-11 19:37:15 +08:00
parent ccb945631d
commit 5c253d5cf9
26 changed files with 1628 additions and 236 deletions
+7 -3
View File
@@ -43,6 +43,7 @@ class TaskLogTests(unittest.TestCase):
idle = fixtures.ServiceTests.idle
job = fixtures.ServiceTests.job
login = fixtures.ServiceTests.login
enable = fixtures.ServiceTests.enable
def tick(self, identifier, kind, *, status="succeeded"):
worker = self.manager._worker(identifier)
@@ -129,11 +130,14 @@ class TaskLogTests(unittest.TestCase):
self.assertEqual(self.entries(identifier, after)[0]["category"], "general")
def test_fast_and_auth_errors_keep_source_category_and_error_level(self):
identifier = self.account()
worker = self.manager._worker(identifier)
for kind, category in (("hatch", "hatching"), ("gift", "gifts"), ("explore", "exploration"), ("breakthrough", "ranch"), ("auto_relogin", "login")):
with self.subTest(kind=kind):
worker._running = True
# Each error owns a bounded retry deadline. Use independent
# enabled workers so one error cannot suppress the next case.
identifier = self.account()
self.enable(identifier)
self.job(identifier, self.manager.submit(identifier, "start"))
worker = self.manager._worker(identifier)
after = self.manager.logs(identifier)["next"]
with patch.object(worker.engine, "poll_automation", side_effect=ValueError("task failed")), \
patch.object(worker, "_auto_relogin_status", return_value={"state": "waiting"}), \