修复(履约重试): 绑定失败无账号任务允许重新选号

- prepare_manual_allocation 支持 binding_failed/lease_expired 的人工重新选号
- 客户刷新时把任务重置为 ready 并唤醒选号
- 保留客户资料,分配成功后继续启动绑定
- 补充重试测试
This commit is contained in:
yml
2026-11-25 14:04:50 +08:00
parent 18df3443d8
commit eab1d1937a
3 changed files with 67 additions and 0 deletions
+27
View File
@@ -1332,6 +1332,33 @@ class TestAccountSelection(_Base):
assert task.next_allocate_at is not None
assert old_retry_at is None or task.next_allocate_at >= old_retry_at
def test_manual_allocation_allows_rebind_after_released_binding_failure(self):
task = self.task()
task.execution_status = "manual_required"
task.binding_status = "failed"
task.issue_code = "binding_failed"
task.last_error = "绑定二维码已过期"
self.session.commit()
detail = service.prepare_manual_allocation(
self.session,
task_id=task.id,
current=self.admin,
)
self.session.refresh(task)
assert detail["task"]["executionStatus"] == "ready"
assert task.execution_status == "ready"
assert task.binding_status == "not_started"
assert task.issue_code == ""
assert task.next_allocate_at is not None
assert (
self.session.query(PlatformFulfillmentEvent)
.filter_by(task_id=task.id, event_type="binding_retry_requested")
.count()
== 1
)
def test_capability_match_uses_local_index_without_live_probe(self):
account = self.account("capability-fast", capability=False)
task = self.task()