Bound leaderboard staleness with database-owned cohort cache versions (CMP drift)

未关闭
#524 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python

调研方向

Read the four authority documents named in the issue, then trace the Cohort model, leaderboard recalculation, HTML row cache, and public export/YAML cache paths. Start by locating their existing tests and migration checks; use synthetic cohorts and learners with separate or stale cache instances to verify durable version reads, atomic rollback, visibility invalidation, and the 60-second configurable TTL. Done means the listed regression and migration checks pass while routes, payloads, privacy behavior, and dashboard behavior remain intact.

由索引模型根据 Issue 内容生成。

描述

bug courses P1

Problem and provenance

Leaderboard invalidation currently increments a process-local cache key. Other Gunicorn processes retain HTML rows for an hour and API output for 24 hours, including a learner who changes leaderboard visibility. CMP dae6e36 bounds TTL and 036ace2 moves the version to the database. Intake 835873e9-5f63-4e5d-b0f9-0773e1d562b6 authorizes small PRs and candidate-only delivery.

Authority

  • _docs/specs/04-courses-and-cohorts.md: cohort-owned leaderboard/visibility preferences; assessment state remains cohort-specific.
  • _docs/specs/07-security-privacy-operations.md: database-owned protected learner state and cache isolation.
  • _docs/architecture/database-only-content.md.
  • _docs/specs/10-verification-strategy.md; _docs/ci/change-selective-ci.md.

Scope

Adapt CMP's database version to the current Cohort model, never reintroduce the historical Course-as-edition model. Add the minimal migration and atomic F increment shared by leaderboard recalculation and visibility invalidation. Both HTML row cache and public leaderboard export/YAML keys read the durable version. Bound data caches to a configurable 60-second default. Keep existing payload shapes, routes, pagination and privacy semantics. Website dashboard builds directly from the database; do not introduce CMP dashboard cache or change edge/browser caching.

Acceptance criteria

  • Existing cohorts migrate with a valid initial leaderboard version; migration drift check and forward/reverse migration coverage pass.
  • HTML and JSON/YAML leaderboard readers key cached data by the cohort's current database version, independently of process-local cache version entries.
  • Recalculation commits totals and a monotonic atomic version advance together; failure rolls both back. Concurrent advances do not lose increments.
  • Changing display_on_leaderboard invalidates both row and export caches through the durable version; tests simulate separate/stale worker-local caches and prove hidden learners disappear on the next fresh read.
  • Data cache TTL defaults to 60 seconds and respects supported configuration; no 1-hour/24-hour internal defaults remain on these leaderboard paths.
  • Cohort isolation, pagination, existing response payloads, learner visibility and private response policies pass focused regression tests. Dashboard behavior is preserved.
  • Exact base/head verification plan, independent tester and PM acceptance, required checks green on PR exact head, merge and candidate live verification at prod.datatalks.club.

Boundaries and verification

No production data export or real-user mail. CMP stays read-only; courses.datatalks.club, current datatalks.club, join.datatalks.club, signup emails and Slack settings unchanged. Test synthetic cohorts/learners and fresh/stale model instances plus separate cache aliases/cleared local caches as appropriate. Internal cache-only work has no intended render change; computed plan determines Playwright and screenshot disposition. No dependency on the CSRF or review-copy ports.

主要语言
Python
星标
0
派生
0
平均合并
37 分钟
30 天内合并 PR
36

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

DataTalksClub/website 的其他 Issue

查看 DataTalksClub/website 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。