refactor(server): extract the artist-alias routes into routers/artist_aliases.py (R3) - #838
Conversation
…_aliases.py (R3) Second router, picked by router_scan.py: the artist-aliases / Tidy-up (P4) group ranks at 0 monkeypatch.setattr targets and 0 helpers to relocate. 5 routes (list/set/merge/delete aliases + raw-artist picker), all meta_db-only. Bodies verbatim; only @app.<m> -> @router.<m> and meta_db -> appstate.meta_db. include_router mounts at the original site; full 143-route table identical to origin/main (paths, methods, order). No test retargets: test_artist_alias drives via TestClient(server.app) + server.meta_db, neither of which moved. Verified: pyflakes clean on the router; no new undefined in server.py; JSONResponse still used in server.py (not dead); pytest 2398 passed (18 in test_artist_alias); packaging guard green; eslint 0; boot smoke drives all 5 routes end-to-end (set ACDC->AC/DC, read back, 400 on missing fields, delete). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThe artist alias API routes were extracted from ChangesArtist aliases API extraction
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/size-exemptions.md`:
- Line 58: Update the rationale for the 9,337 size count in
docs/size-exemptions.md to credit both router extractions, explicitly mentioning
this PR’s artist_aliases extraction alongside the first routers module.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: d9e1ce5b-8a32-4233-b07e-26b5b0662d85
📒 Files selected for processing (4)
CHANGELOG.mddocs/size-exemptions.mdlib/routers/artist_aliases.pyserver.py
Second router in the R3 train, after audio-effects (#834). Move-only, backend-only.
Picked by measurement
router_scan.pyranks the artist-aliases / Tidy-up (P4) group at 0monkeypatch.setattrtargets and 0 helpers to relocate — its only dependencies areJSONResponse,app, andmeta_db. 5 routes, allmeta_db-only:GET /api/artist-aliases·GET /api/artists/raw·POST /api/artist-aliases·POST /api/artist-aliases/merge·DELETE /api/artist-aliases/{raw_name:path}What changed
Bodies verbatim. Two mechanical edits:
@app.<m>→@router.<m>,meta_db→appstate.meta_db(a module attribute at call time, so a re-importedserverre-publishes a fresh DB into the seam).include_routermounts at the original site.server.py: 9,386 → 9,337.Verification
origin/main— 143 routes, same paths/methods/registration order.test_artist_aliasdrives viaTestClient(server.app)+server.meta_db, neither of which moved. 18 tests pass.ACDC → AC/DC, read it back,400on missing fields, delete.pytest2398 passed; packaging guard green (tests/test_packaging.pysees the new router);pyflakesclean;JSONResponsestill used inserver.py(didn't go dead);npm run lint0 errors.🤖 Generated with Claude Code
Summary by CodeRabbit