refactor: remove duplicate submission failure helper - #65
Merged
XiaoCow666 merged 1 commit intoSep 19, 2026
Merged
XiaoCow666 merged 1 commit into
XiaoCow666 merged 1 commit into
Conversation
XiaoCow666
approved these changes
Sep 19, 2026
XiaoCow666
left a comment
Owner
There was a problem hiding this comment.
CodeSense 自动评审
核心重构已完成:失败状态更新实现保留在公开函数中,内部两处调用已同步切换,路由层兼容性不受影响。未发现会导致运行失败、行为回归或任务未完成的阻塞问题。
已有验证信息
- PR 提供的检查证据:
pytest -q tests/test_submission_worker.py tests/test_submission_api_queue.py结果为 17 passed, 118 warnings。 - PR 提供的检查证据:
python -m compileall -q tasks/submission_tasks.py通过。 - PR 提供的检查证据:
git diff --check通过。
评审事件:ac890700-b42f-11f1-9bc2-0c81b9c4a7ea
Contributor
Author
|
111 |
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.
变更摘要
本 PR 整理提交评测失败状态的调用路径,删除
_mark_submission_failed仅用于转发的私有包装层,让内部评测流程和路由入口直接调用mark_submission_failed。维护痛点
同一个失败状态转换同时有两个函数名:公开的
mark_submission_failed只转调私有的_mark_submission_failed,而提交评测内部又直接调用私有函数。维护者需要在两个入口之间来回确认,修改失败状态逻辑时也容易遗漏调用路径。改动边界
mark_submission_failed中。_mark_submission_failed。mark_submission_failed。没有改变失败状态、错误提示、数据库提交时机、队列行为、评分、反馈、沙箱或生产配置。
行为保持
失败处理仍然是:查找提交记录,找不到时返回;找到后写入
status='failed'和传入提示,并提交数据库会话。此次只减少一个转发层,没有改变参数或调用顺序。验证命令和结果
使用 Python 3.12.14 隔离环境运行:
结果:
17 passed, 118 warnings in 48.19s。警告为依赖和时间 API 的弃用提示,没有测试失败。结果:通过。
git diff --check结果:通过。
未覆盖范围
本 PR 没有改动 AI provider、C++ 编译和沙箱、Redis/RQ 实现、数据库结构、权限、网络、生产部署或密钥,也没有验证生产环境端到端性能。