feat: add submission evaluation lifecycle logs - #63
Merged
XiaoCow666 merged 2 commits intoSep 19, 2026
Merged
Conversation
XiaoCow666
requested changes
Sep 19, 2026
XiaoCow666
left a comment
Owner
There was a problem hiding this comment.
CodeSense 自动评审
评测成功和异常路径已记录生命周期日志,但公开体验会话失效时仅记录 started 后直接返回,缺少终态事件,生命周期日志不完整。
需要先处理的问题
tasks/submission_tasks.py:demo_run_id无法激活时,任务在记录event=started后直接返回,既没有finished、failed也没有明确的跳过终态;该路径会产生无法判断最终结果的生命周期记录,未完成本 PR 的生命周期可观测性目标。
请按下面的步骤修改
- 位置:
tasks/submission_tasks.py的_evaluate中if demo_run_id and not activate_demo_run(demo_run_id)分支;现在:记录 started 后直接返回,缺少可识别的终态日志;改成:返回前记录一个终态事件(例如event=skipped)并包含明确的会话失效原因,确保每个已开始的评测都有终态;交给 AI:请执行该修改,并为体验会话失效路径补充断言终态日志的测试,然后运行pytest tests/test_submission_worker.py。
合并后可以继续改进的地方
- 日志辅助函数的文档称信号为“bounded”,但
**fields未在函数内限制长度或字段数量;当前调用方传入的是受控短字段,暂无实际风险。 - 现有测试只覆盖成功完成时的 started/finished 日志,未覆盖异常和体验会话失效等终态分支。
已有验证信息
- PR diff 中新增了
tests/test_submission_worker.py对成功路径 started/finished 日志及 elapsed_ms 的断言。 - 事件未提供 CI 或本地测试实际执行结果。
评审事件:8e7cc870-b428-11f1-87de-7ef619082ed1
XiaoCow666
approved these changes
Sep 19, 2026
XiaoCow666
left a comment
Owner
There was a problem hiding this comment.
CodeSense 自动评审
PR 已为提交评测增加 started、skipped、finished、failed 生命周期日志,并覆盖了体验会话失效和正常完成的关键路径。未发现会导致安全风险、数据损坏、明显回归或无法运行的阻塞问题。
合并后可以继续改进的地方
- 失败事件目前没有对应的自动化测试;可补充一个强制评测异常的场景,断言会记录 event=failed、error_type 和 elapsed_ms,以防后续改动遗漏失败可观测性。
- 日志字段通过空格拼接输出;当前传入字段均为受控值,但若未来加入含空白字符或敏感信息的字段,建议改用结构化日志或统一字段清洗。
已有验证信息
- PR diff 中新增 test_expired_demo_run_emits_terminal_skipped_event,验证 started 和 demo_run_unavailable 的 skipped 事件。
- PR diff 中扩展 test_formal_worker_updates_submission_in_isolated_database,验证 started、finished、submission_id、state=evaluated 与 elapsed_ms。
- 事件材料未提供实际测试执行结果。
评审事件:ff5d9290-b428-11f1-9c3f-14a49f60ec63
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.
No description provided.