Files
stimmwerk/docs/superpowers/plans/2026-11-01-song-analysis-v2.md

55 lines
2.3 KiB
Markdown

# Song Analysis v2 Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
**Goal:** Publish a v2 analysis contract with lyric provenance, stable timeline and correct metadata updates.
**Architecture:** Python writes v2 JSON while Rust reads both versions. Chord data remains raw; supplied lyrics use timed draft phrases to bound line alignment.
**Tech Stack:** Python 3.11, jsonschema, WhisperX, Rust serde.
**Spec:** `docs/superpowers/specs/2026-11-01-song-analysis-v2-design.md`
## Global Constraints
- Preserve existing v1 files and manually edited outputs without `--force`.
- All stored times use seconds from the normalized source origin.
- Do not invent calibrated chord confidence.
## Review Focus
- v1 folder with strict Rust deserialization still loads.
- Supplied lyric section and line boundaries survive.
- Unmatched lyric line does not get an invented timestamp.
- Automatic BPM changes when beat file changes.
- Manual BPM survives a rerun.
---
### Task 1: Contract and metadata
**Files:** `schemas/song-analysis-v2/*`, `src/song_analysis.rs`, `tests/song_analysis_contract.rs`, `tools/song_analysis/cli.py`, `tools/test_song_analysis.py`
- [ ] Write failing Python and Rust tests for v2 fields and v1 compatibility.
- [ ] Run tests and confirm expected failures.
- [ ] Add v2 schemas, version-aware validation and metadata source handling, plus `--title`.
- [ ] Run tests and confirm they pass.
### Task 2: Lyric sections and alignment
**Files:** `tools/song_analysis/{core.py,backends.py,cli.py}`, `tools/test_song_analysis.py`
- [ ] Write failing tests for line parsing, sections, quality and bounded alignment.
- [ ] Run tests and confirm expected failures.
- [ ] Implement line-aware alignment and quality fields.
- [ ] Run tests and confirm they pass.
### Task 3: Reproducibility and guidance
**Files:** `tools/song_analysis/{requirements.txt,README.md}`, `.github/workflows/song-analysis.yml`, `tools/test_song_analysis.py`
- [ ] Pin madmom-infer to the installed commit.
- [ ] Document timeline, unverified drafts, raw chords, time signature support and observed resource costs.
- [ ] Add lightweight CI and opt-in audio smoke test.
- [ ] Run Python tests, Rust contract test, schema validation and `git diff --check`.