Repository navigation
supercollider: entries, and two leaves fold - #103
Conversation
nested-tracks.md §18 step 2, option A: an entry may hold an inline supercollider: block — the sound schema's authored fields, written where they play — and every generator entry mints its own node, //songs/<song>/gen:<name>, named by the owning track or <track>-<id> when the entry carries an id (two un-id'd generators in one track are told to add them). project-core.md §3.4 carries the gen: package amendment. at: now defaults to 0, so a leaf reads as bare content. kit-sc and pad-sc fold into leaf tracks; their renders are cache hits under the old sound keys — name and type never reach an action key, and the entry's parameters are the sound's verbatim, mutation-proven. The wrapper stems re-containerize scsynth's 24-bit output as float32, so the direct consumers re-keyed once and re-rendered byte-identically: kit-punch came out d1ae4edb again, and drums through main never moved. seven-eight-loop stays a sound: loop-cd sources it, a sound cannot see a track, and both retire together at multi-rate step 2 — a dependency §18's sequencing list glossed over, now recorded in the plan intro.
|
Starting review of e6fbee7. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6fbee7ca5
ℹ️ 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".
Two Codex findings on #103, both in project-model.md: the at: zero default applied to every entry kind but the doc never said omission places content at the track's start, and the supercollider field list said program where the schema key is source: — a list a reader would copy into an invalid entry.
|
Starting review of 260b9f2. |
minjudd
left a comment
There was a problem hiding this comment.
Reviewed 260b9f2 (e6fbee7 plus the docs commit, which landed mid-review — the code is byte-identical between the two).
The central claim is checkable here without your cache, and it holds exactly. Rather than watch for cached lines I compared the keys themselves, explain on main against explain on this head:
main //songs/creek/sound:kit-sc parameters {"seed":4096,"duration":5,"channels":2} action 75b77457ef39
head //songs/creek/gen:kit-sc parameters {"seed":4096,"duration":5,"channels":2} action 75b77457ef39
main //songs/creek/sound:pad-sc parameters {"seed":90210,"duration":10,"channels":2} action 91350c1169dd
head //songs/creek/gen:pad-sc parameters {"seed":90210,"duration":10,"channels":2} action 91350c1169dd
Same program hash, same parameters, same key. An sc node has no graph deps — the program enters through extraInputs — so its key is computable with nothing built, which is what makes the fold-is-a-cache-hit claim verifiable independently of a warm cache. wiringFields: ['source'] keeps the program out of parameters and ruleParameters drops name/type, so the entry's four fields are all that remains, and they are the sound schema's verbatim.
Nothing else in the example moves, and the two things that do are exactly the two you named. Comparing every track's input: list and parameters across all 13 tracks, main against head, the entire difference is:
kit-punch input: //songs/creek/sound:kit-sc → //songs/creek/track:kit-sc
pad input: //songs/creek/sound:pad-sc → //songs/creek/track:pad-sc
+ creek/kit-sc, creek/pad-sc: new stems, one clip each, start 0, no duration
Every parameters string is byte-identical, both consumers' included — so their re-key comes only through the input hash, the wrapper's re-encode, and not through anything in the plan. That the re-render is byte-identical stays yours to have proven: no daemon and no scsynth here.
What I exercised by hand, in a throwaway copy of bloom: the program path validates through the entry both ways (program file path escapes the project: ../escape.scd, program file not found: shared/instruments/nope.scd), carrying the entry's input 1 ("supercollider") prefix; the arity message lists supercollider:; a loop with a window but no every says loops a generator — set loop.every; check is ok; deps(//songs/creek/track:kit-punch) prints the promised three lines; arrangement creek is unchanged at five; explain creek/track:kit-sc walks levels up through the new leaf (track:main 0.0 dB (via track:kit-punch → track:drums → track:phrase, 3 placements)); and fmt says already canonical — the at: default stays in the parse rather than being written back into files, which is the thing a new schema default can quietly get wrong.
The collision check is also better than its description: genNames is per song, not per track, so track: foo with id: bar colliding with a track literally named foo-bar is caught too. Both findings below are about that message, not the check behind it.
515 tests: 416 pass, 41 skip, 58 fail — and main is 411/41/58 on this machine, the same 58, every one of them the single error field-audiod is not built (one distinct failure string in the whole run). So the five new tests pass and nothing regressed. pnpm typecheck clean. project-core.md §3.4 really is Label grammar (DECIDED), and the amendment is appended at the end of that item, dated, with §3.5 and the rest unmoved.
Two smaller things, neither blocking:
The cache-hit test records node.label.name, and gen:kit-sc and track:kit-sc share the name kit-sc — so ['kit-sc', 'drums', 'kit-sc'] reads as ambiguous even though it discriminates correctly (a re-keyed render makes it four entries, which is why your field-leak mutation turns it red). formatLabel(node.label) would make the assertion say what it proves.
And the line added in 260b9f2 — "makes at: 0 never worth writing" — the example contradicts six times, including on kit-punch's entry, which this PR edited. Either the sweep or the sentence; right now the reference project is the doc's counterexample.
The collision message assumed the case it was written for — two un-id'd generators in one track. A duplicate id tripped it too, stacking a second message whose advice (add ids) was false; a cross-track clash blamed whichever file the loop reached second and named neither side. Recording the first claimant lets the check stay quiet where the duplicate-id diagnostic already spoke, and name both files when the collision spans tracks.
The first fold disproved the decision's downstream half — the wrapper stem re-encodes what scsynth wrote, so the folded track's bytes differ while its samples do not. Left unamended, step 3's folds would read a promise that nothing rebuilds and see a rebuild that looks like a bug in their own work. The record now prices it: direct consumers re-key exactly once, byte-identically, and the layer below them never moves.
gen:kit-sc and track:kit-sc share the name kit-sc, so the assertion read as ambiguous about which one the post-fold run was — the test discriminated correctly (a re-keyed render adds a fourth entry), but the expectation now says //songs/creek/track:kit-sc outright: the wrapper stem runs, the render never does.
project-model.md says an omitted at: means the track's start and calls at: 0 never worth writing — while the reference project wrote it eight times, making the example the doc's counterexample. Cache-neutral: the default resolves to the same placement, and both songs build entirely cached after the sweep.
|
Both non-blocking notes taken too. edaf070 switches the cache-hit test to formatLabel, so the assertion now literally says the third run is //songs/creek/track:kit-sc — the wrapper stem, never the render. 44b0305 resolves the at: 0 contradiction in the example's favor of the doc: all eight default at: 0 lines swept from bloom, field fmt still says already canonical, and both songs build entirely cached afterwards, so the sweep moved no keys. PR body test counts updated (517, 7 new). |
|
Starting review of 44b0305. |
minjudd
left a comment
There was a problem hiding this comment.
Approving 44b0305. Both findings are fixed, and the two commits that went beyond them are the right shape.
The collision message now fits every case I could build. Same track, same id: duplicate input id "a" and nothing else. Same track, no ids: the id advice, which is the case it was written for. Across tracks — kit-sc with id: b against a track named kit-sc-b — a generator entry here and one in songs/creek/tracks/kit-sc-b.yaml both mint the render name "kit-sc-b" — rename a track or change an id, which names the other file and stops advising an id that is already there. Keying the map on the first claimant's path is what makes the same-track and cross-track cases distinguishable at all, and the comment above it now says which case is which and why the same-id branch stays quiet.
The §18 amendment says the thing the next chunk needs. Dated, appended inside decision 6 with the sequencing list unmoved, and it does not stop at recording what happened — "the proof a fold owes is 'the layer under the direct consumers never moves'" is the reusable form, and spelling out that step 3 pays the same one-time price is exactly what would otherwise be rediscovered as a bug. The d1ae4edb90b7… half is still yours, verified in your environment.
The test now proves what it claims rather than implying it. With full labels the third run is //songs/creek/track:kit-sc, so the assertion states directly that the stem ran and gen:kit-sc did not — where before it discriminated by count. And the two new cases pin both halves of the collision fix, including the negative one (not.toContain('give each an id')), which is the assertion that would catch a regression that re-adds the false advice.
The at: 0 sweep costs nothing, which I checked rather than assumed. Eight deletions, all of them at: 0, nothing else touched; no at: 0 remains in any track file, so the doc line and the reference project now agree. All 13 tracks' input: lists and parameters are byte-identical to 260b9f2, and gen:kit-sc / gen:pad-sc still key to 75b77457ef39 / 91350c1169dd — an omitted at and at: 0 really are the same instant, and the example proves it rather than the schema merely promising it. check is ok and fmt is already canonical, so nothing writes the default back.
517 tests, 418 pass, 41 skip, 58 fail — the same 58 as main, one distinct error string across the whole run (field-audiod is not built). pnpm typecheck clean.
No findings.
The last supercollider sound becomes a leaf track whose one entry is the program — the fold that loop-cd's retirement (#108, multi-rate step 2) unblocked, and the third run of the pattern kit-sc and pad-sc set in #103. `drums` changes one word (`sound:` → `track:`), the recipe file moves from `sounds/` to `tracks/` keeping its comment, and the README's play line follows to the `track:` spelling. tall-grass's `sounds/` directory is now empty; creek's holds the last two, both blocked on multi-rate step 3 (`vocal-48k` retires when a track carries its own rate, and `lead-take` folds with it). The cache story is amended decision 6 exactly, proven a third time: `gen:seven-eight-loop` was a cache hit under the old sound's action key — `name` and `type` never reach a key, the entry's parameters are the sound schema's verbatim, and scsynth never ran (it is not installed here; nothing needed it). `drums` re-keyed once, its input moving from the raw render to the wrapper stem, and re-rendered byte-identically to its pre-fold hash (`f25b9e091be2…`), so `main` never re-keyed and prints `cached`. ## Testing From the repo root, `pnpm build && pnpm typecheck && pnpm test` — 562 tests pass, unchanged from the base: the fold is example-and-docs only, exercising machinery #103 landed and tested. In `examples/bloom` (spawns an `audiod` daemon; `field quit` stops it): ``` field check field build tall-grass field build tall-grass field query 'deps(//songs/tall-grass/track:drums)' ``` `check` says `ok`. On a warm pre-fold cache the first build prints `cached` for `//songs/tall-grass/gen:seven-eight-loop` — the folded render hitting its old sound key, which is where wrong would show: a `built` line there means the key moved and scsynth would be required (it would fail here, since it is not installed). `track:seven-eight-loop` and `track:drums` build once while `track:main` stays `cached` — the downstream cache surviving is the proof drums re-rendered byte-identically, and `shasum -a 256 .field/out/songs/tall-grass/track/drums.wav` still prints `f25b9e091be2…`. The second build is entirely cached. `deps` prints the three-line leaf shape: `gen:seven-eight-loop`, `track:seven-eight-loop`, `track:drums`. `field fmt` says `already canonical`. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Example YAML and documentation only; no runtime or schema code changes, with cache behavior validated by existing build machinery. > > **Overview** > **`seven-eight-loop` becomes a leaf track** in the nested-tracks §18 pattern (`kit-sc` / `pad-sc`): the SuperCollider recipe moves from `sounds/` to `tracks/seven-eight-loop.yaml` as a single `supercollider:` input instead of `type: supercollider` on a sound. > > **`drums` now places the track**, swapping `sound: seven-eight-loop` for `track: seven-eight-loop`. The bloom README `field play` example uses the `track:` spelling. > > **Plan docs** record that this fold (unblocked after `loop-cd` retirement / multi-rate step 2) has landed; tall-grass `sounds/` is empty aside from creek’s remaining sounds blocked on multi-rate step 3. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 66a15f1. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
nested-tracks.md §18 step 2, option A as decided: an entry may hold an inline
supercollider:block — the sound schema's authored fields (program, seed, duration, channels), written where they play — and every generator entry mints its own node,//songs/<song>/gen:<name>, uniformly, whether it is a leaf's sole content or windowed among siblings. The node is named by the owning track, or<track>-<id>when the entry carries an id; two un-id'd generators in one track collide and the diagnostic says to add ids. project-core.md §3.4 carries the dated amendment adding thegen:package to the label grammar. One small schema loosening rode along:at:defaults to 0, so a leaf reads as bare content (- supercollider: {...}and nothing else) — the shape approved in the design discussion.kit-scandpad-scfold into leaf tracks, and the fold's central claim held exactly: their SuperCollider renders were cache hits under the old sound keys —nameandtypenever reach an action key, and the entry's parameters are the sound schema's verbatim, sogen:kit-scpicked upsound:kit-sc's cached render without scsynth ever running (it is not on my PATH; nothing needed it). This is mutation-proven: leaking one extra field into the minted spec turns the fold-is-a-cache-hit test red.One honest wrinkle the build surfaced, worth knowing at review: scsynth writes 24-bit WAVs and the wrapper stems write float32, so
track:kit-sc's bytes differ fromgen:kit-sc's while its samples do not. The direct consumers (kit-punch,pad) therefore re-keyed once and re-rendered — byte-identically:kit-punchcame outd1ae4edb90b7…, the exact hash it has carried since #100, and everything downstream (drums,phrase,main) never moved. The one-time price is two cheap daemon renders, not an SC render.seven-eight-loopdeliberately does not fold:loop-cd(a normalize sound) sources it, and a sound'ssource:cannot see a track — a dependency §18's sequencing list glossed over. It retires together withloop-cdat multi-rate step 2; the plan intro now records that.Testing
From the repo root:
517 tests pass (7 new: the
deps()shape option A promised,<track>-<id>naming, the two-generators-need-ids diagnostic and its two review-found neighbours — a duplicate id stays one message, a cross-track name clash names both files — program-path validation through the entry, and fold-is-a-cache-hit via a counting runner — that last one is the PR's core claim and is the mutation-proven one).checksaysok. The first build printscachedfor//songs/creek/gen:kit-scand//songs/creek/gen:pad-sc— the folded renders hitting their old sound keys, which is where wrong would show: abuiltline on agen:node means the key moved and scsynth would be required (it would hang here, since it is not installed). On a checkout with a warm pre-fold cache the wrapper stems and their two direct consumers build once (track:kit-sc,track:pad-sc,kit-punch,pad) whiledrums,phrase, andmainstay cached — the downstream cache surviving is the proof the re-render was byte-identical, andshasum -a 256 .field/out/songs/creek/track/kit-punch.wavstill printsd1ae4edb90b7…. The second build is entirely cached.prints the three-line shape from the design discussion:
gen:kit-sc,track:kit-sc,track:kit-punch.I also ran
field checkfrom a cleangit archive HEAD examples/bloomexport —ok. State left behind: anaudioddaemon inexamples/bloom(field quitstops it), and.field/out/songs/creek/gen/now exists.