Repository navigation
Voice chunk 1a: the generative recipe grows a voice kind - #58
Merged
Merged
Conversation
One schema serves music and voice recipes, discriminated by which of prompt/text is present rather than by a second type: — so variants, chosen, the hashes and field choose stay single-implementation, which is the whole reason voice-generation.md §1.6 refused a parallel recipe kind. Its parenthetical no longer holds: the refine was justified by the recipe being "a single object, not a discriminated union", and the layout migration made it a member of one. Verified before writing rather than assumed — zod v4 accepts a refined member and still narrows on the discriminant — so the decision stands on a different reason and §6 records the correction. Two things §1.6 left implicit, settled here. The kind split is enforced both ways: duration_seconds on a voice recipe is a field its generator would ignore, and voice_ref on a music recipe is the same defect mirrored, both rejected with the offending key in the issue path. And voice_ref carries a hash beside it, because §1.3's argument for a committed recording over a vendor's voice ID is provenance, and a name without a hash lets the recording change under a recipe that still claims to describe it. Also checked what §1.5 asserted: chatterbox-tts 0.1.7 resolves from PyPI in about a second, 126 packages, torch/torchaudio/transformers underneath.
Justin's call for bloom — creek's line generates with Chatterbox's own voice rather than waiting on a recording. The schema already allowed it, since voice_ref is paired with its hash rather than required, but nothing asserted it: a later tightening that made voice_ref required would look like a correctness fix and would break the only configuration in use. It also changes what the plan's open question is. Not "whose voice blocks this" but "whose voice improves it", answerable whenever a recording exists.
ninjudd
commented
Aug 8, 2026
ninjudd
commented
Aug 8, 2026
#58 review, both findings confirmed. P2: the schema paired voice_ref with its sha and nothing consumed either. A missing reference and a drifted hash both left `field check` green, so the recording could be absent or swapped under a recipe that still claimed to describe it — which is exactly the provenance guarantee §1.3 offers in place of a vendor's opaque voice ID. I argued that in the PR body and then did not enforce it. Validate now resolves a present voice_ref, and to a committed *asset* rather than any visible name, since a generated sound cannot carry provenance. verifyAssetHashes compares the declared sha against the ledger's recorded one, in the same pass that already proves recorded matches actual, so no file is hashed twice. Absent stays legal: that is the default-voice case bloom uses. Regressions cover missing, drifted and absent, and all three fail with the checks disabled. P3: the status line still said "Planned, deferred — nothing here is started" while the plan carried an as-built section, and the Goal and chunk 1 still said `field voice generate` after §4 settled on `field generate`. Both corrected, and the work moved from later.md to now.md, which is where the README's own model says it belongs once the work begins.
ninjudd
commented
Aug 8, 2026
ninjudd
commented
Aug 8, 2026
ninjudd
commented
Aug 8, 2026
…d rule #58 second review, three findings, all correct. P2: the hash map was built once across every ledger and keyed song assets by their bare name, but a bare name is scoped to its song. Two songs each holding a `ref-voice` meant the second overwrote the first, so one recipe reported false drift and the other passed against a recording from a different song. Both maps are now built inside the song loop, shared assets keeping their full label since that is already unique. Two-song regression added, and it fails against the global map. Notable that the fix I shipped last round created this: pinning the hash was right, and I reached for the cheapest lookup rather than the one that matched the namespace rule the schema's own `sourceRef` documents three files away. P3: §2's definition of done still required "a committed reference asset" after §6 made it optional, and still said "the `say` target stays as the scratch tier" after §5 recorded deleting it. Both amended in place with the amendments pointing at the sections that made them, which is also the honest version of the cost: there is no scratch tier to fall back to, so creek's clips have no source at all until this ships. P3: the now.md entry ran to three sentences carrying move history and chunk status. Both belong in the plan's status line, and the list's own header says a line wanting a second sentence is a line whose plan should be carrying it. Collapsed to work, link, and why it is urgent.
ninjudd
added a commit
that referenced
this pull request
Aug 8, 2026
Chunk 1 of voice-generation.md ends here: one verb over two generators, with `--prompt` reaching field-aced and `--text` reaching field-voiced. The recipe's `model:` records which one ran, which is what §1.7 settled the naming on. The kind split is checked before anything spawns. The schema already rejects a voice recipe carrying `duration_seconds`, but it does so on the way to disk, after the model has run; the CLI says `--bars is a music option` first, next to the namespace pre-flight that exists for the same reason. `voice_ref` resolves through the project model's own lookup rather than a copy of it. Both #58 findings were two readings of "which asset is this" disagreeing — a name resolved in the wrong namespace, and a hash that pinned nothing. There is one reading now: `lookupAsset`, used by validate to diagnose a ref, by `verifyAssetHashes` to compare its hash, and by generate to turn it into the bytes the worker reads. It also reports how many ledger rows answer to a name, because a schema-valid ledger can hold two, and generation that picks the first is generation from an arbitrary voice. A hash pins bytes, not a filename. Hashing the recording and handing the worker its path is a promise about one instant — the worker reads minutes later, after daemon start and a weights download — and re-hashing afterwards does not close the gap, since an edit undone before the run ends compares equal at both ends. So the reference is snapshotted first, and the snapshot is what gets hashed and what the worker reads. `field setup` became a gate rather than a label. `uv run` syncs by default, so "explicit, never automatic" described the command and not the behaviour: a fresh checkout installed torch and Chatterbox as a side effect of the first generate. Starting a worker now uses `--no-sync`, and an unusable environment is diagnosed before the spawn instead of surfacing as a sixty-second connect timeout. Getting that check right took three passes — a `.venv` directory turned out to prove nothing, since `uv sync --only-group dev` creates one, and `uv sync --check` turned out to download a CPython interpreter when it cannot find one, which made the gate against automatic installation perform one. It asks for the console script uv installs with the project, then for `uv sync --check --frozen --no-python-downloads`, and it detects uv itself with a question that names no project. ace-generation.md §6 records all three passes. Tested through a stub worker that the `FIELD_*_PYTHON` override lets stand in for a daemon: real client, real socket, real framing, no model. It holds at two points, before the reference read and after it, so a test can swap the recording under the worker and restore it before generate returns — the sequence that distinguishes the snapshot from a post-generation re-hash. Every property was checked by mutation, including against the fixes that look right and are not. Nothing here has loaded Chatterbox. Everything verifiable without weights is verified, and the rest — that the model produces audio, at 24 kHz, wanting a `normalize` wrapper at the project rate — is chunk 2's first act.
ninjudd
added a commit
that referenced
this pull request
Aug 11, 2026
validate and buildGraph each built their own copy of the ref-to-file relation — a lazy function and an eager map, seeded alike and extended at different moments. committedFileResolver is now the one construction, exported from the model and imported by the graph: the shared ledger, the song's ledger, and a generative entry's chosen take, in that order, undefined for anything that renders. The graph's mid-mint insertion of chosen variants goes — the resolver reads song.genTakes directly, which is the same data the minting read. Behavior is unchanged; the point is that it now cannot drift, which is the #58 rule applied to the one relation still living twice.
ninjudd
added a commit
that referenced
this pull request
Aug 11, 2026
validate and buildGraph each built their own copy of the ref-to-file relation — a lazy function and an eager map, seeded alike and extended at different moments. committedFileResolver is now the one construction, exported from the model and imported by the graph: the shared ledger, the song's ledger, and a generative entry's chosen take, in that order, undefined for anything that renders. The graph's mid-mint insertion of chosen variants goes — the resolver reads song.genTakes directly, which is the same data the minting read. Behavior is unchanged; the point is that it now cannot drift, which is the #58 rule applied to the one relation still living twice.
ninjudd
added a commit
that referenced
this pull request
Aug 11, 2026
validate and buildGraph each built their own copy of the ref-to-file relation — a lazy function and an eager map, seeded alike and extended at different moments. committedFileResolver is now the one construction, exported from the model and imported by the graph: the shared ledger, the song's ledger, and a generative entry's chosen take, in that order, undefined for anything that renders. The graph's mid-mint insertion of chosen variants goes — the resolver reads song.genTakes directly, which is the same data the minting read. Behavior is unchanged; the point is that it now cannot drift, which is the #58 rule applied to the one relation still living twice.
ninjudd
added a commit
that referenced
this pull request
Aug 11, 2026
"Where do a committed source's bytes live" was answered by two constructions: validate's lazy function and buildGraph's eager map, seeded alike and extended at different moments. They had to agree — the loop tiling validate approves is what the planner plans — but nothing made them agree beyond parallel maintenance, which is exactly how the two readings of "which asset is this" came to disagree in #58. `committedFileResolver` is now the one construction, exported from the model and imported by the graph: the shared ledger, then the song's ledger, then a generative entry's chosen take, `undefined` for anything that renders. The graph's mid-mint insertion of chosen variants goes entirely — the resolver reads `song.genTakes` directly, which is the same loader data the minting read, so the map that had to be kept in step no longer exists. Behavior is unchanged; the point is that it now cannot drift. A focused test pins the resolver's answers directly (ledger name, `gen:` ref to the chosen variant, `track:` ref and unknown name to undefined), on top of the existing loop-tiling and build tests that exercise both consumers. **Testing** From the repo root: `pnpm build && pnpm test` — 39 files, 624 tests, green (623 from the base branch plus the new resolver test). Then `cd examples/bloom && field check && field build creek` — creek exercises every arm of the resolver in one build: shared pins, song-ledger assets, and chosen generative takes, through both the validate pass (`check`) and the graph (`build`). What would show this wrong: any divergence between `field check` accepting a loop and `field build` planning it — before this change that required the two copies to disagree; now there is no second copy to disagree with.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First slice of voice-generation.md chunk 1: the recipe schema grows a voice kind. No worker yet — this is the contract the worker and the CLI both build against, and it needs no model to be worth landing.
One schema, two kinds
§1.6 refused a parallel recipe kind, because two files differing only in which model family wrote them would split the variant tooling for no reason. So
generativesounds now discriminate on which ofprompt(music) ortext(voice) is present, andvariants,chosen, the hashes andfield choosestay single-implementation.prompttextlyrics,bpm,bars,duration_secondsvoice_ref,voice_ref_sha256§1.6's stated reason no longer holds; its conclusion does
The decision justified a
refineby saying "the recipe schema is a single object, not a discriminated union." project-layout.md §4 has since made the recipe agenerativesound insounds/<name>.yaml, andsoundSchemais a discriminated union ontype:.I checked before writing rather than assuming: zod v4 accepts a refined member and still narrows on the discriminant, so the approach survives — on a different reason than the one recorded. §6 of the plan notes the correction rather than leaving a decision resting on a false premise.
Two things the decision left implicit
The split is enforced in both directions. A voice recipe carrying
duration_secondsdeclares a field its generator would ignore; a music recipe carryingvoice_refis the same defect mirrored. Both rejected, with the offending key in the issue path.voice_refis a name and a hash. §1.3's argument for a committed recording over a vendor's opaque voice ID is provenance — and provenance needs the bytes pinned, or the recording changes under a recipe that still claims to describe it.voice_ref_sha256sits beside it, required together, exactly as a variant is pinned.Backend feasibility, checked
§1.5 picked Chatterbox from its capabilities.
chatterbox-tts0.1.7 resolves from PyPI in about a second — 126 packages, torch/torchaudio/transformers underneath — so the choice now rests on something more than a README.Verification
352 tests pass (346 + 6),
pnpm typecheckclean. Six new schema tests cover both kinds, the chimera, the blank, both directions of the kind split, the name-without-hash case, and that adding a refine did not loosen the strict object.Next
field-voiced(Chatterbox behind the job-spec protocol) and the CLI seam — per §4,field generateis the verb over the generator category, not a newfield voice generate.Note
Medium Risk
Schema changes affect all generative recipe validation and YAML emission order; incorrect refine logic could reject valid music recipes or accept invalid voice shapes before the worker lands.
Overview
Extends the
generativesound contract so one schema covers music (prompt+ optional music fields) and voice (text+voice_ref/voice_ref_sha256) without forking variants,chosen, orfield choose.generativeSoundSchemainsounds.tsadds optional voice fields, makespromptandduration_secondsoptional at the object level, and usessuperRefineto require exactly one ofpromptortext, reject cross-kind fields (music-only vs voice-only) with keyed issue paths, and requirevoice_refandvoice_ref_sha256together so reference recordings are pinned like variant hashes.soundOrderis updated for the new keys.generative.test.tsadds six tests for both kinds, chimera/neither cases, bidirectional field guards, paired voice ref validation, and strict-object behavior after the refine.voice-generation.md§6 records that the §1.6 “not a discriminated union” rationale is outdated while zod v4 still allows a refined union member, plus notes on bidirectional enforcement and Chatterbox PyPI feasibility.Reviewed by Cursor Bugbot for commit 67bb5f4. Configure here.