perf(shipping-notice): 优化发货任务性能,修复上传流程与终态问题

This commit is contained in:
hugo committed 2026-08-27 19:25:16 +08:00
1 parent 434c04ed2d
commit bcdd8285ae
29 files changed
+1074 -128

No files matched your search

@@ -53,6 +53,26 @@ def test_step1a_closes_all_gates_when_uploaded(app):
assert execution.status == 'completed'
def test_uploaded_fact_closes_gates_despite_stale_upload_pending_reason(app):
"""上传已成功时,历史 upload_rpa_pending 不得将正式 Gate 重新投影为阻断。"""
task = ShippingNotice(
task_no='SN-UPLOADED-STALE-PENDING',
upload_status='uploaded',
pending_human_reason='upload_rpa_pending',
match_status='fulfillable',
)
db.session.add(task)
db.session.flush()
execution = _mk_execution(task)
sync_fulfillment_gates_from_task(execution=execution, actor_type='user', actor_id=1)
db.session.commit()
db.session.refresh(execution)
assert execution.current_gate_code is None
assert execution.status == 'completed'
def test_missing_upload_status_keeps_gate_stuck(app):
"""upload_status != uploaded → STEP 1A 不触发,前置 Gate 保留(阶段投影可被回退)。"""
task = ShippingNotice(task_no='SN-UPLOAD-NOT-SET', upload_status='partial', match_status='fulfillable')