Repository navigation
Edits land mid-play: gain moves ramp, structure swaps, the wrap takeover retires - #139
Conversation
|
Starting review of 59b9057. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 59b9057. Configure here.
…daemon, a failed swap keeps the old session
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 59b905729f
ℹ️ 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".
|
Starting review of 90b2bb8. |
minjudd
left a comment
There was a problem hiding this comment.
Reviewing 90b2bb8. 59b9057 was superseded while I was working through it, so nothing was published against that SHA; two of the three problems I had confirmed there are fixed in this head, and I verified both fixes rather than taking the commit message for them.
The watch now ends with playback, and I checked that it does. At 59b9057 watchLiveSession resolved only on abort, and the CLI aborted only on SIGINT — so a transport that stopped for any other reason (a song without loop:, which tall-grass is) left await watchDone waiting forever with fsWatch holding the event loop open. The local watchAbort, chained from the caller's signal and aborted after the play loop breaks, is the right shape. Driving playLiveSession down the natural-stop path (no SIGINT, the signal never aborted):
playLiveSession after the play loop broke: RETURNED (3182 ms)
The baseline fix is right for the reason the comment gives. Advancing current only after onEdit resolves means a failed send keeps diffing against what is actually playing, and re-sending a ramp at its current value is a no-op — so the recovery is genuinely idempotent rather than merely hiding the error.
And the native reordering is a real fix, not a tidy-up. Refusing before touching liveSession means a rate-mismatched swap leaves the old session playing; the old order ran liveSession.reset() and then returned the error, which killed playback to refuse an edit.
Gates at this head. pnpm typecheck clean, pnpm build:native clean, and pnpm test is 40 files / 604 tests green — exactly the 604 the description claims. The daemon it builds answers version 0.6.0, supports reload: false, supports session: true, so the protocol bump and the capability removal are real and not just the version string moving.
One finding blocks, and it is the classifier rather than any of the machinery above. Three smaller things follow it.
An EQ band's gain edit is silently dropped — not ramped, not swapped, not reported. shapeOf blanks every key named gain_db at any depth, but the ramp scan only walks tracks[].inputs[], so a change confined to chain[].bands[].gain_db is invisible to both halves. Decision 5 is explicit that this must swap: "A moved clip, an edited chain, a new track is a prepared subgraph the engine swaps in at a block boundary." On creek — the song in your own Testing section — raising kit-punch's lowshelf from 4 dB to 8 dB gives sessions differ=true and diffSessions=same. Details and the contrast case are on the inline thread.
What makes it worth blocking rather than noting is that it is self-concealing: current advances to the new session anyway, so reverting the edit also diffs to same, and the daemon keeps the original EQ until some unrelated structural edit happens to force a swap. The listener's evidence is that the fader does nothing, twice.
The rest — the doc paragraph describing a command this PR now refuses, the reloaded event that outlived its own retirement, and a swap test whose swapped session is identical to the original — are on their own threads.
Nothing here touches the parts of chunk 3 that are the hard parts, and they look right: construction outside the lock, the pointer move under it, transport carried, latest compile wins.
The classifier masked every field named gain_db, so an eq band's gain edit diffed to 'same' and never reached the daemon, and a child window's gain diffed to a ramp the pre-rendered buffers ignore. The mask is now positional — exactly the output track's window gains, the ones the ramp verb reaches — and everything else falls through to swap. File windows carry the build outcome's sha256 so a source that changes bytes under a stable path swaps instead of diffing to 'same'.
…lock locate rebuilds the output chain and then warms it — the warmup span (one reverb tail, one limiter window, a second per eq stage: the 60 dB threshold the design already uses) rendered and discarded — so the first audible samples after a swap or far seek carry the state the position implies. The expensive half runs outside liveLock: loadSession pre-rolls the replacement at a predicted position before locking, and the second locate only rolls the drift forward. The old session is also destroyed after the lock releases instead of under it, where freeing its buffers handed the callback silent blocks. The daemon advertises 'swap' and the watch path gates on it, because a 0.5 daemon advertises 'session' with a swap that stops and rewinds.
The watcher recompiles once after installing itself, so an edit made during daemon connection and session preload lands instead of waiting for an unrelated change. A structural swap rebuilds the musical context, so the readout follows a moved tempo map instead of spelling bars from the old one. The retirement sweep finishes what it claimed: the dead reloaded event arm, two comments describing deleted machinery, splice's citation of the deleted loop-ui, and build-graph.md's paragraph on the wrap takeover this branch replaced. The swap test's strictly-greater assertion polls for the post-swap block instead of racing the callback cadence.
|
Starting review of dc6bf23. |
minjudd
left a comment
There was a problem hiding this comment.
Reviewing dc6bf23. Every finding from 90b2bb8 is fixed, and the classifier rework found something underneath mine that I had looked straight at and called working — the correction below is the substantive part of this review. One stale sentence is left, and it is the only thing between this and an approval.
I was wrong about the positive case at 90b2bb8. I reported the keys.yaml edit producing 3 levels ramped as the classifier working as advertised. It was not: space is not the output track, live.cpp:207-209 renders every non-output track in full at load, and produceUntil early-returns once track.produced >= outputSamples — so those three ramps mutated window.gainDb on windows nothing re-reads, reported success, and changed nothing audible. Narrowing the ramp surface to the output track is the right fix and it is a bigger one than the finding I filed.
The classifier is right now, and by position rather than by name. On creek (output track main):
eq band gain (chain) 4 -> 8 dB differ=true -> swap
eq band frequency 120 -> 200 Hz differ=true -> swap
clip gain on keys (feeds non-output track) differ=true -> swap
clip gain on main (the OUTPUT track) differ=true -> ramps (main#1)
second clip gain on main (OUTPUT track) differ=true -> ramps (main#0)
The eq band is decision 5's edited chain and now swaps; the child-track gain swaps rather than pretending to ramp; only the output track's own window gains ramp, which is exactly the set the engine can still act on.
I ran the loop by hand, the way the description says to. field play creek --live --watch against a null-output daemon, editing main.yaml and then keys.yaml and restoring each:
edit 1 level ramped
edit 1 level ramped
edit session swapped
edit session swapped
The position readout runs straight through both swaps — 6.1.331 to 6.1.773, 7.4.213 to 7.4.541 — so the transport is genuinely carried, not restarted, and the CLI exits 0 on ctrl-c. Both edits and both restorations land, which is the half that would have been silent before.
sha256 on file windows is the right shape for the content-identity problem. A path whose bytes moved is a different source, and the field is inert to the engine — the comment says so and live.cpp never reads it — so it buys the comparison what it needs without giving the daemon a second thing to misread.
The native round holds up. discardUntil terminates: renderBlock ends in an unconditional delivered += n with n >= 1, and the inner step is floored at 1. Warming outside the lock is the right place for it, and retiring the old session after the lock releases fixes a teardown that would have handed the callback silent blocks. The far-seek clamp keeps the wrap case cheap — a carry landing just past a loop wrap warms from zero and renders only those few samples, not a full window.
The swap capability is the correct gate: 0.5 advertised session with a swap that stopped and rewound, so supports('session') could not have told the two apart.
Both test findings are properly closed — a real moved placement instead of a copy of the playing session, and strictly-greater polled rather than raced.
Gates at this head. pnpm typecheck clean, pnpm build:native clean, pnpm test 40 files / 604 tests green.
The one thing left is on the thread: watch.md still says its audible item is open, and this is the pull request that closed it.
The plan's header counted an audible defect among its open items and §6 described it in the present tense, citing a startTimer(20) this branch deletes. §6's diagnosis predicted its own expiry — the real-time engine deletes the mechanism — so it closes with a dated resolution rather than an edit to its measurements, and the header counts only §5 as open.
|
Starting review of 3004245. |
minjudd
left a comment
There was a problem hiding this comment.
Approving 3004245. The last stale record is closed, and it is closed the right way — the diagnosis survives, only its tense and its status change.
The header now counts correctly. "One thing is open: §5's status-visibility question" is exactly right: §5's first bullet is struck through as resolved by chunk 1, and the status-visibility question is the only live one left. The audible item moves into the past with the date it died and what killed it.
§6 keeps its evidence. "The measurements stay as the record of why nobody built the lock-free handoff" is the part worth having — the 1 ms and 200 ms runs were established by ear against a reading that gave the wrong emphasis, and that reasoning outlives the mechanism it was about. Appending the resolution rather than rewriting the section also leaves the numbering alone, so watch.md §6 still points where every existing citation expects.
"The expiry date above arrived exactly as written" is fair. §6 deferred the fix on the prediction that the real-time engine would delete the mechanism, and it did, so the deferral was correct rather than merely lucky.
No inbound citation to §6 is left anywhere in docs or src, so nothing else is pointing at a claim that has changed.
I did not re-run the suite, because it cannot answer differently. This head is byte-identical to dc6bf23 outside docs/:
$ git diff --stat dc6bf23..3004245 -- . ':!docs'
(no output)
So the gates I ran at dc6bf23 stand as run: pnpm typecheck clean, pnpm build:native clean, pnpm test 40 files / 604 tests green.
Everything else carries over from dc6bf23, where I did the work: the classifier masking by position rather than by name, so an eq band's gain swaps as decision 5's edited chain and only the output track's window gains ramp; sha256 giving file windows a content identity the comparison needs and the engine ignores; discardUntil terminating on an unconditional delivered += n; the pre-roll and the retirement both moved off the lock; and the swap capability distinguishing a daemon that carries the transport from 0.5, which advertised session and stopped. The loop run by hand printed 1 level ramped, 1 level ramped, session swapped, session swapped, with the position readout continuing through both swaps.
And the correction I owed from that round stands too: the 3 levels ramped I called working at 90b2bb8 was the silent no-op this PR found and fixed, not the classifier behaving.
No findings.
…140) 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 `--live` flag retires; `--from` locates the session (which also pre-rolls the chain at the target, so it starts warm) and `--loop` wraps at the song's extent. The review round drew the loop semantics sharp: the authored `loop:` 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 `--loop` flag. 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. `--from` with `--loop` is 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 `--click` stays 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>.out` tmp 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, but `pnpm build:native` if your daemon predates #139, and `cd examples/bloom && field transport quit` if one is running — the watch path refuses a stale daemon). Then from `examples/bloom`: `field play creek` — no flag — prints `live 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 `--live` was the way to this path (it now errors as an unknown option, which is the retirement working). `field play creek --loop` adds `(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 --loop` refuses, naming `field play creek/track:main --from <position> --loop`, which still region-loops. `field play creek --watch`, then edit `songs/creek/tracks/kit-punch.yaml` changing `gain_db: 4` to `7`: the terminal prints `edit session swapped` within the debounce (the dirty subtree went live — audibly, the eq change lands), then `edit froze 3 stems` and a second `edit session swapped` a 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 3` starts the readout at `3.1.1`, and `field play creek/track:main` still prints `playing //songs/creek/track:main` — the artifact path, kept for explicit labels. Playback leaves the daemon running; it exits after five idle minutes, or `field transport quit` ends it now.
…o date (#176) The project plans had drifted from `main`, and one rule in `docs/projects/README.md` was keeping them that way. The rule held a project at `in-progress` and `priority: now` after its code shipped, until real music had been made with it. Projector defines `completed` as "the project no longer needs work", so the rule bent both fields. Ten of the twelve projects at `now` had shipped, and `project list` could not tell them from the two still being built. This change removes the rule, closes projects when their work is done, and brings every open plan up to date with `main`. Eleven projects complete. `project-core`, `multi-rate`, `cross-rate-live`, `realtime`, `reverbs`, `nested-tracks`, `voice-generation`, `recording` and `add-insert` shipped. `watch` was superseded when realtime's chunk 3 (#139) replaced its play half. `engine-umbrella` is abandoned, because the docs now use "engine" for `field-audiod`. Each `**Outcome:**` line names what shipped and which acceptance clauses stand short, so closing a project does not claim more than was proven. For example, `reverbs` records that creek's room was never chosen, and `recording` records that its latency compensation has never been checked against an Apollo take. Owed work that would otherwise have closed with its parent moves somewhere it stays visible. Five draft stubs carry it: `track-rename` from project-core §6, `pickups` from nested-tracks §1.6, `streaming-rings` from realtime §7, `comping` from recording §10, and `apollo-session` from recording §11, §12.10 and §13.2. `apollo-session` holds the work that waits on a take recorded on the Apollo: the loopback latency measurement, the checks owed to the first hardware session, and the `hardware/` schema. `add-insert`'s editor handoff moves into plugin-hosting's chunk 3, which builds the `field open` it needs. After the audit, `plugin-hosting` is the only project at `now`. `remote`, `ui` and `streaming-rings` are at `next`; remote §9.1 records why its last chunk can wait for the site's render worker. Everything else is at `later`, including `windows-portability`. `windows-portability` and `ui` stay `draft`, though #157–#161 and #163 implement them. Each plan gives the flip to `in-progress` to the change that answers its open questions, and those questions are still open on `main`. #157 and #163 answer them and flip the status in the same diff, so the status moves when they merge. Their priorities get revisited once those PRs are reviewed. The plans that stay open lose the close-condition Outcome lines the rule gave them, and their bodies carry their progress instead. Text the audit found stale is corrected after each claim was checked against the code or the site's plan: - `plugin-hosting` §2 and §7 pointed the cross-machine cache at `remote-asset-store`, but the `remote` plan took that role. - `remote` §9.11 gains the answer the site's plan gave in audiofield-io §10.15. - `lint-and-format`'s reformat cost was re-measured with #88's own probe. It is now 5,209 lines across 86 files, up from 1,916 across 40. The plan's copy of the probe reformats a temporary copy of `src/`, so pasting it never rewrites the repository. - `splice` no longer claims to be Field's first interactive surface. - `automation` gains the tempo-map conflict with playback §3.6 as an open question. - `docs/README.md`, `architecture.md`, `audio-engine.md` and `project-model.md` stop describing shipped work as future. `AGENTS.md` drops `afconvert` from its stack list, because project-core §5 recorded it as superseded. `project init` also refreshed the generated Projector section of `AGENTS.md` to version 2, which adds the template's paragraph on opening dependent work as a `gh stack`. ## Testing Run these from the repository root on this branch. The first four read files only, need nothing built, and leave no state behind. ```sh project check ``` You should see `Project plans are valid.` and no `instructions-outdated` warning. Any error here, or the warning still printing, means a frontmatter edit or the `AGENTS.md` refresh is wrong. ```sh project list ``` `now` should list only `plugin-hosting`. `next` should list `remote` as `in-progress`, and `streaming-rings` and `ui` as `draft`. `later` should list every project as `draft`, including `windows-portability`, `apollo-session`, `comping`, `pickups` and `track-rename`. `completed` should include the eleven projects above. A completed project that still has unbuilt work with no stub to carry it, or an open project with nothing left to do, means a status edit is wrong. ```sh grep -rn "Stays open\|neighbours' precedent\|Shipping the code does not finish" docs/ ``` This should print nothing. Any match is a leftover of the removed rule. ```sh git diff --check origin/main ``` This should print nothing. To check the `lint-and-format` figures, run the four-line probe in `docs/projects/lint-and-format/readme.md` from the repository root, then `git status`. The probe needs the network for `pnpm dlx prettier@3`, and it leaves a reformatted copy of `src/` in a `mktemp` directory. It should print `5209`, then `86`, and `git status` should still be clean. A modified file under `src/` means the probe wrote to the repository. The Outcome lines and corrections cite PRs, sections and code that were checked against `main` at `3d26d52`, and the site's plan in the `audiofield` repository. Each "stands short" claim names a section of its own plan, so you can confirm it with `project show <name>` and the cited section. <!-- projector-summary v=1 sha=66b04ee498828290a904d5c87095fd14dcd0d22f --> 📽️ **Projector summary** of 66b04ee: https://field.amnes.ac/reviews/176

Realtime chunk 3 (realtime.md §7, decision 5):
field play <song> --live --watchrecompiles the session on every project change and classifies the edit — sessions identical except window gains become ramps, sent per window and landing next block; anything else swaps the whole session, and the swap carries the transport: construction (parsing, preloading, pre-rendering children) happens before the lock, so the old session plays through the entire compile and the swap itself is one pointer move, position and playing state carried across. Latest compile wins. The watch loop is watchBuild's shape — debounced, one compile in flight, stale re-runs, a session that never dies on a mid-edit tree.What this replaces is the loop-wrap takeover, and it retires whole: the
reloadverb, the PendingReload queue and its wrap poll (Player stops inheriting juce::Timer), thereloadedevent and its schema arm, thereloadfeature,client.reload, the requeue path'scurrentPath, the loop-ui display that existed to narrate takeovers, and the artifact--watchpath in the CLI —play --watchnow routes to the live engine by name, and build-graph.md's watch-mode paragraph describes the live loop instead of the wrap. The daemon is 0.6. later.md's "audible loop takeover" line is deleted, resolved exactly the way it predicted ("the real-time engine deletes the mechanism"); an edit no longer waits for the wrap it no longer needs.The review round tightened both halves. The classifier's mask is positional now, not name-keyed: exactly the output track's window gains — the ones the ramp verb can actually reach — go blank in the comparison, so an eq band's
gain_db(an edited chain, decision 5's structural case) and a child window's gain (baked into buffers pre-rendered at load) swap instead of vanishing or silently ramping nothing. File windows carry the build outcome's sha256, so a source that changes bytes under a stable path — a regenerated take, a re-edited asset — swaps too instead of diffing tosame. On the daemon side a swap neither glitches nor gaps:locatewarms a rebuilt chain by rendering one warmup span (a reverb's tail, a limiter's window, a second per eq stage — the 60 dB threshold the design already uses) into the void before the position sounds, the expensive work runs outside the audio lock — construction and the warmup pre-roll before it, the old session's destruction after it — and the daemon advertises aswapfeature the watch path gates on, because a 0.5 daemon advertisessessionwith a swap that stops and rewinds. The watcher recompiles once after installing itself, so an edit made during daemon connection and session preload lands instead of waiting for an unrelated change, and a structural swap rebuilds the bars-and-beats context so the readout follows a moved tempo map.The suite moves from 629 to 604: the retired machinery took its twenty-seven tests with it (reload takeovers, the requeue repoint, the loop-ui renderer), and chunk 3 adds two — the edit classifier (a gain edit on the output track diffs to the exact ramp list; a moved clip, an eq band's gain, and a child window's gain each diff to a swap; identity diffs to same) and a socket test proving a swap of genuinely different content mid-play keeps
state: playingwith the position carried strictly forward. The chunk-2 golden and the whole remaining suite are untouched and green.Testing
From the repo root:
pnpm build && pnpm build:native && pnpm test— 40 files / 604 tests green. If a daemon from an older build is still running,cd examples/bloom && field transport quitfirst: the new watch path refuses a daemon that predates mid-play edits rather than driving it wrong. The live loop by hand, run before writing this:cd examples/bloom && field play creek --live --watch, then in a second terminal editsongs/creek/tracks/main.yamlchanging the pad placement'sgain_db: -6to-10— the playing terminal printsedit 1 level rampedwithin the debounce, with no interruption to playback; restore the file and it ramps back. An edit outside the output track's mixer surface swaps instead: changesongs/creek/tracks/keys.yamlgain_db: -14(the send into the shared room) to-10and the terminal printsedit session swapped, the music continuing from the carried position. Before this round that same edit printed3 levels rampedwhile changing nothing audible — the receive windows it names are baked into a pre-rendered buffer. What would show it wrong: any audible gap or reverb-tail dropout at the swap (the replacement chain now pre-rolls outside the lock), orfield play creek --loop --watchdoing anything but naming the live command that replaced it. Playback leaves the daemon running; it exits on its own after five idle minutes, orfield transport quitends it now.