feat(fulfillment): 增加 Clean Cutover,历史任务隔离到人工入口
- 新增 flow_version,存量任务回填 1,Cutover 后新任务写 2 - 迁移设置 clean_flow_started_at,按订单支付/创建时间判定 - 自动选号只处理 clean 任务 - 工作台新增历史任务 Tab,历史列表不受订单起算时间限制 - 历史任务不参与自动重试和预售台账同步 - 补充流程边界测试和计划文档
This commit is contained in:
@@ -357,3 +357,44 @@ def test_schedule_retry_preserves_longer_capability_retry(db):
|
||||
|
||||
db.refresh(task)
|
||||
assert task.next_allocate_at == retry_at
|
||||
|
||||
|
||||
def test_auto_allocator_ignores_legacy_tasks(db):
|
||||
actor = User(
|
||||
username="auto-legacy-actor", password_hash="h", role="super_admin"
|
||||
)
|
||||
db.add_all(
|
||||
[
|
||||
actor,
|
||||
PlatformFulfillmentSetting(
|
||||
id=1,
|
||||
lease_duration_minutes=None,
|
||||
order_match_started_at=datetime.now(UTC) - timedelta(days=1),
|
||||
),
|
||||
PlatformFulfillmentTask(
|
||||
source_system="order_site",
|
||||
source_order_id="legacy-1",
|
||||
source_order_item_id="legacy-1",
|
||||
platform_order_id="AUTO-LEGACY",
|
||||
internal_sku_key="skin",
|
||||
commodity_id="commodity-1",
|
||||
flow_version=1,
|
||||
execution_status="ready",
|
||||
binding_status="not_started",
|
||||
exchange_status="not_started",
|
||||
paid_at=datetime.now(UTC),
|
||||
next_allocate_at=datetime.now(UTC),
|
||||
updated_at=datetime.now(UTC),
|
||||
),
|
||||
]
|
||||
)
|
||||
db.commit()
|
||||
|
||||
with patch.object(
|
||||
auto_allocator.service,
|
||||
"allocate_task",
|
||||
side_effect=AssertionError("legacy tasks must not be auto allocated"),
|
||||
):
|
||||
result = auto_allocator.run_auto_allocation_once(db, limit=10)
|
||||
|
||||
assert result == {"checked": 0, "allocated": 0, "failed": 0}
|
||||
|
||||
Reference in New Issue
Block a user