feat(shipping-notice): 新增通用解析能力,优化性能并清理遗留废弃代码
This commit is contained in:
1 parent
935bf26fa6
commit
7cfd5d167e
230 files changed
+9337
-10989
No files matched your search
@@ -998,41 +998,6 @@ def test_legacy_workspace_forwarding_audit_is_structured(app):
|
||||
}
|
||||
|
||||
|
||||
def test_apx_runtime_audit_is_read_only_and_counts_active_states(app):
|
||||
"""APX 清点只读统计运行中记录,不修改历史 Execution/Job。"""
|
||||
from app import db
|
||||
from app.models import Job, ShippingNotice, ShippingProcessExecution
|
||||
from app.services.shipping_notice.apx_runtime_audit import audit_apx_runtime_state
|
||||
|
||||
task = ShippingNotice(task_no='SN-APX-AUDIT')
|
||||
db.session.add(task)
|
||||
db.session.flush()
|
||||
active = ShippingProcessExecution(
|
||||
execution_no='APX-20260811-ACTIVE', task_id=task.id, status='active',
|
||||
current_gate_code='inventory_snapshots_ready',
|
||||
)
|
||||
historical = ShippingProcessExecution(
|
||||
execution_no='APX-20260811-HIST', task_id=task.id, status='completed',
|
||||
current_gate_code='inventory_matched',
|
||||
)
|
||||
db.session.add_all([active, historical])
|
||||
db.session.flush()
|
||||
job = Job(
|
||||
domain='shipping_notice', job_type='shipping_auto_progress', task_id=task.id,
|
||||
execution_id=active.id, status='queued', business_ref='APX-20260811-ACTIVE',
|
||||
)
|
||||
db.session.add(job)
|
||||
db.session.commit()
|
||||
|
||||
result = audit_apx_runtime_state()
|
||||
|
||||
assert result['execution']['active_count'] == 1
|
||||
assert result['execution']['historical_count'] == 1
|
||||
assert result['job']['active_count'] == 1
|
||||
assert ShippingProcessExecution.query.filter_by(id=active.id).one().status == 'active'
|
||||
assert Job.query.filter_by(id=job.id).one().status == 'queued'
|
||||
|
||||
|
||||
def test_inventory_mapping_is_versioned_and_immutable_by_shape():
|
||||
"""Mapping 必须按文件+版本唯一,旧版本通过 superseded_by_id 留谱系。"""
|
||||
assert 'uq_shipping_inventory_mapping_file_version' in _unique_names(ShippingInventoryMapping)
|
||||
|
||||
Reference in new issue
Block a user