 CodexandClaude Opus 4.7
|
9423ddbfef
|
refactor(reservation): 拆出回退校验失败二次回退逻辑(853→530,-323 行)
把 attend_window 中"回退校验失败 → 通过映射表二次回退"的 343 行复杂逻辑抽到
attend_window_helpers:
- _resolve_target_pos_via_mapping:通过映射表查找目标位置
- _resolve_current_pos_via_mapping:查找当前位置(必要时重读标题)
- _decide_retry_seek:根据 mapped_pos_diff 决定是否需要纠偏 + 方向提示
- handle_verify_failure_retry_via_mapping:组合调用 → 调用 seek_callback →
根据结果设置/清理锁定期标志 + 写状态文件
新增 8 个单元测试覆盖:seek 成功/失败/异常/无回调 / 各种 mapped_pos_diff 分支。
1330 → 1338 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 05:07:48 +08:00 |
|
 CodexandClaude Opus 4.7
|
27110446c2
|
refactor(reservation): 拆出回退后等待 + 成功/失败日志(937→853,-84 行)
- wait_for_live_room_load_after_back:回退后等待加载完成(钳到 [0.1, 10] 秒)
- log_back_success_pre_verify:回退成功进入校验前的诊断日志
- log_back_failure_and_finish:回退失败的善后(日志 + 写状态文件 + 完成日志)
新增 8 个单元测试,1307 → 1315 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 04:48:04 +08:00 |
|
 CodexandClaude Opus 4.7
|
3192c8b5c7
|
refactor(reservation): 拆出参与窗口入口日志 + 回退回调(988→937,-51 行)
- log_entering_attend_window:写"进入预约参与窗口"诊断日志
- execute_seek_reservation_callback:调用 seek_reservation_room_callback +
前置日志 + 异常吞噬
新增 5 个单元测试,1302 → 1307 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 04:43:27 +08:00 |
|
 CodexandClaude Opus 4.7
|
02e685ba20
|
refactor(reservation): 拆出锁定期同预约位置/窗口复杂检查(1118→988,-130 行)
handle_lock_period_same_reservation_check:把"锁定期内 + 同一预约 + 是否在目标
位置 + 时间窗口"的 139 行复杂逻辑抽到 helper。返回 True/False/None 让主流程
精确控制后续行为:
- True:直接参与
- False:跳过回退
- None:继续走后续时间窗口检查
attend_window.py 跌破 1000 行(988)。
新增 6 个单元测试覆盖各分支组合,1296 → 1302 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 04:39:39 +08:00 |
|
 CodexandClaude Opus 4.7
|
f46f9dc23e
|
refactor(reservation): 拆出时间窗口早返回 + 队列满标志检查(1163→1118,-45 行)
- check_queue_full_immediate_attend:检查队列满立即参与模式
- handle_time_window_early_returns:时间窗口未到/已错过两种早返回(含 cleanup 调度)
新增 7 个单元测试,1289 → 1296 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 04:35:51 +08:00 |
|
 CodexandClaude Opus 4.7
|
feaf555657
|
refactor(reservation): 拆出 attend_window 排序+超时检查(1222→1163,-59 行)
- sort_reservations_with_logging:就地排序 + 前后写日志(含异常吞噬)
- check_total_timeout:超时检查 + 写日志(含异常吞噬)
修复一个真实 bug:拆出 attend_window_helpers.py 时遗漏 import time,导致
check_total_timeout 内的 time.time() 抛 NameError,被外层 try/except 吞噬,
函数永远返回 False。原主文件不存在该 bug。
新增 6 个单元测试(含 import time 缺失场景的 swallow exception 验证),
1267 → 1273 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 04:17:29 +08:00 |
|
 CodexandClaude Opus 4.7
|
89f001e5a4
|
refactor(reservation): 拆出 attend_window 已参与/无效ft/目标日志(1309→1222,-87 行)
- check_already_participated:检测是否已参与过该预约(5s 误差),命中则弹出队头
- discard_invalid_future_ts:future_ts 无效时丢弃队头
- log_target_reservation_details:记录目标预约的 future_ts/value/pos_seen/content
新增 11 个单元测试,1256 → 1267 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 04:10:24 +08:00 |
|
 CodexandClaude Opus 4.7
|
e9e8e322c6
|
refactor(reservation): 拆出 attend_window 等待开奖检查 + 锁定期晋升(1375→1309,-66 行)
- check_waiting_for_reservation_lottery:等待预约福袋开奖时不抢占其他预约
- maybe_promote_locked_reservation:锁定期内把锁定预约移到队头,
若已不在队列则清除锁定期
新增 8 个单元测试,1248 → 1256 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 04:06:28 +08:00 |
|
 CodexandClaude Opus 4.7
|
c7c6c51d20
|
refactor(reservation): 拆出 attend_window 计算+日志辅助(1437→1375,-62 行)
process_reservation_attend_window 中两个互不依赖的子块抽到 attend_window_helpers:
- compute_dynamic_ahead:根据回退步数 + 单步延迟动态计算提前进入参与窗口秒数(纯函数)
- log_attend_window_check_details:输出锁定期 / 时间窗口诊断结构化日志
新增 13 个单元测试覆盖各种边界(零步 / 截断 / 大延迟 / 异常兜底 / 锁定期内外)。
1050 → 1063 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:08:11 +08:00 |
|