feat(core): the explicit rhythm scheduler — silent bars survive the rotation (S16 Phase 2, slice 2) - #115
Conversation
…16 Phase 2) The four laws from the #114 review, as tests, with the explicit paths unimplemented!(): an explicit palette (ADR-0029 §7) is honored by its own scheduler, not by effective_grids with an if — otherwise a silent bar is sacrificed to the old seam's convenience and a four-bar cycle quietly becomes a three-bar one. - law 1+3 (red): a [sounding, silent] palette generates 2, 0, 2, 0 notes across four bars, onsets exactly on the template's offsets — the silent template is a bar of the cycle, not a dropped entry; an all-silent palette stays silent instead of falling back to quarters; - law 2 (green, characterization): the automatic path keeps its empty-filtering and quarter fallback byte-for-byte; - precedence (red): ranked_candidates gains a rhythm_override that beats corpus rhythms while novelty references and gesture stay corpus-based, and RankedSet reports the palette verbatim plus a rhythm_explicit provenance flag; - law 4 (red): explicit_rhythm_diagnostics reports loaded == effective == fingerprints.len() — contrasted in the same test against the automatic diagnostics compressing the same palette to one grid. Plumbing that lets the tests compile: RuleGenerationRequest and SetRequest carry explicit_rhythms: Option<Vec<RhythmTemplate>> (all construction sites say None), generate() routes Some(palette) to the unimplemented explicit_grids, and the three frontend call sites pass None — baseline behavior is untouched, which the green suites confirm. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NkqJUU6d1sW1RAfvyHrqVM
…hase 2) explicit_grids maps the palette one grid per template, in the palette's own order and count: notes still clamp to the bar, an empty template stays an empty grid — a silent bar in the rotation — and there is no quarter fallback. This is deliberately a separate scheduler, not effective_grids with an if: the two answer to different laws, and the automatic corpus/source path keeps its filtering and fallback byte-for-byte (the characterization tests watched). explicit_rhythm_diagnostics reports the palette uncompressed (loaded == effective == fingerprints.len(), the silent template fingerprinting as itself). The rhythm-copy presence checks — in generate() and in the set builder's skip logic — consult whichever palette is active, so an explicit palette with one sounding template keeps RhythmCopyPitchSubstitute in the set. All six explicit_rhythm tests green; onsets of a [sounding, silent] 2-cycle over four bars land exactly at 0, 960, 3840, 4800. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NkqJUU6d1sW1RAfvyHrqVM
|
Warning Review limit reached
Next review available in: 20 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (17)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Architecture/code review — Phase 2 slice 2 acceptedThe implementation satisfies the four override laws and keeps the automatic path isolated:
No merge blocker found. Carry into the final CLI/artifact slice
CI, cockpit-web-test, and CodeRabbit are green on |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0163b460c9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pub fn explicit_rhythm_diagnostics( | ||
| palette: &[RhythmTemplate], | ||
| bar_duration: Ticks, | ||
| ) -> RhythmDiagnostics { |
There was a problem hiding this comment.
Split the scheduler implementation from its tests
AGENTS.md's TDD workflow requires a failing-test commit before implementation and says never to commit a new pub fn implementation in the same commit as the tests that cover it. This commit adds core/tests/explicit_rhythm.rs alongside this new public scheduler API, so the required red/green split is missing; please split the history into a red test commit and a later implementation commit.
Useful? React with 👍 / 👎.
Summary
The rhythm override in the shared generation compiler (ADR-0029 §7), built as the #114 review demanded: a separate explicit scheduler, not another
ifin front ofeffective_grids— otherwise a silent bar is sacrificed to the old seam's convenience and a four-bar cycle quietly becomes a three-bar one.Commit sequence (TDD)
f28031b) — the four laws as tests (core/tests/explicit_rhythm.rs), explicit pathsunimplemented!(), plus the compile plumbing with every construction site sayingexplicit_rhythms: None. The two characterization tests (laws that pin existing behavior) are green in red, per AGENTS' exemption.0163b46) —explicit_grids(one grid per template, palette order and count, clamp but never filter, no quarter fallback),explicit_rhythm_diagnostics(uncompressed), and active-palette rhythm-copy checks.The four laws (#114 review), as landed
[sounding, silent]palette over four bars generates2 0 2 0notes, onsets exactly0 960 3840 4800; an all-silent palette stays silent — no quarter fallback.explicit_rhythm_diagnosticsreportsloaded == effective == fingerprints.len(), contrasted in the same test againstrhythm_diagnosticscompressing the same palette to one grid.Surface changes
RuleGenerationRequest/SetRequestgainexplicit_rhythms: Option<Vec<RhythmTemplate>>(wins oversource_rhythmsoutright);ranked_candidatesgains a fourth parameterrhythm_override: Option<&[RhythmTemplate]>— precedenceexplicit > corpus > source first bar, novelty references and gesture stay corpus-based;RankedSetgainsrhythm_explicit: booland itssource_rhythmsdoc now promises verbatim provenance;None— behavior unchanged until the CLI slice arrives.Local gate: clippy
-D warningsclean; workspace tests green except the pre-existing Windows-localemissing_file_golden.Next slice: the namespaced
--rhythm-*CLI (kernel literal, mandatory unit, tail policy, independent seed, SWG diagnostic mapping incl. the honest zero-bar error) and the versioned expansion artifact.Refs #108, ADR-0029, S16 Phase 2.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NkqJUU6d1sW1RAfvyHrqVM