Skip to content

Musical time arrays: [bar, beat?, tick?] in project YAML - #24

Merged
ninjudd merged 2 commits into
mainfrom
feat/musical-time
Aug 6, 2026
Merged

ninjudd merged 2 commits into
mainfrom
feat/musical-time

Conversation

@ninjudd

@ninjudd ninjudd commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Scalars stay ticks; arrays are musical, resolved through the song's meter map at load — the numbers musicians think in, in the files they author.

  • Notation (musical-time.md records the decisions): positions are ordinal and 1-indexed — at: [9, 2] is bar 9 beat 2, there is no bar 0; spans are cardinal and zero-legal — duration: [4] is four bars, every: [0, 2] is two beats — advanced from the field's anchor through the meter map, stepping bars and beats at whatever meter is in force, so a span crossing a meter change means what a musician means by it. Dotted strings were rejected: 1.3 is a YAML float, and a forgotten quote silently means a different number. --from keeps its dotted form — a shell arg is not YAML.
  • Fields (v1): clip position/duration, loop.every, arrangement section at, song length. Musical arrays require anchor: musical; on absolute clips they are an error, not a conversion. Deferred: tempo/meter event at (self-referential enough not to rush) and take position (recorder-written, dual-representation).
  • Division of labor: the schema validates shape only (1–3 integers, ordinal vs cardinal minimums); the model layer resolves against the song's MeterMap and diagnoses ranges (beat 5 out of range for 4/4 at bar 2), misanchoring, zero-resolving spans, and arrays with no valid meter map. Resolution rewrites arrays to tick scalars at the load boundary, so the graph never sees an array and either spelling produces the same action key — verified on field by converting creek to length: [12] / duration: [12] / every: [4]: every target was a cache hit.
  • Emission: KeyOrder gains a per-key flow flag — time arrays stay single-line (length: [12]), the one recorded exception to block style; flowCollectionPadding: false keeps them unpadded. fmt preserves the author's notation: scalar stays scalar, array stays array.
  • Housekeeping: clip-looping.md status → complete (Clip looping: the window fills, on the grid, cut or rung out #21, extended by Looping end to end: song length, loop fold, bloom play --loop #23); now.md swaps that line for this project; project-model.md and build-graph.md document the notation.

Tests: meter-map ordinal/cardinal resolution through meter changes and 7/8; flow emission and comment preservation; load-time resolution, array-vs-tick load equality, and each diagnostic. 216 pass.


Note

Medium Risk
Changes the project load/validation boundary for timeline fields across songs, clips, and arrangements; incorrect resolution would affect mix length and placement, though tests and cache-equivalence with tick spellings reduce regression risk.

Overview
Project YAML time fields can now be written as musical arrays ([bar, beat?, tick?]) as well as tick scalars. Scalars still mean ticks; arrays are musical and are resolved through the song's meter map at load—downstream code and the build graph only see tick numbers, so length: [12] and an equivalent tick value yield the same build/cache behavior.

Resolution and validation happen in loadProject/validate: ordinal positions (e.g. at: [9, 2]), cardinal spans (e.g. duration: [4], every: [0, 2]), song length from bar 1, and clip spans anchored at clip position. The schema checks array shape only; beat/tick range, zero spans, missing meter map, and musical arrays on anchor: absolute clips are diagnosed explicitly.

MeterMap adds positionTicks and spanTicks (meter changes included); parse delegates to positionTicks.

Canonical YAML adds a per-key flow flag so time arrays stay single-line (length: [12]); fmt preserves scalar vs array choice.

Docs add musical-time.md and cross-links; clip-looping is marked complete in planning docs.

Reviewed by Cursor Bugbot for commit 240ea48. Configure here.

Scalars stay ticks; arrays are musical, resolved through the song's meter
map at load. Positions are ordinal and 1-indexed ([9, 2] = bar 9 beat 2,
no bar 0); spans are cardinal and zero-legal ([4] = four bars, [0, 2] =
two beats), advanced from the field's anchor so meter changes mean what a
musician means. Fields: clip position/duration, loop.every, arrangement
section at, song length. The schema validates shape only; the model layer
resolves and diagnoses (beat ranges need the meter map), and the graph
never sees an array — either spelling of a time is the same action key
(verified on field: converting creek to [12]/[4] was a full cache hit).
Arrays emit single-line via a KeyOrder flow flag, the one recorded
exception to block style; fmt preserves the author's notation. Plan with
the decision record in docs/projects/all/musical-time.md; clip-looping
status updated to complete.

@ninjudd ninjudd left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at head 240ea48 (in place). CI is red on this head and the failure is real: pnpm typecheck fails with 6 errors — vitest's 216/216 is genuine (I re-ran it), but typecheck is part of the CI gate and fails locally too. Details inline on the Track export. One P3 besides (a doc-vs-behavior gap on loop.every across meter changes). Everything else verified clean — including the cache guarantee proven live on real data.

  1. P2 — typecheck fails: the resolved-type promise and the raw-parse test fixtures disagree. Inline on schemas.ts:433. Blocking by construction (CI is red), mechanical to fix.
  2. P3 — loop.every arrays resolve once at the clip's anchor, so repetitions that cross a meter change don't stay on the authored musical interval — while §1.4's text promises they would. Inline on project.ts:490.

Verified by execution:

  • §1.6 on real data: field's drums clip — authored in ticks yesterday, since converted to position: [1] / duration: [12] / every: [2] — checks clean, and both the drums stem and the mix come back cached: byte-identical action keys across the notation rewrite, on exactly the clips whose tick spelling I had verified byte-for-byte. bloom fmt calls the array spelling already canonical.
  • Diagnostics, all four probed through the real CLI with named messages: absolute-clip array (musical arrays need anchor: musical), zero-resolving span, beat 5 out of range for 4/4 at bar 1, and a valid position: [1, 2] / duration: [0, 2] clip that builds.
  • vitest 216/216 at this head; the 6 tsc errors are all in mix.test.ts/track-render.test.ts fixtures, none in production code.

Verified by reading, no issues found:

  • The raw-vs-resolved type split (*File internal, resolved exported) is the right shape, and the load-boundary casts are honest because validate resolves-or-diagnoses every array before loadProject returns — nothing past the check gate can meet an array.
  • MeterMap.parse now delegates to positionTicks, so --from, the play readout, and YAML arrays share one resolver — one grammar, one set of range errors.
  • clearFlow pre-dates this PR, so flowCollectionPadding: false can't shift canonical text of any existing file — flow only ever appears via the new per-key flag, and empty collections render [] regardless. The §1.7 exception is precisely scoped.
  • Span semantics (cardinal, zero-legal, stepping at the meter in force at the moving position) match the tests, including 7/8 and mid-span meter changes; the ordinal/cardinal split with its zero-ambiguity rationale is the kind of decision record that will save a future argument.
  • The v1 field list and both deferrals (tempo/meter at self-reference; take position dual-representation) are reasoned, not just listed.

One process note, gently: the PR body's "216 tests pass" was true and is also why this slipped — vitest transpiles without type-checking, so pnpm typecheck is the half of the local gate that would have caught it before CI did.

Comment thread src/schema/schemas.ts Resolved
Comment thread src/model/project.ts Resolved
…pan caveat

The two test fixture helpers hand trackSchema.parse output (file types,
number | number[]) to planMix/planTrack, which take the resolved types —
cast, true for the same reason the loader's cast is true: fixture times
are scalar ticks. musical-time.md §1.4 and project-model.md now record
that a span resolves once at its anchor, so loop.every repetitions past
a mid-window meter change keep the anchor-time interval.
@ninjudd
ninjudd merged commit 248e0d6 into main Aug 6, 2026
1 check passed
ninjudd added a commit that referenced this pull request Aug 10, 2026
nested-tracks is Active — chunk 4 is revived by #123 and the soak
holds either way; Shipped was the one indefensible value. The three
stale prose lines are updated to what actually happened (voice
generation through #64/#65 and the #113 fold, effects through #14/#15
with the §6 executor move, musical time through #24), so the keyword
and the prose agree on day one. The README claims adoption, not
sharing, while agent-config#15 is still open.
ninjudd added a commit that referenced this pull request Aug 10, 2026
Project documents here carried their state as prose alone, which reads
well and machine-reads not at all. The shared convention now specifies
YAML frontmatter with a `status:` keyword on every document in `all/`
(ninjudd/agent-config#15 has the convention and the review-gate
semantics it feeds): the keyword carries the claim, the prose
`**Status:**` line keeps the why — which PRs carried the work and what
is left — and `Draft` specifically declares a plan not yet claiming to
be executable, so its open questions stop blocking its pull requests;
the PR that flips it out of Draft answers for them.

This adds the frontmatter to all 18 documents and rewrites the README's
"What goes in a document" section around the split. The README's old
argument — prose rather than a keyword, because the useful thing to say
is which PRs and what is left — is kept rather than overturned: the
prose line still says exactly that, and the keyword takes only the claim
the prose was never good at exposing to tooling. No `owner:` field — one
person to ask here.

Statuses were derived from each document's own prose cross-checked
against the three lists, not from the prose alone, which surfaced three
stale status lines: effects.md and musical-time.md say "In progress" but
their chunks all shipped (`inserts:` chains are live in bloom's creek
tracks and the master chain; musical time arrays landed in #24), and
voice-generation.md says "nothing here has yet loaded the model" while
now.md records that creek sings. All three are `Shipped` in frontmatter
with their prose untouched, per the convention that a finished plan is
not rewritten to match later reality — the frontmatter is the
correction. The tally: 16 `Shipped`, 2 `Draft` (automation.md, splice.md
— both designs with no code, on later.md). Nothing lands on `Active`,
`Blocked`, or `Stalled`: the five now.md lines are all soak-period
entries whose plans completed, which is this repo's documented
keep-the-line convention doing its job.

## Testing

From the repo root, on this branch:

```
grep -L '^status: ' docs/projects/all/*.md
grep -h '^status: ' docs/projects/all/*.md | sort | uniq -c
```

The first prints nothing — any filename it prints is a document the
sweep missed. The second prints exactly `2 status: Draft` and `16
status: Shipped`. The claim that would show a wrong call: a `Draft`
document appearing on `now.md`, since Draft means implementation not
started — `grep -l 'status: Draft' docs/projects/all/*.md` returns only
automation.md and splice.md, both linked from later.md alone. Docs-only;
nothing to build, no state left behind.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Documentation-only changes to project plan markdown; no runtime code,
build graph, or data paths affected.
> 
> **Overview**
> Project plans in `docs/projects/all/` now carry a one-line YAML
`status:` keyword in frontmatter, with `docs/projects/README.md`
rewritten to define the convention instead of prose-only status.
> 
> The README documents a fixed keyword set (`Draft`, `Active`,
`Blocked`, `Stalled`, `Shipped`, `Superseded`, `Abandoned`,
`Reference`), splits responsibilities so frontmatter is the
machine-checkable state of record and the existing `**Status:**` line
keeps PR history and what’s left, and explains that **`Draft`** means
the plan is not yet claiming to be executable (so open questions in
Draft plans don’t block their PRs). When keyword and prose disagree,
that’s treated as a bug to fix.
> 
> All 18 documents in `all/` get frontmatter: **16 `Shipped`**, **2
`Draft`** (`automation.md`, `splice.md`). Three plans are marked
`Shipped` in frontmatter while their prose still says in progress or
unstarted—`effects.md`, `musical-time.md`, and
`voice-generation.md`—because implementation had already landed; prose
is left as historical per the “don’t rewrite finished plans” rule.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
178e7e5. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@ninjudd
ninjudd deleted the feat/musical-time branch September 28, 2026 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant