Skip to content

fix: preserve lifetime practice streaks beyond the heatmap window - #52

Merged
EtanHey merged 1 commit into
masterfrom
fix/practice-streak-history
Oct 30, 2026
Merged

EtanHey merged 1 commit into
masterfrom
fix/practice-streak-history

Conversation

@EtanHey

@EtanHey EtanHey commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Practice streaks were calculated after filtering logs to the requested heatmap window. Once old practice aged out, Longest streak reset to zero; a current streak could also be truncated at the window boundary.

Calculate both streaks from the authenticated user's full practice history, retaining windowed heatmap data and totals. Request 126 days for the dashboard's 18-week calendar and use UTC date stepping for UTC practice-day keys. Authentication, ownership filtering, and public function visibility stay unchanged.

Validation: eight exported-query handler tests cover historical streaks, ongoing streaks across the cutoff, gaps/duplicate dates, ownership, yesterday, DST, empty accounts, and unauthenticated callers. Four fail against origin/master; all eight pass with this fix. Commit hooks passed 345 tests in 22 files, app typecheck, and the docs.local guard. Separate Convex typecheck passed. CodeRabbit CLI reported zero findings on the three production files. Fixtures are synthetic.

Draft handoff: the lead owns the required other-vendor review. No reviewer was spawned by this implementation worker. No merge, backend push, or deployment performed. Signed-in browser/visual verification was not performed.

Loop-record: implementer=codex/gpt-6.1-sol/high reviewer=none rounds=0/0 defects=0 role=worker

Bot policy: CodeRabbit CLI pre-commit pass; no additional panel requested for this bounded computation fix. Required lead-routed review remains pending.

— songscriptCodex (worker) · codex/gpt-6.1-sol

Co-Authored-By: songscriptCodex running gpt-6.1-sol <noreply@anthropic.com>
@EtanHey EtanHey added the size:S Tight-loop PR size: 21-100 hand-written lines changed label Oct 30, 2026
@EtanHey
EtanHey marked this pull request as ready for review October 30, 2026 07:22
@EtanHey

EtanHey commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

Review (lead, Claude Opus; other vendor than the Codex implementer): APPROVE.

  • Streaks now use every practice day; only the heatmap/totals stay windowed. LONGEST was wrongly limited to the 90-day window, so Etan's real longest (2 days, last practice 2026-03-18) showed 0.
  • UTC date math (setUTCDate) fixes the local-time drift on the server.
  • The dashboard window is 18*7 days, matching the 'Last 18 weeks' heatmap label.
  • Tests cover a lifetime-longest outside the window, an ongoing streak across the boundary, duplicate dates, gaps and other-user isolation (ownership via the by_user index).
  • No auth/visibility change: getPracticeHistory stays public with getAuthUserId.

— security lead (lead) · claude-code/claude-opus-5-5

@EtanHey
EtanHey merged commit 748bc22 into master Oct 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S Tight-loop PR size: 21-100 hand-written lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant