refactor(server): extract AudioEffectsMappingDB into lib/audio_effects_db.py (R3) - #831
Merged
Merged
Conversation
…s_db.py (R3) Move-only, same shape as the MetadataDB extraction. The core-owned song/tone -> audio-effect-provider routing index leaves server.py for a flat lib/ module. The class body is byte-identical; server.py reconstructs exactly from origin/main minus the cut range plus the import-back and the call site. server.py: 9,705 -> 9,433 lines. The only non-verbatim change is the constructor seam: `__init__` takes `config_dir` instead of reading the module-level CONFIG_DIR, so the module does no IO at import (Principle V). The `audio_effect_mappings` singleton stays in server.py -- no route, no test, and none of the `monkeypatch.setattr(server, ...)` targets move. No import went dead. Verified: pyflakes clean on the new module; no new undefined name in server.py; pytest 2341 passed; eslint 0 errors; boot smoke drives the extracted DB end-to-end (POST a mapping -> GET reads it back -> audio_effects.db lands in CONFIG_DIR, proving the config_dir seam) and all three migrated plugins still serve their src/ module graphs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
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 (4)
📝 WalkthroughWalkthroughAudioEffectsMappingDB is moved from ChangesAudio effects database extraction
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second step of R3, following #830. Move-only, backend-only, zero behaviour change.
What moves
AudioEffectsMappingDB(273 lines) — the core-owned song/tone → audio-effect-provider routing index — leavesserver.pyforlib/audio_effects_db.py. Its only dependency on the host file wasCONFIG_DIR.server.py: 9,705 → 9,433 lines (14,037 at the start of R3).The one non-verbatim change
The same seam as #830:
__init__takesconfig_direxplicitly rather than reading the module-levelCONFIG_DIR, so the new module performs no IO at import (Principle V).The class body is byte-identical, and
server.pyreconstructs exactly fromorigin/mainminus the cut range, plus the import-back and the call site. No import went dead.What deliberately does not move
The
audio_effect_mappingssingleton stays inserver.py. No route moves, no test changes, and none of themonkeypatch.setattr(server, …)targets is touched.Verification
lib/audio_effects_db.pyclean — zero undefined names, zero unused imports.server.pygains no new undefined name.pytest— 2341 passed, 4 skipped (unchanged; no test needed retargeting).npm run lint— 0 errors.POST /api/audio-effects/mappingscreates a row,GETreads it back, andaudio_effects.dbis created underCONFIG_DIR— which is what actually proves theconfig_dirseam. All three migrated plugins (stems,studio,editor) still serve theirsrc/module graphs over the R0 route.Register
docs/size-exemptions.mdratcheted:server.py→ 9,433.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation