refactor(fudai): 拆出 _handle_in_fudai_detail 详情为None早返回(3687→3663,-24 行)

handle_detail_is_none:detail==None 时清除任务数量标志 + 写完成日志 + 早返回。
新增 3 个单元测试,1068 → 1071 用例全过。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
CodexandClaude Opus 4.7 committed 2026-05-22 02:15:30 +08:00
1 parent 18c6f7b025
commit b6cd3ac8a3
3 files changed
+70 -26

No files matched your search

@@ -6,6 +6,7 @@
from __future__ import annotations
import time
from typing import Any
@@ -68,3 +69,38 @@ def handle_too_many_consecutive_failures(
except Exception:
pass
return True
def handle_detail_is_none(analyser: Any, start_time: float) -> bool:
"""步骤4 入口:detail 为 None 时清除任务数量标志并提前 return。
返回 True 表示已处理 None 分支,主流程应 return。
"""
try:
analyser._log_kv("参与", "详情数据为 None,无法执行参与决策")
except Exception:
pass
try:
analyser._fudai_detail_task_count_from_stage = None
try:
analyser._log_kv(
"福袋详情",
"_handle_in_fudai_detail:清除任务数量标志",
log_type="DEBUG",
)
except Exception:
pass
except Exception:
pass
try:
elapsed = time.time() - start_time
analyser._log_kv(
"流程",
"_handle_in_fudai_detail完成(详情为None)",
elapsed_seconds=round(elapsed, 2),
)
except Exception:
pass
return True