Repository navigation
The cache is the freeze: clean tracks play as stems, dirty goes live - #140
Conversation
compileSession asks the build cache (explain, executing nothing) which stems are already cached and serves those tracks as one file window each — no chain, no children, no new session vocabulary, so the engine is untouched and the freeze swap is a plain session swap, inaudible by the golden's bit-identity. The output track and pre-tap senders never freeze; unreached subtrees drop from the session. The compile reports its dirty list and the watch loop rebuilds exactly that behind the play, freezing it next compile. Live evaluation becomes what playing a song is: a bare song name routes live, --live retires, --from/--loop compose with the session, and explicit labels stay file playback (realtime.md decision 8). The plan ships whole.
|
Starting review of 163e6a6. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 163e6a6ad4
ℹ️ 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".
…, the freeze dies with the play Five findings, all real. The authored loop: never reaches the transport — clip-looping.md assigns repetition to the --loop flag and the field to the fold — so a bare play of a loop-shaped song plays one pass and stops. Sessions always carry a finite extent (declared, or the output's natural length), because an unbounded one played silence forever past its content. --from with --loop is refused on the live path and pointed at the artifact spelling until the engine grows a loop-start. The background freeze threads the watch's abort signal through buildLabels into the render subprocess, so ctrl-c ends a mid-freeze build now. And build temp paths carry a process-unique suffix, because the freeze put two legitimate builds in one process and identical actions shared a literal tmp name.
|
Starting review of 36be261. |
minjudd
left a comment
There was a problem hiding this comment.
Reviewing 36be261. 163e6a6 was superseded while I was working through it, so nothing was published against that SHA; everything below was re-measured here.
The central claim holds, and I measured it rather than reading it. "The swap between a track's cached and live forms is inaudible" is the whole plan resting on one property, so I tested it on creek — not the fixture — by rendering the session twice: once as the cache stands, once with the stem action entries hidden so the same tracks compile live.
frozen: 5 tracks, dirty=0, loop=undefined, length=1440000
tracks: lead-vocal, pad, phrase, space, main
live: 12 tracks, dirty=11
frozen render === live render: true
Byte-identical across 11,520,000 bytes, with eleven tracks changing form between the two. That is decision 4 demonstrated at real scale rather than on opener.
The reachability trim is real too. creek's fourteen tracks compile to five — four frozen stems plus the live output chain, §5's definition of done verbatim — and the nine that only fed frozen subtrees are gone rather than pre-rendering for nobody.
The freeze arc works end-to-end, run the way the description says, against a null-output daemon:
edit session swapped
edit froze 3 stems
edit session swapped
And it converges: tracks=9 dirty=[phrase, drums, kit-punch] before, tracks=5 dirty=[] after. The whole arc completes about a second after the edit — the three stems rebuild in ~0.1 s, so "a few seconds later" is if anything generous.
This round's four changes are each right, and I checked the two that change behaviour. The authored loop: no longer reaching the transport matches what the artifact path always did — a loop-shaped song renders one folded pass — and field play tall-grass now plays its 4.4 s and exits 0 on its own, where an unbounded session would have polled silence forever. Threading the abort into the render subprocess, and making build temporaries process-unique because the freeze legitimately put two builds in one process, are both real fixes rather than tidying.
I also checked the things a freeze could plausibly get wrong and did not: tap: labels are minted only for tap: pre sends (labels.ts:94), so the pre-tap exclusion keys on the right thing; a post-tap sender freezing is safe because a stem is exactly its post ring; and a partially-written action entry reads as a miss (build.ts:97), so a background build racing a compile degrades to a rebuild rather than a wrong answer.
Gates at this head. pnpm typecheck clean, pnpm test 40 files / 608 tests green — the number the description now claims. The new tests are well aimed: the freeze test asserts the pre-tap exclusion directly and carries the decision-4 golden, and the cancellation test proves the signal reaches the runner and that an aborted walk runs nothing.
One finding, on the thread: the rate refusal is the one user-facing dead end in the PR that does not say what to do instead.
One note that is not a finding. The frozen creek session and the built artifact differ, and I chased it before concluding it is correct: the differences are confined to first 0, last 120959 (2.520s) with 27.48 s identical after — space's 2.5 s decay plus its 20 ms predelay, the loop fold's overhang, and the identical figure I measured on #138. The artifact folds and the live wrap performs, which is exactly why the output track never freezes.
The daemon's message carries the physics; the CLI spelling that still plays — the artifact path, which resamples in the transport — is appended where the session loads, the only place holding both halves. tracks.md records the constraint beside the sentence that teaches the two spellings.
|
Starting review of d3d6c52. |
minjudd
left a comment
There was a problem hiding this comment.
Approving d3d6c52. The refusal now names the way out, and the way out works — which is the half worth checking, since guidance that fails is worse than none.
$ field play opener
audiod session: the device runs at 48000 Hz and cannot switch to the session's 44100 — live resampling lands with the cross-rate wiring — the artifact resamples in the transport: field play opener/track:main
$ field play opener/track:main
playing //songs/opener/track:main
=> played, exit 0
Same 44.1 kHz project, same 48 kHz device: the command the error tells you to run is the command that plays. The song name is interpolated rather than hardcoded, so the spelling is right for whatever song failed.
Catching it in the CLI is the right seam, and the comment says why better than the finding did — the daemon holds the physics and knows nothing about labels, so the CLI is the only place with both halves. The narrow includes guard leaves every other session error propagating untouched, which is what you want from a message-matched branch.
The docs half landed where someone looks before they hit the error. tracks.md now carries the constraint in the paragraph that already teaches the two spellings, and it states the mechanism — "live playback does not resample until the cross-rate wiring lands... while the artifact path resamples in the transport and plays anywhere" — rather than just the workaround, so it stays true when the wiring lands and someone comes back to delete it.
Gates at this head. pnpm typecheck clean, pnpm test 40 files / 608 tests green.
One thing to note rather than fix, since the behaviour is right today: the branch matches cannot switch to the session against a string authored in native/audiod/src/player.cpp, and nothing pins the two together — reword the C++ side and the hint silently stops appearing, with no test failing. It is testable with the harness the suite already has: a project at 44.1 kHz against nullOutput: true, which is fixed at 48 kHz (player.cpp:44), is exactly the probe I ran above. Worth a case the next time this file is open; the failure mode is a lost hint rather than a wrong one, which is why it is a note.
Everything else carries over from 36be261, where I did the work: the frozen and live renders of creek byte-identical across 11,520,000 bytes with eleven tracks changing form between them; fourteen tracks compiling to five, four frozen stems plus the live output chain; the freeze arc running session swapped → froze 3 stems → session swapped and converging to dirty=[] about a second after the edit; the authored loop: no longer reaching the transport, matching what the artifact always did; field play tall-grass bounding itself and exiting 0; and the pre-tap exclusion keying on tap: labels that are minted only for tap: pre sends.
Also carried over: the frozen-versus-artifact difference on creek is the loop fold, first 0, last 120959 (2.520s) with 27.48 s identical after — the same figure #138 measured, and exactly why the output track never freezes.
No findings.
Realtime chunk 4 (realtime.md §7, decision 4): the compiler consults the build cache before compiling —
explain(), which executes nothing — and every track whose stem action is already cached is served as that stem: one file window at unity, chain empty, subtree swallowed. The cached form needed no new session vocabulary, so the engine did not change at all in this PR, and the swap between a track's cached and live forms is a plain session swap — inaudible because the chunk-2 golden proves the stem and the live evaluation are the same bytes, which was the whole point of engineering bit-identity instead of hoping for it. Two kinds of track never freeze: the output — its windows are the ramp surface, and under loop the artifact is a fold where the live wrap is a performance — and any pre-tap sender, conservatively, because a stem is post-chain and the cable reads the pre ring. Tracks nothing reaches once their consumers freeze drop from the session instead of pre-rendering for nobody. On creek this compiles to four frozen stems plus one live output chain, which is §5's definition of done verbatim: thirty clean tracks and one being edited cost one live chain plus file streaming.The compile reports its dirty list — reachable freeze candidates that missed the cache — and the watch loop runs the background half: it rebuilds exactly that list behind the play and recompiles, so the dirty track that went live at your edit freezes again a few seconds later with nothing to hear at the swap. The list never names a track that cannot freeze, which is what makes the loop converge instead of rebuilding forever. An unwatched play simply plays its dirt live. The freeze also starts at watch launch, so a play that began dirty heals without waiting for an edit, and the display narrates the arc:
edit session swapped,edit froze 3 stems,edit session swapped.Decision 8 completes: live evaluation is what playing a song is now. A bare song name —
field play creek— routes to the live session; the--liveflag retires;--fromlocates the session (which also pre-rolls the chain at the target, so it starts warm) and--loopwraps at the song's extent. The review round drew the loop semantics sharp: the authoredloop:in song.yaml is the fold — clip-looping.md's "one seamless pass of the infinite performance" — and never reaches the transport, so a bare play of a loop-shaped song plays one pass and stops, exactly as the artifact did, and repetition stays the--loopflag. Sessions always carry a finite extent — the declared length, or the output's natural length (content end plus chain growth, where the artifact ends) — because an unbounded session played silence forever past its content.--fromwith--loopis a region loop, which the engine cannot wrap yet (the wrap returns to the top), so the live path refuses the combination and names the artifact spelling that still does it. Playing an explicit label —field play creek/track:main, an asset, a queue of patterns — stays file playback of the built artifact, and--clickstays there with it, since it renders CLI-side over a file; asking for it on a song errors with the artifact spelling. One behavioral edge recorded in the plan amendment: the artifact path resampled at the transport, and live playback does not until the cross-rate wiring lands, so a device that cannot switch to the session's rate refuses with the artifact spelling as the interim answer. The realtime plan flips to Shipped — all four chunks — and now.md/later.md ride the same diff per convention; the recorded follow-ups (streaming rings before large sessions, cross-rate wiring) stay in the plan's amendments.Two mechanical fixes from the same round: the background freeze threads the watch's abort signal through buildLabels into the render subprocess, so ctrl-c mid-freeze kills the build now instead of the process lingering until the stem finishes (a killed run writes no action entry, so the cache never sees it); and build temporary paths carry a process-unique suffix, because the freeze legitimately put two builds in one process and identical actions shared a literal
<key>.outtmp name whose renames would race.The suite grows 604 → 608: a freeze test — cold compile freezes nothing and reports wash dirty; one build later the same compile serves wash frozen, voice stays live for its pre-tap, and the frozen session renders byte-identical to the offline artifact, which is the decision-4 golden — a watch test that starts dirty and observes the background rebuild freeze it, a loop-and-extent test (the authored loop never reaches the transport; an undeclared song bounds itself at its natural length), and a cancellation test (the signal reaches the runner; an aborted build runs nothing). Every prior test is untouched and green.
Testing
From the repo root:
pnpm build && pnpm test— 40 files / 608 tests green (no native changes, butpnpm build:nativeif your daemon predates #139, andcd examples/bloom && field transport quitif one is running — the watch path refuses a stale daemon). Then fromexamples/bloom:field play creek— no flag — printslive creek (live)and bars from 1.1.1, playing one pass of the declared extent and stopping; before this PR that command built and played the artifact file, and--livewas the way to this path (it now errors as an unknown option, which is the retirement working).field play creek --loopadds(looping)and wraps at the extent with tails ringing across — the live rendition of what the artifact's fold approximates.field play creek --from 2 --looprefuses, namingfield play creek/track:main --from <position> --loop, which still region-loops.field play creek --watch, then editsongs/creek/tracks/kit-punch.yamlchanginggain_db: 4to7: the terminal printsedit session swappedwithin the debounce (the dirty subtree went live — audibly, the eq change lands), thenedit froze 3 stemsand a secondedit session swappeda few seconds later as the rebuilt stems swap back in — that second swap is the one that should be inaudible; hearing a glitch at it would show the freeze wrong. Restore the file and the same arc runs back.field play creek --from 3starts the readout at3.1.1, andfield play creek/track:mainstill printsplaying //songs/creek/track:main— the artifact path, kept for explicit labels. Playback leaves the daemon running; it exits after five idle minutes, orfield transport quitends it now.