feat(shipping-notice): 收敛复核状态隔离、STP 重试幂等与 XFA 合成预览标注
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
84a881b554
commit
74270adc22
149 files changed
+20111
-3871
No files matched your search
@@ -198,9 +198,18 @@ def test_recoverable_ready_layout_is_reused_for_duplicate_document(app):
|
||||
assert scheduled.id != incomplete.id
|
||||
|
||||
|
||||
def test_xfa_layout_reuse_localizes_structure_analysis_for_duplicate_document(app):
|
||||
def test_xfa_layout_reuse_localizes_structure_analysis_for_duplicate_document(app, monkeypatch):
|
||||
"""相同 XFA 文件复用时,目标 Document 必须获得独立 Analysis 并重写快照身份。"""
|
||||
app.config['SHIPPING_NOTICE_LAYOUT_MINERU_ENABLED'] = True
|
||||
audit_events: list[str] = []
|
||||
|
||||
def _capture_audit(**kwargs):
|
||||
audit_events.append(str(kwargs.get('event_type')))
|
||||
|
||||
monkeypatch.setattr(
|
||||
'app.services.shipping_notice.audit_service.append_shipping_audit_event',
|
||||
_capture_audit,
|
||||
)
|
||||
with app.app_context():
|
||||
original = _document()
|
||||
source_analysis = ShippingXfaStructureAnalysis(
|
||||
@@ -269,11 +278,21 @@ def test_xfa_layout_reuse_localizes_structure_analysis_for_duplicate_document(ap
|
||||
assert target_analysis.dataset_structure_fingerprint == source_analysis.dataset_structure_fingerprint
|
||||
assert target_capability['structure_analysis_id'] == target_analysis.id
|
||||
assert localized.payload_json['capability']['structure_analysis_id'] == target_analysis.id
|
||||
assert 'xfa_structure_analysis_reused' in audit_events
|
||||
|
||||
|
||||
def test_xfa_layout_without_source_analysis_is_not_reused(app):
|
||||
def test_xfa_layout_without_source_analysis_is_not_reused(app, monkeypatch):
|
||||
"""XFA 快照声明 ready 但源 Analysis 缺失时必须重新排队,禁止复制伪 ready 状态。"""
|
||||
app.config['SHIPPING_NOTICE_LAYOUT_MINERU_ENABLED'] = True
|
||||
audit_events: list[str] = []
|
||||
|
||||
def _capture_audit(**kwargs):
|
||||
audit_events.append(str(kwargs.get('event_type')))
|
||||
|
||||
monkeypatch.setattr(
|
||||
'app.services.shipping_notice.audit_service.append_shipping_audit_event',
|
||||
_capture_audit,
|
||||
)
|
||||
with app.app_context():
|
||||
original = _document()
|
||||
source_layout = record_inline_layout_snapshot(original, {
|
||||
@@ -313,6 +332,8 @@ def test_xfa_layout_without_source_analysis_is_not_reused(app):
|
||||
assert scheduled.status == 'queued'
|
||||
assert duplicate.current_layout_version_id is None
|
||||
assert ShippingXfaStructureAnalysis.query.filter_by(document_id=duplicate.id).count() == 0
|
||||
assert 'xfa_structure_analysis_reuse_rejected' in audit_events
|
||||
assert 'xfa_structure_analysis_reparse_queued' in audit_events
|
||||
|
||||
|
||||
def test_layout_parser_fingerprint_change_creates_new_version_without_force(app, monkeypatch):
|
||||
|
||||
Reference in new issue
Block a user