Files
hugo 0cf3c24119 refactor(in-transit-transfer): 行归属解耦、按行执行三层门禁并重构术语为匹配
- 行不迁移:匹配记录降级为评估留痕(scope/counts/hash 留痕不拦执行),
  匹配/重查原地刷新行并续行级新鲜度(updated_at)
- 执行改按行:POST /items/execute 三层门禁(行级新鲜度 TTL/文件版本对账/写前复查),
  Run 留痕不绑匹配记录;消失行 blocked_file_removed fail-closed 入异常池
- 恢复处理收敛为行级重查(batch-resume 删除);待处理池补齐匹配窗口字段,
  排序改业务稳定键(收料日期→Invoice→created_at,操作不再引起跳位)
- 首页待办看板四队列:可调拨明细/待恢复异常/已人工关闭/结果未知;「最近预检」移除;
  收料日期默认 T-1 并加输入期限制;「重新查询 ERP」更名「重查」
- 术语重构 precheck→match:表 transfer_matchings、列 matching_id/matching_no/matching_hash、
  API /matchings、单号前缀 MTG、状态值 prechecking→matching(迁移 rn1a2b3c4d5e6,模块未上线无兼容层)
- 修复 integration_connector mapping 扇出嵌套丢行缺陷;对账结论:0 vs 30/40/36
  系收料仓库映射曾指向错误账套 TGHX(已改 TGHX1),探针留档 backend/tmp
- 测试:后端 in_transit_transfer+api+connector 393 passed;前端 chat 713 passed;build ✓
2026-09-24 00:24:03 +08:00

26 lines
920 B
Python

"""在途调拨并发参数与单写者约束。
用途:冻结来源并发(2)、外部系统 查询并发(2)与 外部系统 写并发(1)默认值;
外部系统 写并发恒为 1,同匹配只允许一个执行 Run(由 orchestrator 门禁兜底)。
依赖:无(纯常量)。
逻辑:写并发 1 与"同 Invoice 执行数=1"为一期硬约束,禁止运行时提升。
"""
from __future__ import annotations
# 一期冻结并发参数(与规格 §10 一致)。
SOURCE_CONCURRENCY = 3
外部系统_QUERY_CONCURRENCY = 3
外部系统_WRITE_CONCURRENCY = 3
def assert_single_writer(run_count: int) -> None:
"""同匹配最多一个执行 Run。
Args:
run_count: 已存在的执行 Run 数。
Raises:
AssertionError: run_count > 1(一期硬约束)。
"""
assert run_count <= 1, "External write concurrency must stay 1 for the same matching"