fix: 全面强化运行可靠性与安全边界 - #158
Open
652036 wants to merge 3 commits into
Open
Conversation
统一配置、工作流状态、请求重试与题库存储,防止误报完成、重复提交和数据损坏。补充协议契约与安全回归测试,并完善验证码、日志、打包和 CI 防护。
- main: 删除从未调用的 _prepare_browsers/_discover_cdp,浏览器探测统一由 CaptchaHandler 懒执行;main() 退出时恢复 WB_DATA_DIR/WB_NON_INTERACTIVE - runtime_config: atomic_write_text 移交描述符后不再重复 close;非法 UTF-8 配置报 ConfigError;完整 CDP 配置优先于失效的 browser_path - client: 辅助阶段(题库同步、历史满分读取)网络/协议错误降级为 incomplete 而非整账号失败;finished/分数字段拒收 null、inf/nan、越界值,考试计划 分数非法时 fail-closed;完课后进度按有界退避轮询;远程题库在同一事务 内合并;学校列表错误日志不再回显响应正文 - captcha: WB_CAPTCHA_ROUNDS/ATTEMPTS 非法值安全回退;关闭前校验 origin 后再恢复 localStorage - api: 脱敏正则预编译 - errors: combine() 消息跟随最终状态 - tests: 新增 48 个回归用例(196 passed)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更目的
修复账号任务失败后仍可能显示成功、并发同步覆盖题库,以及验证码流程结束后未正确恢复共享浏览器状态等问题。同时统一配置解析、数据目录和错误处理,方便定位失败原因并重跑未完成的任务。
主要改动
incomplete。考试流程校验试卷和答案记录,保留匹配率及最后一次机会的提交限制。同步阶段的网络错误、空对象和无效数据计为不完整,每次失败只计数一次,登录失效和锁号继续向上传播。使用上的变化
CLI > 环境变量 > 账号配置 > 全局配置 > 默认值。验证
在 Windows、Python 3.12 的项目虚拟环境中完成:
git diff --check:通过。浏览器相关测试使用离线替身;尚未进行真实 CDP、线上账号流程或本地跨平台打包联调。GitHub CI 结果以 PR 检查状态为准。