From abf5d69d6f137b4892ed53097f5cd773a0f42323 Mon Sep 17 00:00:00 2001 From: pleb Date: Sun, 8 Nov 2026 19:34:12 -0800 Subject: [PATCH] Record the SQLite APPLY fix for leaderboard endpoints Co-Authored-By: Claude Opus 5.5 --- docs/plan.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/plan.md b/docs/plan.md index f2fbbe2..c3d7d5e 100644 --- a/docs/plan.md +++ b/docs/plan.md @@ -543,7 +543,7 @@ loads, and `GET /player/76561199407393962` returns 404 rather than 500. ### Phase 3: Importer -**Importer done 2026-11-09** (`pleb/main` at `737575b`, not pushed yet). Usage +**Importer done 2026-11-09** (`pleb/main` at `e3f991c`, pushed to Gitea). Usage and the full file → table mapping are in the fork's `MIRROR.md`. A full import takes about 11 s, and an unchanged rerun writes 0 rows. What differs from the steps below: @@ -580,14 +580,14 @@ archived upstream responses, on a scratch DB with `ASPNETCORE_ENVIRONMENT=Mirror triangle ratings. - `/accgraph` and `/history/triangle` match. `/score/statistic/{id}` redirects to the local file. -- **Open: `/leaderboard/{id}` and `/leaderboard/scores/{id}` return 500.** - `LeaderboardController.GeneralScores` projects - `Player.Clans.OrderBy(…ClanOrder…).Take(1)`, which needs SQL `APPLY`, and - SQLite has none. The same pattern appears about 8 times, in - `ScoreController`, `ReplayController`, `LeaderboardController` and - `ClanUtils`. Fix it in a separate server commit before phase 4. For example, - skip the clan projection in MirrorMode (there are no clans), or move the - ordering client-side. +- `/leaderboard/{id}` and `/leaderboard/scores/{id}` first returned 500. + About 10 projections order `Player.Clans` by an expression over the outer + row's `ClanOrder`, which needs SQL `APPLY`, and SQLite has none. **Fixed** + in `e3f991c`: `Utils/MirrorQueryInterceptor.cs`, an EF query interceptor + registered only in MirrorMode, rewrites any ordering of `Player.Clans` to + ordering by clan id. One file instead of patching every call site; the + mirror has no clans, so the order doesn't matter. The leaderboard, + clan-ranking and context variants now return 200. The check below (stock website) is still to do in phase 4.