feedBack/lib/routers
byrongamatos d217ffecd8 refactor(server): extract XP + per-song stats into routers/stats.py (R3)
The last of the progression cluster. XP award (1 route) + per-song practice stats
(record/recent/best/top/per-song, 5 routes) — meta_db-only apart from the two
seam accessors record_stats uses (get_progression_content, builtin_diagnostic_
filename, both landed by shop/progression). Bodies verbatim; @app -> @router,
meta_db -> appstate.meta_db, _as_int from metadata_db, _clean_str from reqfields.

Three scattered source blocks (xp, the stats block, and the separated
/api/stats/{filename:path} which the /api/library/practice-suggestions route
splits off) are assembled into one module and mounted once. Registration order
is preserved WHERE IT MATTERS: the /api/stats/{filename:path} catch-all is
assembled LAST inside the router, so it still can't shadow the fixed /recent
/best /top paths — verified against the live route table (recent/best/top all
precede the catch-all) and the route SET is identical to origin/main (143).

server.py: 7,478 -> 7,275.

Verified: pyflakes clean; route set identical + catch-all-last; pytest 2401
passed (113 across song_stats/profile/progression); eslint 0. Boot smoke:
/stats/recent /best /top all 200 (not shadowed), xp/award 200.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 00:43:02 +02:00
..
__init__.py fix(build): move appstate.py + routers/ under lib/ so the desktop app ships them (#836) 2026-07-10 17:16:34 +02:00
artist_aliases.py refactor(server): extract the artist-alias routes into routers/artist_aliases.py (R3) (#838) 2026-07-10 18:55:03 +02:00
audio_effects.py fix(build): move appstate.py + routers/ under lib/ so the desktop app ships them (#836) 2026-07-10 17:16:34 +02:00
chart.py refactor(server): extract the chart routes into routers/chart.py (R3) (#846) 2026-07-10 22:15:25 +02:00
library_extras.py refactor(server): batch the small meta_db user-state endpoints into routers/library_extras.py (R3) (#850) 2026-07-10 23:37:24 +02:00
loops.py fix(loops): take the DB lock for the count+insert and the list read (#840) 2026-07-10 19:16:01 +02:00
playlists.py fix(playlists): split cover decode (400) from persist (500), unique temp, existence re-check (#842) 2026-07-10 20:16:22 +02:00
profile.py refactor(server): extract the profile routes into routers/profile.py (R3) (#854) 2026-07-11 00:38:03 +02:00
progression.py refactor(server): extract the progression routes into routers/progression.py (R3) (#853) 2026-07-11 00:25:53 +02:00
shop.py refactor(server): extract the shop routes + inject get_progression_content into the seam (R3) (#851) 2026-07-10 23:42:02 +02:00
stats.py refactor(server): extract XP + per-song stats into routers/stats.py (R3) 2026-07-11 00:43:02 +02:00
wanted.py refactor(server): extract the wishlist routes into routers/wanted.py (R3) (#847) 2026-07-10 22:20:10 +02:00
ws_highway.py fix(ws_highway): swallow a mid-stream WebSocketDisconnect quietly (#845) 2026-07-10 21:30:53 +02:00