""" backend/tests/test_shipping_chat_action_handlers.py 覆盖货代 Chat Action Handler 与业务 workflow 的集成(不依赖 Dify)。 """ from __future__ import annotations from app.services.chat.action_registry import ensure_handlers_loaded, list_action_types def test_legacy_fulfillment_chat_actions_are_not_registered(): """正式 OT 的履约写只能经 Gate API,旧 Chat Turn 不得再有可解析处理器。""" ensure_handlers_loaded() action_types = set(list_action_types()) assert { "shipping.create_batch_from_notices", "shipping.create_batch_from_intakes", "shipping.switch_batch_focus", "shipping.freeze_order", "shipping.generate_excel", "shipping.retry_upload", "shipping.match_inventory", "shipping.confirm_inventory_source", "shipping.mark_manual_uploaded", }.isdisjoint(action_types) def test_legacy_workspace_fulfillment_routes_are_not_registered(app): """正式 OT 只能通过 Gate API 写入,旧直写与转发路由不得回归。""" routes = {str(rule.rule) for rule in app.url_map.iter_rules()} assert { '/api/workspace/shipping-tasks//confirm-inventory-source', '/api/workspace/shipping-tasks//submit-decision', '/api/workspace/shipping-tasks//freeze-order', '/api/workspace/shipping-tasks//match-inventory', '/api/workspace/shipping-tasks//generate-excel', '/api/workspace/shipping-tasks//retry-upload', '/api/workspace/shipping-tasks//retry', '/api/workspace/shipping-tasks//lines//retry', }.isdisjoint(routes)