From 3b600c9f64030f3f913cb4a6ef272f81d79117cb Mon Sep 17 00:00:00 2001 From: Codex Date: Fri, 22 May 2026 10:27:21 +0800 Subject: [PATCH] =?UTF-8?q?fix(reservation):=20=E8=A1=A5=20=5FRESERVATION?= =?UTF-8?q?=5FERROR=5FUTILS=5FAVAILABLE=20import=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E6=97=B6=20NameError?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit attend_window.py 中 9 处使用 _RESERVATION_ERROR_UTILS_AVAILABLE 标志, 但 import 语句只导入了 ReservationItem / format_reservation_context / log_reservation_error / safe_write_state,没有导入这个标志。 发现路径:尝试为该文件提取 helper 时,stub 测试触发到第 360 行的 "future_ts 无效"分支,立即抛出 NameError。 原代码中此分支被 try/except 覆盖的概率较高(外层 try 会吞噬), 但只要执行流落在 line 64/95/113/167/296/360/371/...(共 9 处) 任意一个 if 判断上,就会 NameError。 修复:把 _RESERVATION_ERROR_UTILS_AVAILABLE 加入 ._common 的 import 列表。 验证: - stub 测试通过 - pytest 1013 passed Co-Authored-By: Claude Opus 4.7 (1M context) --- douyin/reservation/reservation_logic/attend_window.py | 1 + 1 file changed, 1 insertion(+) diff --git a/douyin/reservation/reservation_logic/attend_window.py b/douyin/reservation/reservation_logic/attend_window.py index 4f17897..6d75763 100644 --- a/douyin/reservation/reservation_logic/attend_window.py +++ b/douyin/reservation/reservation_logic/attend_window.py @@ -11,6 +11,7 @@ from typing import Any, Callable, Dict, List, Optional from ._common import ( ReservationItem, + _RESERVATION_ERROR_UTILS_AVAILABLE, format_reservation_context, log_reservation_error, safe_write_state,