Skip to content

feat: add explainable adaptive learning recommendations - #55

Open
Swan1127 wants to merge 1 commit into
XiaoCow666:mainfrom
Swan1127:codex/adaptive-learning-foundation
Open

Swan1127 wants to merge 1 commit into
XiaoCow666:mainfrom
Swan1127:codex/adaptive-learning-foundation

Conversation

@Swan1127

Copy link
Copy Markdown
Contributor

Summary

  • Add a deterministic, explainable next-step recommendation to the student home page.
  • Prioritize resumable guided sessions, practiced weak knowledge points, unmet submissions, then unstarted current assignments.
  • Keep Phase 1 read-only: no new API, persistence, AI call, schema migration, permission change, or deployment configuration.

Validation

  • tests/test_adaptive_learning.py, tests/test_student_home_history.py, and tests/test_session_lifecycle_routes.py: 14 passed.
  • compileall for the changed Python files and git diff --check: passed.
  • Full pytest was run twice in an isolated Python 3.13 environment. The second run had 686 passed and one existing order/environment-sensitive RQ worker test; that test passed when rerun alone. Details and fact/inference boundaries are in the included Phase 1 plan.

Risk boundaries and rollback

  • Recommendations only use already-authorized, current-assignment data and server-generated existing routes.
  • Output excludes code, feedback, AI text, session dialogue, and student identifiers.
  • Revert commit 8813e59 to remove the feature; no data cleanup or migration is required.

Please review the deterministic thresholds and the read-only boundary before advancing to a persistence or teacher-override phase.

@XiaoCow666 XiaoCow666 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

结论:需要修改两项。仅审查了提供的 diff,未执行工具、测试或仓库代码;PR 中的测试结果属于贡献者报告,尚未独立验证。

1. [P2] 复练建议可能引用已被后续成功提交取代的失败记录

位置:services/adaptive_learning.py_retry_plan()

当前循环跳过成功提交后,仍会选择同一作业更早的失败提交。例如输入按时间倒序为“作业 A 得分 90、作业 A 得分 40”,函数会推荐复练 A,并将 40 分描述为“最近一次有效评测”。这会向已经通过的学生展示错误依据。

请打开该函数,把“逐条寻找失败记录”改为“每个作业只判断最近一次有效评测,再从尚未达标的作业中选择推荐”;明确输入排序约定,避免旧失败覆盖新成功。在 tests/test_adaptive_learning.py 增加“同一作业先失败后成功不推荐复练”和“最新评测仍失败时推荐复练”的回归用例,然后运行 python -m pytest tests/test_adaptive_learning.py -q 验证。

2. [P2] 阶段五任务台缺少必需的具体交付证据

位置:TASK CONTEXT 的 problem_goalreproduction_evidenceplanned_changeslearning_summaryverification_result 均为空,task_modeproject_area 也未填写。

本 diff 已有真实首页行为改动和回归测试,计划文档也提供了验证说明;但任务台尚不能核对本次阶段五任务的目标、问题证据与接管理解。此项不是因为 PR description 不充分。

请打开“阶段五:CodeSense 持续优化与接管演练(魏嘉鸿)”任务台,把上述空字段改成具体记录:

  • task_modeproject_area:填写实际任务类型,以及学生首页与自适应推荐模块。
  • problem_goal:说明当前首页缺少什么决策帮助,以及本次验收行为。
  • reproduction_evidence:提供实际观察的页面或测试场景、输入条件、原行为与期望行为,并链接对应证据。
  • planned_changes:关联本 PR 的服务、路由、模板和测试文件。
  • learning_summary:用自己的话说明推荐优先级、授权范围由谁保证,以及如何撤销该功能。
  • verification_result:记录验证环境、命令、实际结果和证据链接,区分定向测试通过与全量测试仍有失败;不要将单独重跑通过写成全量通过。

完成第 1 项后运行 python -m pytest tests/test_adaptive_learning.py tests/test_student_home_history.py tests/test_session_lifecycle_routes.py -q,将实际输出补入 verification_result,再逐项核对任务台内容与提交一致。

已检查范围与后续建议

已静态检查新增推荐服务、首页路由接入、模板、六个测试及计划文档。服务没有新增显式写入或网络调用,动作 URL 由路由中的 url_for 生成;模板未新增 safe 输出。完整上游授权查询不在 diff 中,无法独立确认。

非阻塞建议:增加 70 分、60 分临界值,以及非当前作业会话和提交被忽略的测试。计划文档中的 PowerShell 路径 \.venv\Scripts\python.exe 建议改为 .\.venv\Scripts\python.exe,方便从仓库根目录复现。现有 PR description 已包含范围、验证和回滚说明;修订后更新测试数量,并保留全量失败的实际边界即可。

@XiaoCow666 XiaoCow666 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeSense 自动评审

未发现会导致安全越权、数据写入/丢失、页面无法运行或任务目标未完成的阻塞问题。实现将推荐计算保持为无数据库写入的纯函数,并在已按学生班级范围筛选的当前作业集合内生成服务端路由。

合并后可以继续改进的地方

  • 全量 pytest 尚未取得一次稳定的全绿结果:PR 提供的记录显示第二次全量运行有 686 passed、1 failed,失败项单独重跑通过。当前没有证据表明该失败由本 PR 引入,因此不阻塞;建议在 CI 中复跑全量门禁以确认测试隔离性。

已有验证信息

  • PR 提供的验证记录称:tests/test_adaptive_learning.py、tests/test_student_home_history.py、tests/test_session_lifecycle_routes.py 共 14 passed。
  • PR 提供的验证记录称:services/adaptive_learning.py、routes/main.py、tests/test_adaptive_learning.py 的 compileall 通过,git diff --check 通过。
  • PR 提供的验证记录称:第二次全量 pytest 为 686 passed、1 failed;失败的既有 RQ worker 集成测试单独重跑为 1 passed。未提供一次全量稳定通过的 687 passed 记录。

评审事件:1d15c0a0-b262-11f1-8ccf-430377b8d5ce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants