 CodexandClaude Opus 4.7
|
28f91b2aaf
|
refactor(fudai): 拆出 needswitch 诊断日志(2429→2390,-39 行)
把 run_once_basic 中"needswitch 配置 + 第一个预约详情"的诊断日志(48 行)
抽到 fudai_run_blocks.log_needswitch_check_details。纯日志辅助函数。
新增 2 个单元测试覆盖正常队列与空队列。1146 → 1148 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 03:08:07 +08:00 |
|
 CodexandClaude Opus 4.7
|
970e9043cb
|
refactor(fudai): 拆出"所有预约完成后重置到第一个直播间"块(2460→2429,-31 行)
handle_all_reservations_completed_reset:当队列满等待标志开启且队列已空时,
清除 focus + 按 room_pos 次数下滑回退到第一个直播间(最多 100 次防死循环)。
新增 5 个单元测试,1141 → 1146 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 03:05:18 +08:00 |
|
 CodexandClaude Opus 4.7
|
c6a4d5fb99
|
refactor(fudai): 拆出预约队列状态文件写入(2545→2460,-85 行)
把 run_once_basic 中嵌套的 _write_state 闭包(87 行 JSON 写文件 + 节流)抽到
fudai_run_blocks.write_reservations_state_throttled。原闭包改为单行调用。
新增 3 个单元测试覆盖:1秒节流跳过 / 节流过后写入 / IO 错误吞噬。
1138 → 1141 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 03:02:45 +08:00 |
|
 CodexandClaude Opus 4.7
|
a317b38b25
|
refactor(fudai): 拆出预约触发条件诊断日志(2602→2545,-57 行)
把 run_once_basic 中"预约触发条件诊断 + 跳过原因日志"的 60 行块抽到
fudai_run_blocks.log_reservation_trigger_check。纯日志辅助函数。
新增 4 个单元测试覆盖:disabled / 空队列 / 正常队列 / 超过 3 项截断。
1134 → 1138 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:59:35 +08:00 |
|
 CodexandClaude Opus 4.7
|
3473e2bd5e
|
refactor(fudai): 拆出 just_recorded_reservation + skip_stage_diagnosis 早返回(2661→2602,-59 行)
把 run_once_basic 中两个互相独立的早返回块抽到 fudai_run_blocks:
- handle_just_recorded_reservation:刚记录预约后按 needswitch 决定是否上滑切换
- handle_skip_stage_diagnosis:跳过阶段检测标志触发时直接查找福袋
新增 7 个单元测试,1127 → 1134 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:56:49 +08:00 |
|
 CodexandClaude Opus 4.7
|
41fc4ecbe0
|
refactor(fudai): 拆出首次运行清空预约队列块(2783→2661,-122 行)
把 run_once_basic 中"首次运行清空预约队列与写空状态文件"的 130 行块抽到
fudai_run_blocks.maybe_clear_reservation_queue_on_first_run:
- 首次运行:清空 reservations / 写空状态文件 / 标记 _first_run_once_basic=False
- 非首次:仅记录日志保持当前队列
新增 4 个单元测试覆盖:首次清空 / 非首次保持 / 无 state_path 兜底 / 日志异常吞噬。
1123 → 1127 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:53:46 +08:00 |
|
 CodexandClaude Opus 4.7
|
e6da24c2a6
|
refactor(fudai): 拆出截图重试块(2822→2783,-39 行)
把 run_once_basic 中 '截图 + 重试 + 失败诊断日志' 的 45 行块抽到
fudai_run_blocks.take_screenshot_with_retries:
- 失败时自动写入完整诊断日志(含 reservation flags / room_pos 等)
- 返回 (ok, elapsed);ok=False 时主流程直接 return
新增 4 个单元测试覆盖:首次成功 / 二次成功 / 全失败写诊断 / get_screenshot 抛错。
1119 → 1123 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:49:36 +08:00 |
|
 CodexandClaude Opus 4.7
|
6cf3ce9a72
|
refactor(fudai): 拆出 IN_LIVE_ROOM + RECOMMEND_PAGE stage 处理(2915→2822,-93 行)
把 run_once_basic 中两个 stage 分支抽到 fudai_run_blocks:
- handle_in_live_room_stage:等待福袋加载(如刚切换)+ 查找福袋
- handle_recommend_page_stage:点击直播页 + 进入直播间(连点两次)
新增 5 个单元测试覆盖:刚切换 / 未切换 / 点击失败回退 / 完成日志。
1114 → 1119 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:46:21 +08:00 |
|
 CodexandClaude Opus 4.7
|
992db1e161
|
refactor(fudai): 拆出 4 个 stage 弹窗/结束分支(2975→2915,-60 行)
把 run_once_basic 中 4 个 stage 分支抽到 fudai_run_blocks:
- handle_coupon_popup_stage:优惠券弹窗按返回键
- handle_shopping_redpacket_popup_stage:购物红包弹窗点击关闭
- handle_lottery_result_stage:开奖结果 OCR 识别 + 处理或回退
- handle_live_closed_stage:直播结束下滑切换
新增 7 个单元测试覆盖每个分支主路径 + 异常吞噬。1107 → 1114 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:43:10 +08:00 |
|
 CodexandClaude Opus 4.7
|
1604ad1904
|
refactor(fudai): 拆出 FANSCLUB_JOIN stage 处理(3135→2975,-160 行)
把 run_once_basic 中 FANSCLUB_JOIN 分支(166 行)抽到
fudai_run_blocks.handle_fansclub_join_stage:
- 主路径:点参与按钮 + 2 次预设位置 + 关详情
- 异常路径:按 auto_join_fansclub 决定重试或等待 15s + 按 fansclub_fail_action 决定切换
douyin_fudai.py 终于跌破 3000 行(2975)。
新增 5 个单元测试覆盖:正常路径 / 自动加入重试 / 等待手动 / 失败切换 / 完成日志。
1102 → 1107 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:39:50 +08:00 |
|
 CodexandClaude Opus 4.7
|
878a4c2fd9
|
refactor(fudai): 拆出锁定期跳过搜索块(3181→3135,-46 行)
把 _handle_live_room_has_or_not_fudai 中锁定期内时间窗口未到的早返回块抽到
fudai_detail_blocks.should_skip_search_in_lock_period:
- 检查 focus_until + queue_full_waiting + 队头预约时间窗口三者
- 若都满足跳过条件,记录日志后返回 True
新增 6 个单元测试覆盖各种边界(无锁定期 / 队列未满 / 队列空 / 窗口已开始 /
窗口未开始 / 无效 ft)。1096 → 1102 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:35:39 +08:00 |
|
 CodexandClaude Opus 4.7
|
9c823f4874
|
refactor(fudai): 拆出参与成功后善后逻辑(3334→3181,-153 行)
把 _handle_in_fudai_detail 中参与成功分支的善后动作抽到 fudai_detail_blocks:
- handle_reservation_post_attend:清/延锁定期 + 移除完成的预约 + 重排队列
- close_detail_after_successful_attend:按 _detail_closed_by_attend 决定是否点返回键
- reset_fudai_detail_state_after_attend:清除 first_read / last_tuple / task_count 标志
主流程的参与成功分支从 ~180 行简化到 ~25 行。
新增 8 个单元测试覆盖:pending=False 跳过 / 无其他预约清 focus / 有其他预约设
保护期 / 移除已完成预约 / detail 已关闭跳过点返回 / 状态标志重置等。
1088 → 1096 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:32:39 +08:00 |
|
 CodexandClaude Opus 4.7
|
c5f2bbee9c
|
refactor(fudai): 拆出 task_count_zero 错误分支(3502→3334,-168 行)
把 _handle_in_fudai_detail 中 'last_status==error 且 reason==task_count_zero'
的 165 行处理逻辑抽到 fudai_detail_blocks.handle_task_count_zero_error:
- 累加 _fudai_detail_consecutive_failures 计数
- 第 3 次连续失败:关闭详情 + 强制切换直播间(含 ADB swipe 兜底)+ 重置计数
- 单次失败:清除任务数量标志后跳过本次
新增 6 个单元测试覆盖:第 1/3 次失败 / needswitch 开关 / status 不匹配 /
extra 不是 dict 等边界。1082 → 1088 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:26:18 +08:00 |
|
 CodexandClaude Opus 4.7
|
17f1977a65
|
refactor(fudai): 抽出 _handle_in_fudai_detail 通用清理 + 状态分支(3632→3502,-130 行)
发现 _handle_in_fudai_detail 中有 4 个分支重复着同一套清理动作:
'清除任务数量标志 → 写完成日志 → return'
抽出两个辅助函数到 fudai_detail_blocks:
- cleanup_and_log_completion:通用清理 + 完成日志(取代原 30+ 行重复代码块)
- handle_status_based_early_return:根据 _last_fudai_detail_status 分发到
优惠券弹窗 / 观看任务 / 验证失败三个分支(error 分支因含 ADB 调用与计数
逻辑较复杂,留在主流程)
应用到 4 处早返回:coupon_popup / watch_task / validation_failed / 验证失败 / 无效详情。
新增 9 个单元测试覆盖各分支与边界,1073 → 1082 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:22:16 +08:00 |
|
 CodexandClaude Opus 4.7
|
2d971ca7d8
|
refactor(fudai): 拆出 _handle_in_fudai_detail 数据验证失败善后(3663→3632,-31 行)
handle_validation_failure_cleanup:步骤2 数据验证失败时关闭详情页 + 写日志 +
清除任务数量标志(与 detail_is_none 共享同一套清理动作)。
新增 2 个单元测试覆盖正常路径与 close 异常分支,1071 → 1073 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:18:08 +08:00 |
|
 CodexandClaude Opus 4.7
|
b6cd3ac8a3
|
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>
|
2026-05-22 02:15:30 +08:00 |
|
 CodexandClaude Opus 4.7
|
18c6f7b025
|
refactor(fudai): 拆出 _handle_in_fudai_detail 失败计数子块(3732→3687,-45 行)
把 _handle_in_fudai_detail 中连续参与失败次数过多的早返回块抽到
fudai_detail_blocks.handle_too_many_consecutive_failures:
- 检查 _consecutive_attend_failures 是否超阈值
- 关闭详情页 → 按 needswitch 决定切换 → 重置计数器
- 返回 True 让主流程 return
新增 5 个单元测试覆盖阈值边界 / 切换开关 / 异常兜底,1063 → 1068 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:11:44 +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 |
|
 CodexandClaude Opus 4.7
|
189d24255d
|
refactor(stage): 拆出 douyin_stage 日志格式化辅助(1385→1284,-101 行)
diagnose_stage_from_current_screen 中并行检测后的详细日志记录块(108 行)
是纯日志格式化逻辑,依赖 pixel_state / pixel_details,不修改业务状态。
拆到 douyin_stage_helpers:
- _format_detail_log_fields:单 detail 字典 → 日志字段映射
- log_pixel_detection_details:遍历 pixel_details 写日志(含 has_fudai_detail
的 task_count 矛盾告警)
- summarize_pixel_state:pixel_state 摘要写一行日志
新增 12 个单元测试覆盖纯函数行为,1038 → 1050 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:04:10 +08:00 |
|
 CodexandClaude Opus 4.7
|
20e48d6a51
|
refactor(fudai): 拆出粉丝团门槛分支到独立模块(1629→577,-1052 行)
attend_choujiang 中加入粉丝团门槛分支占了 1057 行(520-1576),
内含 OCR 识别按钮位置 + 多次点击 + 详情页恢复递归等复杂逻辑。
该分支只依赖 analyser 和 attend_button_text 两个参数,自包含性强。
整段提取到 douyin/fudai/core/fudai_attend_fansclub.handle_fansclub_branch,
原方法只剩 elif 调用。粉丝团模块本身是 1075 行,但与其他分支解耦后
未来可针对粉丝团逻辑做独立优化、独立测试。
冒烟测试覆盖 import + 签名 + 公开 API,1034 → 1038 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 01:59:09 +08:00 |
|
 CodexandClaude Opus 4.7
|
053ffa3469
|
refactor(gui): 拆出 mapping_table.py 5 个 UI 辅助子函数(659→482,-177 行)
mapping_table.create_mapping_tab 是单个 632 行的 tkinter 闭包巨型函数,
把其中相对独立的 5 个块抽到 mapping_table_helpers:
- open_entry_detail_window:弹出条目详情(原代码出现 2 次)
- compute_card_layout:根据画布宽度计算列数和卡片宽度
- set_card_bg:批量切换 widget + 子 widget 背景色
- make_card_event_handlers:单卡片的 click/dbl/enter/leave 处理器工厂
- render_card_labels:渲染单卡片内的 title + meta + body label
逻辑保持等价,只是提取闭包消除重复嵌套。新增 8 个单元测试覆盖
compute_card_layout / API 表面,1026 → 1034 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 01:51:52 +08:00 |
|
 CodexandClaude Opus 4.7
|
0bdc378252
|
refactor(fudai): 拆出 run_once_basic 4 个独立子块(4121→3732,-389 行)
把 run_once_basic 中互相独立的 4 个块抽到 fudai_run_blocks:
- handle_waiting_for_lottery_result(等待开奖期间的持续 OCR 检测)
- handle_no_attend_timeout(30 分钟未参与超时回到推荐页)
- handle_desktop_recovery(误返回桌面后的自救路径)
- handle_high_value_room_revisit(高价值房间重访检查)
每个函数返回 bool:True=主流程应 return,False=继续下一阶段。
原方法只剩调用 + 早返回,可读性大幅提升。
新增 13 个单元测试覆盖 4 个块的核心分支,1013 → 1026 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 01:40:23 +08:00 |
|
 CodexandClaude Opus 4.5
|
66eb05e6b1
|
补 reservation_logic.cleanup_validate 子模块单元测试(+10 用例)
- validate_back_to_reservation / cleanup_expired_reservations 函数签名验证
- reservation_logic 全部 6 个子模块存在性测试
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-22 01:22:56 +08:00 |
|
 CodexandClaude Opus 4.5
|
5a40b49727
|
补 douyin_yanghao_pkg 剩余子模块单元测试(+7 用例)
- _scaled_click / _do_comment 函数签名验证
- douyin_yanghao_pkg 全部 3 个子模块存在性测试
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 22:48:38 +08:00 |
|
 CodexandClaude Opus 4.5
|
266c7f2932
|
补 underlying_operations_pkg 剩余子模块单元测试(+14 用例)
- analyse_pic_digits / _swipe_with_sendevent_improved 函数签名验证
- underlying_operations_pkg 全部 10 个子模块存在性测试
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 22:45:46 +08:00 |
|
 CodexandClaude Opus 4.5
|
59ac6a3abc
|
补 flow_control_pkg + orchestrator_pkg 子模块单元测试(+12 用例)
- find_and_open_fudai_detail 函数签名验证
- read_fudai_detail_once / read_fudai_detail_with_retries 函数签名验证
- flow_control_pkg / orchestrator_pkg 子模块存在性测试
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 22:42:58 +08:00 |
|
 CodexandClaude Opus 4.5
|
df628c11dd
|
补 douyin_fudai_finder_pkg 子模块单元测试(+15 用例)
- FudaiClickExecutor / FudaiDetailVerifier / FudaiImageAcquirer 类存在性验证
- check_have_fudai_with_ready_screenshot_optimized 函数签名验证
- douyin_fudai_finder_pkg 子模块存在性测试
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 22:38:43 +08:00 |
|
 CodexandClaude Opus 4.5
|
6996c7813e
|
补 screenshot_manager 子模块单元测试(+17 用例)
- _sanitize_filename_part 纯函数测试(无效字符/中文/路径)
- save_files / save_image 函数签名验证
- screenshot_manager 子模块存在性测试
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 22:28:26 +08:00 |
|
 CodexandClaude Opus 4.5
|
0efcfff545
|
补 reservation/core + fudai_modules 模块单元测试(+21 用例)
- format_reservation_context / validate_reservation_item 纯函数测试
- fudai_modules Mixin 类存在性验证
- reservation/core 包导入测试
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 22:24:15 +08:00 |
|
 CodexandClaude Opus 4.5
|
b0eccc5171
|
补 bin 模块单元测试(+19 用例)
- format_size / get_log_base_names 纯函数测试
- parse_args 命令行参数解析测试
- manage_logs / run_cli 函数签名验证
- bin 子模块存在性测试
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 22:21:03 +08:00 |
|
 CodexandClaude Opus 4.5
|
e8bf904fc6
|
补 douyin/stage 模块单元测试(+23 用例)
- diagnose_stage_from_current_screen 函数签名验证
- StageHandler 类方法检查
- stage_handler_pkg shim 与子模块导出一致性验证
- stage 子模块存在性测试
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 22:17:54 +08:00 |
|
 CodexandClaude Opus 4.5
|
8d98143df1
|
补 douyin/core 模块单元测试(+24 用例)
- io_utils 纯函数测试(_verify_png_integrity/_ensure_parent_dir/_safe_replace_file)
- path_config 路径配置函数测试
- version 版本信息格式验证
- flow_control shim 与子模块导出一致性验证
- core 子模块存在性测试
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 22:15:34 +08:00 |
|
 CodexandClaude Opus 4.5
|
b5a15ecea4
|
补 douyin/other 模块单元测试(+28 用例)
- _normalize_room_title 纯函数测试(空格/数字/中文)
- high_value_room / popups / lottery 函数签名验证
- yanghao shim 与子模块导出一致性验证
- other 子模块存在性测试
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 22:12:54 +08:00 |
|
 CodexandClaude Opus 4.5
|
73008a9763
|
补 douyin/reservation 模块单元测试(+23 用例)
- _compact_text 纯函数测试(空格/中文/边界值)
- match_reservation / validate_back_to_reservation 函数签名验证
- reservation_handler shim 与子模块导出一致性验证
- reservation 子模块存在性测试
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 22:09:35 +08:00 |
|
 CodexandClaude Opus 4.5
|
5309aa0198
|
补 douyin/fudai 模块单元测试(+20 用例)
- is_abnormal_time_value 纯函数测试(边界值/异常值)
- validate_fudai_detail 函数签名验证
- fudai_detail shim 与子模块导出一致性验证
- fudai/core 子模块存在性测试
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 22:07:15 +08:00 |
|
 CodexandClaude Opus 4.5
|
85d7bb2525
|
补 douyin/detection/pixel 模块单元测试(+14 用例)
- pixel/popups 弹窗检测函数签名验证
- pixel/buttons 按钮检测函数签名验证
- pixel/stage 阶段检测函数签名验证
- shim 与子模块导出一致性验证
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 22:03:35 +08:00 |
|
 CodexandClaude Opus 4.5
|
3269d3adf6
|
补 gui/components 模块单元测试(+22 用例)
- log_color_config 纯函数测试(get_operation_type/get_color_config)
- mapping_utils 纯函数测试(_format_timestamp)
- gui/components 子模块存在性验证
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 22:00:02 +08:00 |
|
 CodexandClaude Opus 4.5
|
7ef5bc3e07
|
补 douyin/logging 模块单元测试(+30 用例)
- log_formatter 纯函数测试(format_debug_log/action_log/error_log 等)
- PerformanceTracker 类测试
- logging 子模块存在性验证
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 21:56:43 +08:00 |
|
 CodexandClaude Opus 4.5
|
2c8879be7a
|
补 douyin/fudai/core 模块单元测试(+14 用例)
- validate_coords 纯函数测试(边界/修正/无效坐标)
- safe_image_load 函数测试
- fudai/core 子模块存在性验证
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 21:53:47 +08:00 |
|
 CodexandClaude Opus 4.5
|
6ecedbbde1
|
补 douyin/handlers 模块单元测试(+13 用例)
- _adb_path 纯函数测试(环境变量、引号处理、operation 对象)
- SwipeHandler / PopupHandler / ScreenshotHandler 类存在性验证
- swipe_ops 函数签名检查
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 21:50:02 +08:00 |
|
 CodexandClaude Opus 4.5
|
cdf8be0ded
|
补 operations 模块单元测试(+18 用例)
- OCR 缓存机制测试(cache_get/put/clear/stats)
- _img_fingerprint 哈希函数测试
- screenshot_operations / screenshot_service 类存在性验证
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 21:42:39 +08:00 |
|
 CodexandClaude Opus 4.5
|
a6dee879e7
|
补 tools/dev/bump_version.py 单元测试(+10 用例)
- parse_semver 纯函数测试(含边界/异常)
- compute_next 版本号递增测试
- 集成测试:连续 bump 验证
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 21:37:19 +08:00 |
|
 CodexandClaude Opus 4.5
|
9f7e8da57a
|
补 reservation_handler_pkg / stage_handler_pkg 单元测试(+12 用例)
- 验证 shim 与 pkg 导出一致性
- Handler 类方法签名检查
- 子模块导入测试
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 21:25:50 +08:00 |
|
 CodexandClaude Opus 4.7
|
6bdf7b2527
|
补 5 个剩余子包的综合测试(test_remaining_pkgs.py +20 用例)
覆盖 5 个之前没专门测试的拆分子包,每个写"API 兼容 + 不抛异常"级别的测试
(业务函数依赖大量 analyser 状态 + 真实截图,深度业务测试留给端到端):
- detection_pkg
+ _ensure_detection_cache 创建 _detection_cache 与 _detection_cache_ttl
+ _ensure_detection_cache 多次调用幂等(不覆盖既有 cache)
+ 4 个对外 API callable
- fudai_detail_orchestrator_pkg
+ read_fudai_detail_once / _with_retries 可调用
+ 兼容 shim 与子包指向同一函数对象
- logging_wrapper_pkg.misc
+ log_step_time / log_error_with_context / log_performance_step /
log_debug_info 不抛异常
+ get_performance_stats 返回 dict
- flow_control_pkg
+ 4 个对外 API callable
+ 兼容 shim 与子包指向同一函数对象
- detect_by_template (module-level)
+ 签名 (analyser, rx, pic, region) 正确
+ FudaiDetector.detect_by_template 类方法仍可调用(forwarding)
- underlying_operations_pkg 第二轮新增
+ save_reward_pic / set_clipboard_text / _swipe_with_sendevent_improved /
select_device / analyse_pic_digits 可调用
+ set_clipboard_text 空文本短路返回 False(不调用 ADB)
回归:
- 全套 627 → 647(+20 用例)
- 全部 647 passed in 19s
- compileall exit 0
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 21:04:14 +08:00 |
|
 CodexandClaude Opus 4.7
|
af8145b8a8
|
补 fudai_filter_pkg / logging_pkg 单元测试 + 修 monitor 缺 datetime import
新增测试:
- test_fudai_filter_pkg (24)
覆盖 helpers / should_skip / join_decision 三个子模块
含 _is_short_countdown_text / is_watch_task_fudai / check_contain
+ should_skip_fudai_by_config 5 个业务场景断言(高价值通过 / 观看任务跳过 /
低价值跳过 / 黑名单跳过 / 单间模式必参)
- test_logging_pkg (22)
覆盖 _common 全局状态 + handlers 类构造 + cleanup 纯函数边界 + monitor
类构造 + config 全部对外 API(get_logger 缓存 / get_caller_info /
format_exception_info / LogContext / log_function_call 装饰器)
修复 1 个真实回归 bug:
- douyin/logging/douyin_logging_pkg/monitor.py 缺 from datetime import datetime
(原文件用的是 from datetime import datetime, timedelta;拆分时只写了
import 模块导致 datetime.now() 抛 NameError)
修复后 LogRotationMonitor 可正常构造
回归:
- 全套 581 → 627 (+46 用例)
- 全部 627 passed in 22s
- compileall exit 0
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 21:01:15 +08:00 |
|
 CodexandClaude Opus 4.7
|
e417acfb7c
|
为 10 个已拆出的子包补单元测试(+226 用例)
新增 tests/ 下 10 个测试文件,把已拆出的子包从"被外部测试间接覆盖"提升到
"独立可测":
- test_web_gui_pkg (52)
覆盖 logger / ansi / adb_compat / nested / stats_helpers
含 _wg_log/_LOGGER 日志、ANSI 清理、点号路径、_parse_countdown_seconds 等
- test_underlying_operations_pkg (35)
覆盖 adb_helpers / bounds / countdown / ocr_content / pic_path
含 _adb_path 环境变量覆盖、check_countdown 多种格式、OCR 字符纠错
- test_reservation_logic_helpers (21)
覆盖 helpers.py 5 个纯函数(_now_ts / _normalize_room_title /
_calculate_string_similarity / _extract_content_core /
_sort_reservations_inplace 排序稳定性)
- test_screenshot_manager_pkg (47)
覆盖 paths.get_category_for_picname(5 类关键词分类)+
get_latest_attempt_path / get_last_success_path(按 operation_type 路径推断)
+ 异步计数器
- test_gui_core_pkg (13)
覆盖 RunParams dataclass 28 字段构造 + adb 函数 + read_config / write_config
roundtrip
- test_fudai_core_pkg (17)
覆盖 _FudaiOcrExecutorState 单例 + _get_fudai_ocr_executor 缓存复用 + 11
个 thin_wrappers 与原实现等价行为
- test_handler_shells (8)
覆盖 ReservationHandler / StageHandler / LoggingWrapper 三个薄壳类的
staticmethod forwarding 完整性
- test_yanghao_pkg (14)
覆盖 _yanghao_log(_log_kv 优先 + logger fallback + broken analyser
兜底 + 未知 level 不抛)+ yanghao_get_recommend_seconds 默认值
- test_pixel_common (6)
覆盖 _safe_open_screenshot_rgb 用 tmp_path 构造合法/损坏/截断/RGBA PNG
- test_fudai_finder_pkg (13)
覆盖 5 个类(FudaiImageAcquirer / FudaiDetector / FudaiClickExecutor /
FudaiDetailVerifier / FudaiFinder)实例化与组合关系,verify
detect_by_template 类方法签名仍兼容(拆出后)
回归:
- 全套测试 355 → 581(+226 用例)
- 全部 581 passed / 1 skipped in 27s
- 新拆出的 12 个子包现在都有专门的单元测试覆盖
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 20:54:35 +08:00 |
|
 CodexandClaude Opus 4.7
|
e35e8a85bd
|
建立版本管理体系:CHANGELOG + bump 脚本 + pyproject 元数据 + 一致性测试
新增:
- CHANGELOG.md:Keep a Changelog 1.1.0 格式,回填 V3.0.0–V3.3.3 历史
- tools/dev/bump_version.py:一键 bump major/minor/patch,
同步 version.py / pyproject.toml / CHANGELOG.md,并创建 git tag。
支持 --dry-run / --no-tag。
- tests/test_version_consistency.py:9 个用例确保
version.py、pyproject.toml、CHANGELOG.md 三处版本号一致
修改:
- pyproject.toml 加 [project] 元数据,version=3.3.3(PEP 440 形式,
与 douyin/core/version.py 同步;后者带 V 前缀,是单一事实来源)
后续会给 V3.0.0 → V3.3.3 补打 git tag。
回归:353 个 pytest 用例通过;bump_version dry-run 三种模式(patch/minor/major/set)
全部输出正确。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 15:17:56 +08:00 |
|
 CodexandClaude Opus 4.7
|
778c021272
|
tests: 新增 param_usage_tracker 单元测试 (13 用例)
douyin/utils/param_usage_tracker:
- track_param:写一条 / extra 字段合并 / 多次 append / unrepresentable 值兜底
- track_call 装饰器:参数记录 / include_args=False / 保留 __name__ /
异常正常传播 / kwargs 记录
- read_entries:文件不存在 / 读回写入内容 / limit 限制 / 跳过坏行
用 monkeypatch 把 _get_log_path 重定向到 tmp_path,避免污染 state/。
回归:tests/ 344 passed / 1 skipped。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 15:11:54 +08:00 |
|
 CodexandClaude Opus 4.7
|
ca4941b66d
|
tests: 新增 ActionLogger + track_action 装饰器测试 (10 用例)
douyin/logging/action_logger:
- ActionLogger 5 个 log_* 方法:log_step / log_operation / log_decision /
log_state_change / log_ocr,覆盖带/不带 elapsed、含 kwargs 等场景
- log_operation 大量 kwargs 不应导致格式化失败
- track_action 装饰器:透传返回值、默认用函数名、异常正常传播、kwargs 透传
回归:tests/ 331 passed / 1 skipped。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 15:02:08 +08:00 |
|
 CodexandClaude Opus 4.7
|
7d31075ce3
|
tests: 新增 PerformanceTracker 单元测试 (13 用例)
douyin/logging/performance_tracker.PerformanceTracker 6 个方法:
- start_timer/end_timer:基本时长测量、未知 id 返回 0、二次 end 幂等
- get_elapsed:进行中 / 未知 / end 后的行为
- track_function:装饰器透传值 + 记录时长 + 异常路径仍记录
- track_step:自定义 name 记录
- get_statistics:空 / 多次平均
回归:tests/ 321 passed / 1 skipped。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 14:56:56 +08:00 |
|