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

@@ -61,7 +61,7 @@ def test_platform_task_definitions_returns_params_schema(client, admin_jwt_heade
assert body['success'] is True
by_type = {item['task_type']: item for item in body['data']}
# 货代库存 RPA:multi_select 库存源字段
rpa = by_type['shipping-inventory-rpa']
rpa = by_type['freight-rpa-onhand']
assert rpa['category'] == 'shipping'
schema_keys = {f['key']: f for f in rpa['params_schema']}
assert schema_keys['source_codes']['type'] == 'multi_select'
@@ -106,7 +106,7 @@ def test_platform_task_options_unknown_source_rejected(client, admin_jwt_headers
def test_validate_task_params_fills_defaults(app):
"""未提供字段应回填注册表默认值。"""
with app.app_context():
result = validate_task_params('shipping-inventory-rpa', {}, check_options=False)
result = validate_task_params('freight-rpa-onhand', {}, check_options=False)
assert result == {'source_codes': []}
result_faq = validate_task_params('faq-aggregate-hot', {}, check_options=False)
assert result_faq == {'app_id': None}
@@ -125,7 +125,7 @@ def test_validate_task_params_rejects_wrong_type(app):
source_code = _enabled_source_code()
with pytest.raises(JobParamsValidationError, match='list of option values'):
validate_task_params(
'shipping-inventory-rpa',
'freight-rpa-onhand',
{'source_codes': source_code},
check_options=False,
)
@@ -137,13 +137,13 @@ def test_validate_task_params_checks_option_range(app):
source_code = _enabled_source_code()
with pytest.raises(JobParamsValidationError, match='not in options'):
validate_task_params(
'shipping-inventory-rpa',
'freight-rpa-onhand',
{'source_codes': ['NOT_A_REAL_SOURCE']},
check_options=True,
)
# 合法值应通过
result = validate_task_params(
'shipping-inventory-rpa',
'freight-rpa-onhand',
{'source_codes': [source_code]},
check_options=True,
)
@@ -154,7 +154,7 @@ def test_validate_task_params_passes_advanced_through(app):
"""_advanced 高级 JSON 区域应原样透传(历史/特殊任务兜底)。"""
with app.app_context():
result = validate_task_params(
'shipping-inventory-rpa',
'freight-rpa-onhand',
{'source_codes': [], ADVANCED_PARAMS_KEY: {'timeout_seconds': 300}},
check_options=False,
)
@@ -175,7 +175,7 @@ def _create_platform_schedule(client, headers, owner_id, *, job_params=None, ext
payload = {
'name': 'contract test',
'schedule_type': 'platform_job',
'platform_api_path': 'shipping-inventory-rpa',
'platform_api_path': 'freight-rpa-onhand',
'owner_user_id': owner_id,
'cron_expr': '0 3 * * *',
}
@@ -365,7 +365,7 @@ def test_faq_job_prefers_job_params_over_dify_agent_id(app):
def test_shipping_rpa_filter_prefers_job_params(app):
"""货代 RPA 应优先按 job_params.source_codes 筛选库存源。"""
from app.services.schedule.shipping_inventory_rpa_job import _filter_sources
from app.services.schedule.freight_onhand_rpa_job import _filter_sources
with app.app_context():
source_code = _enabled_source_code()
@@ -536,7 +536,7 @@ def test_enable_rejects_disabled_platform_job(client, admin_jwt_headers, owner_i
register_platform_job,
)
job_key = 'shipping-inventory-rpa'
job_key = 'freight-rpa-onhand'
original = get_platform_job(job_key)
assert original is not None