Skip to content

Restore historical V1/V2 leaderboard scores and labels - #7

Merged
djblackett merged 2 commits into
mainfrom
fix/historical-leaderboard
Oct 23, 2026
Merged

djblackett merged 2 commits into
mainfrom
fix/historical-leaderboard

Conversation

@djblackett

Copy link
Copy Markdown
Owner

All Time currently filters scores to the active rules version, so verified V1 scores disappear after the V2 upgrade. Restore the existing V1/V2 implementation from 85d058b4c9968255302955086ec500f3774546d7 on feature/gameplay-improvements, recovered after inspecting the working tree, stashes, local branches and reflogs. That commit was absent from main; it is cherry-picked here as 0e450a6.

  • All Time combines visible, positive V1/V2 scores with explicit era labels and a comparison note. This Week uses the current scoring era and the existing Halifax week boundaries.
  • Entries, totals, pagination, score details and accepted/retried submission ranks share eligibility rules. Hidden, zero and unmapped versions remain excluded.
  • Historical personal bests and highlights survive; legacy cached metadata refreshes from score detail, with an unknown-version label until confirmed.
  • Replay verification stays strict: old or mismatched rules are rejected. Gameplay rules, replay schema, verifier, migrations and CI workflows are unchanged.

Validation passed:

  • 188 focused tests: ranked client/personal bests, leaderboard SQL/pagination, submission lifecycle (including idempotent mixed-era ranks), replay validation and determinism.
  • npm run build (client and Node replay engine) and npm --prefix server run typecheck.
  • node scripts/historical-leaderboard.mjs: real isolated local Worker/D1 plus Chromium; mixed-era ordering/counts/exclusions, historical detail ranks, V1/V2 labels, comparison note, YOU highlight, legacy personal-best refresh and a genuinely verified V2 submission with consistent ranks. Desktop and phone screenshots inspected. Available through npm run test:feature -- history.
  • Updated existing browser assertions for the new All Time caption; diff whitespace and script syntax checks pass.

No production data migration, rewrite or reset is needed: existing rows already store scores.rules_version, and the focused checks use the unchanged schema. No production database operations or deployments were performed.

After review and explicit release approval, the existing CI pipeline on main deploys/verifies the Worker before publishing Pages from the same commit. This PR runs validation only; it does not merge or deploy.

- Added rulesVersion field to score submissions and leaderboard entries.
- Updated tests to validate behavior with multiple rules versions.
- Implemented scoring eras to categorize scores based on rules versions.
- Enhanced UI to display scores with corresponding rules versions.
- Refactored score handling to accommodate legacy and current rules versions.
- Ensured backward compatibility for historical scores and submissions.
@djblackett
djblackett merged commit d41ad48 into main Oct 23, 2026
4 checks passed
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.

1 participant