feat(shipping-notice): 新增通用解析能力,优化性能并清理遗留废弃代码
This commit is contained in:
1 parent
935bf26fa6
commit
7cfd5d167e
230 files changed
+9337
-10989
No files matched your search
@@ -187,61 +187,6 @@ def test_field_quality_block_eligibility():
|
||||
assert field_quality_may_block(required=False, auto_create_key_field=False) is False
|
||||
|
||||
|
||||
def test_projection_marks_apx_gate_as_readonly_without_executable_actions(app, monkeypatch):
|
||||
"""APX 历史 Gate 只可审计展示,不能再投影为可恢复业务 Gate。"""
|
||||
from types import SimpleNamespace
|
||||
from app.services.shipping_notice import process_gate_projection as projection
|
||||
|
||||
gate = SimpleNamespace(
|
||||
id=1, gate_code='inventory_candidates_calculated', sequence_no=1,
|
||||
status='pending', evaluation_version=1, input_fingerprint=None,
|
||||
blocking_reason_code=None, blocking_reason_json=None,
|
||||
recommendation_json=None, effective_result_json={}, findings_json=None,
|
||||
next_action_code=None, passed_at=None, invalidated_at=None,
|
||||
latest_attempt_id=None,
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
projection.ShippingProcessGateAttempt.query,
|
||||
'get',
|
||||
lambda _id: None,
|
||||
raising=False,
|
||||
)
|
||||
payload = projection.serialize_process_gate(gate, include_diagnostics=False)
|
||||
assert payload['gate_code'] == 'inventory_candidates_calculated'
|
||||
assert payload['legacy_readonly'] is True
|
||||
assert payload['allowed_actions'] == []
|
||||
assert payload['recovery_targets'] == []
|
||||
assert len(PROCESS_GATE_DEFINITIONS) == 20
|
||||
|
||||
|
||||
def test_user_gate_summary_marks_apx_execution_readonly(app, monkeypatch):
|
||||
"""APX Execution 不能向用户下发主动作或恢复目标。"""
|
||||
from types import SimpleNamespace
|
||||
from app.services.shipping_notice import process_gate_projection as projection
|
||||
|
||||
execution = SimpleNamespace(
|
||||
id=1, execution_no='APX-1', status='blocked', current_gate_code='inventory_candidates_calculated',
|
||||
last_passed_gate_code=None, primary_next_action_code=None, responsible_party='system',
|
||||
lock_version=1, review_case_id=None, task_id=1, updated_at=None,
|
||||
)
|
||||
gate = SimpleNamespace(
|
||||
id=1, gate_code='inventory_candidates_calculated', sequence_no=1, status='blocked_retryable',
|
||||
evaluation_version=1, input_fingerprint=None, blocking_reason_code='inventory_candidates_required',
|
||||
blocking_reason_json=None, recommendation_json=None, effective_result_json={},
|
||||
next_action_code=None, passed_at=None, invalidated_at=None, latest_attempt_id=None,
|
||||
)
|
||||
query = projection.ShippingProcessGate.query
|
||||
monkeypatch.setattr(query, 'filter_by', lambda **_kwargs: query)
|
||||
monkeypatch.setattr(query, 'order_by', lambda *_args: query)
|
||||
monkeypatch.setattr(query, 'all', lambda: [gate])
|
||||
monkeypatch.setattr(projection.ShippingProcessGateAttempt.query, 'get', lambda _id: None, raising=False)
|
||||
summary = projection.project_user_gate_summary(execution)
|
||||
assert summary['status'] == 'legacy_readonly'
|
||||
assert summary['legacy_readonly'] is True
|
||||
assert summary['next_action_code'] is None
|
||||
assert summary['allowed_actions'] == []
|
||||
|
||||
|
||||
def test_inventory_matching_recovery_keeps_review_entry_when_primary_is_technical(app, monkeypatch):
|
||||
"""库存匹配技术重试被隐藏时,跨阶段 RecoveryPlan 仍必须保留人工复核入口。"""
|
||||
from types import SimpleNamespace
|
||||
|
||||
Reference in new issue
Block a user