docs: complete four-part docstrings for gate prefix section (algo #6)

This commit is contained in:
2026-07-17 00:06:35 -04:00
parent 2ab8088c81
commit 0a8e1ad18b
+25 -3
View File
@@ -837,13 +837,21 @@ class _UnitSlot:
cand_infra: bool = False
def resolved(self) -> bool:
"""双臂均已出结果(含 INFRA 判定)。"""
"""双臂均已出结果(含 INFRA 判定)。
返回:
base 臂(结果或 INFRA)与 cand 臂(结果或 INFRA)都已到达时为 True。
"""
base_done = self.base is not None or self.base_infra
cand_done = self.cand_per_q is not None or self.cand_infra
return base_done and cand_done
def excluded(self) -> bool:
"""任一臂 INFRA 即整单元剔除(不入配对)。"""
"""任一臂 INFRA 即整单元剔除(不入配对)。
返回:
base_infra 或 cand_infra 任一为 True 时为 True。
"""
return self.base_infra or self.cand_infra
@@ -870,7 +878,14 @@ class _GateRun:
@classmethod
def from_spec(cls, spec: GateSpec) -> _GateRun:
"""由规格构造初始状态(slots 与阶梯序一一对应)。"""
"""由规格构造初始状态(slots 与阶梯序一一对应)。
参数:
spec: 单题型 gate 规格(units 已阶梯序)。
返回:
计数器归零、slots 逐单元初始化、s_hash 已计算的 _GateRun。
"""
return cls(
spec=spec,
slots=[_UnitSlot(unit=u) for u in spec.units],
@@ -889,6 +904,13 @@ def _advance_prefix(run: _GateRun, params: GateParams) -> None:
契约:全部单元被剔除时 verdict 保持 None、frozen 保持 False,由调度编排层
(Task 3 的 validate_skills_concurrent)检测 verdict None 并 raise
RuntimeError;本函数不负责该终态。
参数:
run: 单题型 gate 运行时状态(原地更新计数器/指针/证据)。
params: e-process 判据阈值组。
返回:
无(所有效果原地写入 run;可重复调用,已消费前缀不重复消费)。
"""
while not run.frozen and run.prefix_ptr < len(run.slots):
slot = run.slots[run.prefix_ptr]