← Back to Pull requests

fix(ai): 正确编码课表缓存的 SQLite 文件 URI #99

Closed
unknown closed this pull request without merging on Nov 26, 2026 15:14 UTC
View on GitHub
unknown unknown commented on Nov 17, 2026 10:34 UTC
Author

变更说明

从 #94 拆出的两行独立修复,不涉及日历订阅、LMS 或新增依赖。

读取 SQLite 课表缓存时,原先拼接 file: URI 会把路径中的 # 解释为片段,使实际存在的缓存被报告为不可用。改用 Path.resolve().as_uri() 编码路径,再保留原有 mode=ro,只读访问方式不变。

现有端到端测试的临时目录增加 cache-#- 前缀,确认课表内容实际进入最终模型上下文,而不只是检测文件存在。

测试证据

AI 分组及现有通知/AI 界面测试共 111 项通过;该用例也包含在最终全量产品回归中。

复现:uv run python -m unittest test.app.test_notice_search_ui.AIInterfaceSmokeTest.test_all_selected_cache_context_reaches_final_provider_messages -v

验证范围

基于 main 的 57959ba4bdab36d7dce89dbe29ddd7dd0218c326,Windows x64 / Python 3.13.1。五个独立分支另在本地联合验证:全部五个产品测试分组共 487 项,485 通过,2 项因缺少真实学校凭据跳过,无失败。该联合结果不替代本 PR 的独立 CI。

CI 契约与 AUR 工作流测试共 66 项,65 通过。唯一失败 test_linux_apt_keeps_original_mirror_until_install_fails 来自 Windows/Git Bash 对临时路径反斜杠的处理,已在未修改的同一上游提交上复现。本 PR 不修改无关 CI 脚本。

  • 新增或更新相关回归测试。

  • 已运行本地测试并注明未覆盖环境。

  • 合并前 PR Tests / CI Gate 通过(待远端 CI)。
  • 测试隔离本地配置并禁用系统凭据读取;未连接真实学校服务。其他操作系统和 Python 3.11/3.12 尚需 CI 验证。

    Diff: 115 lines (+86 / -29) across 1 files Reviewer: JimmyWang0417 Review duration: 13239m
    All Vouch review confidence checks passed
    Residual risk 0.12 = Change Risk (0.31) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.31 · 115 lines diff across 1 files
    0.31
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.289
    Diff Size diff_size
    0.284
    Real PR Conversation Timeline
    1 comments
    "Review active on #99"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 31.4% (LOW) · Higher = larger blast radius
    31.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 12.4% · Safe to merge
    12.4%