feat(core): cap over-long phrase segments at MAX_PHRASE_BARS (#76, part 1) - #83
Conversation
Failing tests + stub for cap_segment_bars: a detected phrase longer than MAX_PHRASE_BARS should subdivide into cap-sized sub-phrases — the playtest's "30+ bar phrases that don't fit a single rhythmic pattern." Impl follows.
…split paths (#76) cap_segment_bars subdivides any segment longer than the cap (default 16 bars) into cap-sized sub-phrases; the web (split_to_json) and CLI (phrase_chunks) split builders apply it right after bar_segments. Enforces "no phrase is a 30-bar blob" — the playtest's over-long-phrase complaint. core split 8/8; cli green; clippy clean. End-to-end on the DGD guitar track every phrase span is ≤ 16 bars (longest detected is 12, so the cap is a safety net there rather than a visible change) — it kicks in on the longer-phrased material the playtest hit. The issue's other two parts — trivial-phrase drop and novelty dedup — follow as separate PRs.
|
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 (3)
📝 WalkthroughWalkthrough
ChangesPhrase segment bar-length capping
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
First of three slices for #76 (phrase-segmentation quality). This one tackles the over-long phrases — the playtest's "30+ bar phrases that don't fit a single rhythmic pattern."
What
cap_segment_bars(segments, max_bars)incore/src/split.rs: subdivides any segment longer than the cap into consecutive ≤max_barssub-ranges, leaving shorter ones intact. Composes afterbar_segments(only adds cuts; still sorted, non-overlapping, full coverage).MAX_PHRASE_BARS = 16default cap (generous — splits only clearly over-long phrases; documented as tunable).web/src/lib.rs(split_to_json) andcli/src/main.rs(phrase_chunks).Approach
Genuine red → green (this is core algorithm, not glue):
14f48a7adds failing tests + anunimplemented!()stub;52a1789implements it and wires the callers.Verification
coresplit tests 8/8 (4 new cap cases: zero-cap passthrough, within-cap whole, over-long split + remainder, exact multiple, per-segment independence);cligreen;clippy -D warningsclean.Honest note on scope
On the DGD guitar track the longest detected phrase is 12 bars, so the cap is a safety net there rather than a visible change — it enforces the invariant and kicks in on the longer-phrased material the playtest hit. The genuinely-visible junk on that track is the two 1-bar phrases, which is the issue's trivial-phrase part — coming next as part 2 (a min-bars/min-notes drop). Novelty dedup is part 3.
🤖 Generated with Claude Code
https://claude.ai/code/session_01TTUbGjzD8ysnVnCJnZJE95
Generated by Claude Code
Summary by CodeRabbit
Release Notes
griff splitphrase curation to automatically cap over-long phrases exceeding 16 bars into smaller segments. This prevents excessively long phrases from being processed as single chunks, improving curation performance and reliability.