"""在途调拨并发参数与单写者约束。 用途:冻结来源并发(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"