feat(freight-rpa): 批次R解耦编排层并切换 onhand/inbound 契约

将 RPA 编排收编至 freight_rpa,回调迁 /api/freight-rpa/*。
共享目录与 Worker 契约一次切换至 onhand/inbound/upload,
并补 outbound 骨架与 tt16 排程 job key 迁移。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
hugoandCursor committed 2026-10-17 23:18:48 +08:00
1 parent bf3154033b
commit ffc0d4a430
147 files changed
+4221 -2678

No files matched your search

+16 -16
View File
@@ -27,24 +27,24 @@ def test_build_heartbeat_payload_includes_shared_scope_id(monkeypatch):
monkeypatch.delenv("FREIGHT_RPA_WORKER_ID", raising=False)
monkeypatch.setenv("FREIGHT_RPA_SHARED_SCOPE_ID", "hxops-rpa-test-data")
payload = module.build_heartbeat_payload(
trigger_dir=r"C:\HxopsRpaTest\data\inventory_triggers",
drop_dir=r"C:\HxopsRpaTest\data\inventory_drop",
trigger_dir=r"C:\HxopsRpaTest\data\onhand_triggers",
drop_dir=r"C:\HxopsRpaTest\data\onhand_drop",
)
assert payload["shared_scope_id"] == "hxops-rpa-test-data"
assert payload["trigger_dir"] == r"C:\HxopsRpaTest\data\inventory_triggers"
assert payload["capabilities"] == ["inventory_export"]
assert payload["trigger_dir"] == r"C:\HxopsRpaTest\data\onhand_triggers"
assert payload["capabilities"] == ["onhand_export"]
def test_build_heartbeat_payload_receipt_worker_declares_receipt_export(monkeypatch):
"""收料 Worker(*-receipt 或 receipt trigger 路径)须声明 receipt_export。"""
def test_build_heartbeat_payload_inbound_worker_declares_inbound_export(monkeypatch):
"""inbound Worker(*-inbound 或 inbound trigger 路径)须声明 inbound_export。"""
module = _load_freight_rpa_heartbeat_module()
monkeypatch.setenv("FREIGHT_RPA_WORKER_ID", "WIN-RPA-01-receipt")
monkeypatch.setenv("FREIGHT_RPA_WORKER_ID", "WIN-RPA-01-inbound")
payload = module.build_heartbeat_payload(
trigger_dir=r"C:\HxopsRpaTest\data\freight_rpa\receipt\triggers",
drop_dir=r"C:\HxopsRpaTest\data\freight_rpa\receipt\drop",
trigger_dir=r"C:\HxopsRpaTest\data\freight_rpa\inbound\triggers",
drop_dir=r"C:\HxopsRpaTest\data\freight_rpa\inbound\drop",
)
assert payload["capabilities"] == ["receipt_export"]
assert payload["worker_id"].endswith("-receipt")
assert payload["capabilities"] == ["inbound_export"]
assert payload["worker_id"].endswith("-inbound")
def test_resolve_shared_scope_id_from_trigger_path(monkeypatch):
@@ -52,13 +52,13 @@ def test_resolve_shared_scope_id_from_trigger_path(monkeypatch):
monkeypatch.delenv("FREIGHT_RPA_SHARED_SCOPE_ID", raising=False)
monkeypatch.delenv("FREIGHT_RPA_SHARED_SCOPE_ID", raising=False)
monkeypatch.setenv(
"FREIGHT_RPA_SHARED_INVENTORY_TRIGGER_DIR",
r"C:\HxopsRpaTest\data\inventory_triggers",
"FREIGHT_RPA_SHARED_ONHAND_TRIGGER_DIR",
r"C:\HxopsRpaTest\data\onhand_triggers",
)
assert module._resolve_shared_scope_id() == ""
monkeypatch.setenv(
"FREIGHT_RPA_SHARED_INVENTORY_TRIGGER_DIR",
r"C:\mount\hxops-rpa-test-data\inventory_triggers",
"FREIGHT_RPA_SHARED_ONHAND_TRIGGER_DIR",
r"C:\mount\hxops-rpa-test-data\onhand_triggers",
)
assert module._resolve_shared_scope_id() == "hxops-rpa-test-data"
@@ -66,7 +66,7 @@ def test_resolve_shared_scope_id_from_trigger_path(monkeypatch):
def test_write_shared_mount_sentinel_writes_scope_file(tmp_path, monkeypatch):
module = _load_freight_rpa_heartbeat_module()
trigger_dir = tmp_path / "inventory_triggers"
trigger_dir = tmp_path / "onhand_triggers"
trigger_dir.mkdir()
monkeypatch.setenv("FREIGHT_RPA_SHARED_SCOPE_ID", "hxops-rpa-test-data")
module.write_shared_mount_sentinel(trigger_dir=trigger_dir, hostname="WIN-RPA-01")