Skip to content

refactor(server): extract the chart routes into routers/chart.py (R3) - #846

Merged
byrongamatos merged 1 commit into
mainfrom
refactor/r3-router-chart
Jul 10, 2026
Merged

refactor(server): extract the chart routes into routers/chart.py (R3)#846
byrongamatos merged 1 commit into
mainfrom
refactor/r3-router-chart

Conversation

@byrongamatos

@byrongamatos byrongamatos commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Unblocked by the DLC-path substrate (#843). chart's only server-module deps are now app + meta_db (both seam); _get_dlc_dir/_resolve_dlc_path come from dlc_paths, sloppak/loose detection from the shared lib modules. 0 setattr targets, 0 helpers to relocate.

4 routes: POST /api/chart/{f}/split · /unsplit · GET …/work · …/fileinfo (the context-menu "Get info").

Bodies verbatim (@app@router, meta_dbappstate.meta_db); include_router at the original site. server.py: 8,003 → 7,909.

Verification

  • Route table identical to origin/main (143). No test retargeting; no newly-dead imports.
  • pytest 2401 passed (74 across work_charts / context_menu / group_filter / packaging); pyflakes clean; npm run lint 0.
  • Boot smoke: chart/work 200; chart/fileinfo resolves the real pack path through _resolve_dlc_path.
  • Codex: 0 findings.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added chart tools to split charts from their associated work and restore them.
    • Added chart work information lookup.
    • Added detailed chart file information, including format, size, modification time, arrangements, stems, artwork, lyrics, authors, and enrichment details.
    • Improved validation and access protection for chart file requests.
  • Documentation

    • Updated the unreleased changelog and size-exemption documentation with current chart and routing details.

Unblocked by the DLC-path substrate (#843): chart's only server-module deps are
now app + meta_db (both seam); _get_dlc_dir/_resolve_dlc_path come from dlc_paths,
sloppak/loose detection from the shared lib modules. 4 routes (split/unsplit/
work/fileinfo), meta_db-only otherwise. 0 setattr targets, 0 helpers to relocate.

Bodies verbatim; @app -> @router, meta_db -> appstate.meta_db. include_router at
the original site; 143-route table identical to origin/main. No test retargeting.

server.py: 8,003 -> 7,909.

Verified: pyflakes clean on the router; no new undefined/dead in server.py; route
table identical; pytest 2401 passed (74 across work_charts/context_menu/
group_filter/packaging); eslint 0. Boot smoke: chart/work 200, chart/fileinfo
resolves the real pack path through _resolve_dlc_path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 09125dc8-75a1-4b4f-b4bc-574cec410c09

📥 Commits

Reviewing files that changed from the base of the PR and between c870199 and 5dc4e22.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • docs/size-exemptions.md
  • lib/routers/chart.py
  • server.py

📝 Walkthrough

Walkthrough

Chart endpoints were extracted from server.py into lib/routers/chart.py. The new router preserves split, unsplit, work, and file information behavior, and the server now mounts it. Changelog and size-exemption metadata were updated.

Changes

Chart router extraction

Layer / File(s) Summary
Chart endpoint implementation
lib/routers/chart.py
Defines split, unsplit, work lookup, and file information endpoints, including chart validation, metadata calculation, manifest fields, and enrichment matches.
Router registration and release metadata
server.py, CHANGELOG.md, docs/size-exemptions.md
Imports and mounts the chart router, removes the former inline handlers, and updates extraction documentation and sizing metadata.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: extracting chart routes from server.py into routers/chart.py.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/r3-router-chart

Comment @coderabbitai help to get the list of available commands.

@byrongamatos
byrongamatos merged commit 7c87538 into main Jul 10, 2026
5 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