feat(shipping-notice): 新增通用解析能力,优化性能并清理遗留废弃代码

This commit is contained in:
hugo committed 2026-08-23 00:27:18 +08:00
1 parent 935bf26fa6
commit 7cfd5d167e
230 files changed
+9337 -10989

No files matched your search

@@ -19,37 +19,10 @@ from app.services.shipping_notice.query_service import (
resolve_task_from_payload,
serialize_task,
task_export_error_message,
task_sort_key,
)
from app.services.shipping_notice.user_facing_status import TOOL_TASK_DATA_OMIT
def test_chat_match_result_payload_uses_unified_actions_only():
"""Chat 匹配结果不得再把旧 action_buttons 作为按钮来源。"""
from app.services.shipping_notice.chat_action_handlers import _match_result_payload
payload = _match_result_payload(
"SN-ACTIONS-ONLY",
{
"data": {
"match_status": "shortage",
"line_results": [],
"shortage": {"lines": []},
},
"action_buttons": [{"id": "legacy_retry"}],
"ui_state": {
"actions": {
"primary": {"code": "open_shortage_review", "enabled": True},
"secondary": [],
},
},
},
)
assert payload["actions"]["primary"]["code"] == "open_shortage_review"
assert "action_buttons" not in payload
def test_get_task_by_ref_supports_task_no_and_numeric_id(app):
"""task_no 与数字主键均应能解析到同一任务。"""
with app.app_context():
@@ -434,7 +407,7 @@ def test_list_my_todos_includes_open_review_case_with_run_deep_link(app):
assert hit['ui_state']['summary']['entry_surface'] == 'review_workbench'
assert hit['ui_state']['lifecycle_stage'] == 'order_review'
assert [entry['state'] for entry in hit['ui_state']['lifecycle_entries']] == [
'available', 'current', 'unavailable', 'unavailable',
'available', 'current', 'unavailable', 'unavailable', 'unavailable',
]
counts = count_my_todos(user.id)