- compose-test-sync: fix 3 failing tests (NOTE_TO_MIDI, DrumLoopAnalyzer mock, section name) - generate-song: CLI wrapper + RPP validator (6 structural checks) + 4 e2e tests - reascript-hybrid: ReaScriptGenerator + command protocol + CLI + 16 unit tests - 110/110 tests passing - Full SDD cycle (propose→spec→design→tasks→apply→verify) for all 3 changes
59 lines
2.7 KiB
Markdown
59 lines
2.7 KiB
Markdown
# Proposal: compose-test-sync
|
|
|
|
## Intent
|
|
|
|
Sync 3 failing tests to the new compose.py API. The compose.py rewrite removed `root_to_midi` and `DrumLoopAnalyzer`, and changed `build_melody_track` signature. Tests are calling old APIs that no longer exist.
|
|
|
|
## Scope
|
|
|
|
### In Scope
|
|
- Fix `test_melody_uses_pentatonic` — remove stale `analysis` arg and ensure single-section test works
|
|
- Fix `test_main_without_render_produces_rpp` — remove obsolete `DrumLoopAnalyzer` mock
|
|
- Fix `test_root_to_midi` — replace removed `root_to_midi` with `NOTE_TO_MIDI` dict lookup
|
|
- Run full suite to confirm all 90 pass
|
|
|
|
### Out of Scope
|
|
- No new features
|
|
- No compose.py changes — only test fixes
|
|
|
|
## Capabilities
|
|
|
|
> No spec-level capabilities change. Tests are sync fixes only.
|
|
|
|
- None — test-only change, no capability modification
|
|
|
|
## Approach
|
|
|
|
1. **`test_root_to_midi`**: Replace `from scripts.compose import root_to_midi` with direct `NOTE_TO_MIDI` dict access. `root_to_midi` was removed; the constant `NOTE_TO_MIDI` ({"A": 69, "C": 60, ...}) is the correct replacement.
|
|
|
|
2. **`test_main_without_render_produces_rpp`**: Remove both `patch("scripts.compose.SampleSelector")` and `patch("scripts.compose.DrumLoopAnalyzer")`. The rewrite moved drumloop logic to `build_drumloop_track` which uses `Path(ABLETON_DRUMLOOP_DIR)` directly — no class-based analyzer. Keep only `SampleSelector` patch if still needed for other path.
|
|
|
|
3. **`test_melody_uses_pentatonic`**: The call signature is now `build_melody_track(sections, offsets, "A", True, seed=42)` — `analysis` arg removed. However `build_lead_track` (called by `build_melody_track`) only generates clips for sections named `chorus`, `chorus2`, or `final`. The test uses `"verse"` which produces zero clips. Fix: change section name to `"chorus"` OR add a second section named `"final"`.
|
|
|
|
## Affected Areas
|
|
|
|
| Area | Impact | Description |
|
|
|------|--------|-------------|
|
|
| `tests/test_section_builder.py` | Modified | Replace `root_to_midi` with `NOTE_TO_MIDI` |
|
|
| `tests/test_render_cli.py` | Modified | Remove `DrumLoopAnalyzer` mock, adjust patches |
|
|
| `tests/test_compose_integration.py` | Modified | Fix call signature, use chorus section |
|
|
|
|
## Risks
|
|
|
|
| Risk | Likelihood | Mitigation |
|
|
|------|------------|------------|
|
|
| Test fix breaks another test | Low | Run full suite after each change |
|
|
| compose.py behavior changed unexpectedly | Low | 87/90 tests already pass |
|
|
|
|
## Rollback Plan
|
|
|
|
Revert test files to prior commit. `git checkout HEAD~1 -- tests/` restores all three to original state.
|
|
|
|
## Dependencies
|
|
|
|
- None — test-only fix, no external deps
|
|
|
|
## Success Criteria
|
|
|
|
- [ ] All 90 tests pass (`pytest tests/ -q`)
|
|
- [ ] No compose.py files modified (only test files changed) |