Repository navigation
ACE generation chunk 2: recipes as project citizens, bloom ace choose - #18
Conversation
Generation recipes get their formal schema and join the project model: loaded, validated (filename-is-key, variant paths, chosen in range), hash-verified by bloom check, canonically formatted by bloom fmt, and written through the same schema by bloom ace generate. Each variant is addressable as //songs/<song>/generation:<name>-<n> — playable for audition, deliberately not referenceable by clips. Promotion is bloom ace choose: verifies the bytes still match the recipe, declares the variant in assets.yaml where it lies (no copy — promotion is a reference, build-graph.md), records chosen in the recipe, and re-choose moves the reference without ever clobbering an unrelated asset. Also fixes canonicalizeDocument ranking for pairs added via Document.setIn, and restores PYTHONPATH in the aced client test (re-review nit).
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 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 edeaaaf. Configure here.
ninjudd
left a comment
There was a problem hiding this comment.
Reviewed at head edeaaaf (local checkout matches). Typecheck clean, 180/180 tests, CI green. One P3 of my own (inline), and I verified both Bugbot findings by execution — details below, they're real and both fixes are one-liners. The design is right throughout: recipes as schema-validated project citizens, variants addressable-but-not-clip-referenceable, and promotion as a reference move rather than a byte copy is exactly build-graph.md's model.
- P3 — a hand-edited
../variant path passesbloom checkbut breakschoose's own reversibility promise. Inline onproject.ts. Verified end to end in a scratch project; the failure mode is a promotion that succeeds once and then refuses to move with a misleading error.
Bugbot adjudication (both CONFIRMED by execution):
- Fractional
--bpmorphans WAVs — confirmed, and the chain is exactly as claimed.parseBpm('30.5')returns 30.5 (my #17 suggestion said "the daemon's own ranges", and the daemon checks range but not integrality — so this one traces partly to my own suggested shape). The daemon generates happily (itsint()truncates to 30 for the model), the CLI renames the WAVs, and thengenerationRecipeSchema.parsethrows onbpm: z.number().int()— variants on disk, no recipe, andbloom ace generatecan't be re-run under the same name because of the exists guard. One-line fix:Number.isIntegerinparseBpm, which also closes the gap where the model actually used 30 while a recipe would have recorded 30.5. chooseskips slug validation — confirmed with nuance. From a second song,bloom ace choose '../../opener/generation/keys' --song closer --variant 2 --as stolenreally does read the other song's recipe (it got as far as resolving variant files, which then miss because they resolve against--song's generation dir). Full cross-song corruption needs a contrived file layout with a matching hash, so severity is modest — but thechosenwrite targets the traversed recipe path while assets go to--song, exactly the split-brain Bugbot describes, andaceGeneratealready has theisSlug(name)guard this omits. Same one-line fix, and it's a cousin of my inline finding: both are path-shaped strings around choose that the code trusts.
Verified by execution:
- Real-CLI smoke in a scratch project:
fmt(no-op on a canonical recipe),checkok,build/explain/query deps(...)all handle generation labels correctly (cached leaf, recorded hash + stat'd bytes, no deps). These graph paths had no unit tests — they all work. - The full choose lifecycle through the CLI: promote →
checkok → re-choose moves the reference (one asset entry,chosen: 2in canonical position) → tampered variant refused with the right message →--variant 0/abcdie at the flag. - Drift diagnosis: a tampered variant WAV fails
bloom checkwith the actual hash named, exit 1. - The
emit.tsfix is load-bearing and its test catches it: I removed the added line and re-ran — the fmt-idempotence assertion fails exactly as described.chosenwritten viasetInlands afterseed, not appended. - Field confirmation (read-only):
bloom checkpasses against field at this head — including its in-progress working tree, where the still-water-keys promotion and the new keys track already exercise the promoted state against real generated audio. The chunk-1 recipe loads with zero edits, as claimed.
Verified by reading, no issues found:
- The assets.yaml write machinery is careful in the ways that matter: the
isSeqguard forassets:-null files, replace-vs-append via the parsed index, the+ sepon the generation prefix (so generationfoocan never claimfoo-bar's promotions), and refusing to clobber anything a previous choose didn't create. - The write ordering (assets first,
chosensecond) has the right crash semantics and records why — a crash leaves a working promotion the recipe understates, repaired by re-running, never achosenpointing at a promotion that didn't land. - The
existsSyncrecipe guard makes generations immutable by name, which closes the nasty promote-then-regenerate hazard (regenerating over a promoted variant would have silently broken the asset's hash) before it can exist. aceGeneratewriting through schema + canonicalize means it cannot emit a recipe the loader rejects orfmtwould rewrite — provenance and formatting guaranteed at the source.- Every
node.kinddiscrimination site treats generation as a leaf; nothing falls through to the rule path. - The docs additions match the code (promotion semantics, addressability, §5 follow-ups carrying the #17 body notes forward as promised), and §5 was appended, not renumbered.
The PYTHONPATH save/restore nit from my #17 re-review rode along as promised. Ready for Justin's merge once the three small fixes land.
The ../ escape passed the normalize check (it IS normalized) and resolveAssetFile's project-root guard, then broke choose's documented re-choose by tripping the same-generation prefix guard — containment is now validated, not assumed. parseBpm requires integers so a fractional --bpm fails at the flag instead of as a recipe-schema throw after the WAVs landed. aceChoose slug-checks both the generation name and --song before any path join.
ninjudd
left a comment
There was a problem hiding this comment.
Scoped follow-up at head f53a2e6, covering both post-review commits. No findings — all three fixes verified by re-running the original repro scenarios against this head, and the thread resolutions are accurate.
../variant paths: my exact end-to-end scenario (hash-matching../escapee.wav) now failsbloom checkwithvariant file path must stay inside generation/, exit 1 — containment validated where the normalize check lives, so the docs, validator, and choose's prefix guard finally agree. The.split('/').includes('..')shape is right: interior..segments were already caught by the normalize check, so leading escapes were the only survivors, and now nothing survives. The scenario is pinned as a regression test as promised.- Fractional
--bpm:--bpm 30.5dies at the flag (bpm must be an integer in [30, 300]) — no generation, no orphaned WAVs, no burned name, and the model-used-30-recorded-30.5 skew is impossible. - Slug guards in choose: both traversal shapes refused before any path join —
choose '../../opener/generation/keys'and--song '../opener'each fail with the lowercase-slug error. Closing the--songhole Bugbot didn't flag was the right catch;generatereally is shielded by its loaded-project lookup andchoosewasn't.
0361961 is four doc lines (clip looping in next.md, with field's hand-tiled keys loop as the honest motivator) — read, no issues; it adds to the list without renumbering anything.
Typecheck clean, 183/183 tests, CI green on this head. Ready for Justin's merge.
Docs only. ace-generation.md status → Complete (2026-08-05, #17 + #18) — field demonstrates the full loop (generate → audition variants in the mix → choose → clip the promoted asset into creek), meeting §2's definition of done. The plan's further verbs (extend, repaint) are future phases. Removes the plan from now.md (work genuinely over) and the stale duplicate line from next.md that should have left when the work started. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Documentation and project-list edits only; no code or runtime behavior changes. > > **Overview** > **ACE generation** is marked **Complete** in `ace-generation.md` (2026-08-05, #17 + #18): both chunks shipped, with field exercising generate → audition variants → `choose` → clip into creek; verbs like `extend`/`repaint` stay future work, with follow-ups in §5. > > Project tracking matches that closure: the **ACE generation** line is removed from `now.md` (work genuinely over) and the stale duplicate entry is removed from `next.md`. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 72e7530. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->

Chunk 2 of ace-generation.md §4: variants as takes.
What's here
generationRecipeSchema+ KeyOrder):songs/<song>/generation/<name>.yamlis now a validated project file.loadProjectloads it,validateenforces filename-is-key, normalized/safe/existing variant paths, andchosenin range;bloom checkhash-verifies variant content;bloom fmtcovers recipes.bloom ace generatewrites through the same schema + canonicalizer, so a fresh recipe can never be one the loader rejects.//songs/<song>/generation:<name>-<n>— a new graph node kind, playable viabloom playfor audition and explainable, but deliberately not referenceable by clips or rules. Promotion is the only path from variant to input.bloom ace choose <name> --song <s> --variant <n> [--as <asset>]: verifies the variant's bytes still hash to what the recipe recorded (drifted output is diagnosed, never promoted), then declares it inassets.yamlin place — no bytes copied, per build-graph.md's "promotion is a reference to a content-addressed artifact — cheap, and reversible". Recordschosenin the recipe (written second, so a crash between writes understates rather than lies). Re-choose moves the reference; it only ever replaces an entry a previous choose created, and refuses name collisions with unrelated assets (--asroutes around them).canonicalizeDocument: pairs added viaDocument.setIncarry plain-string keys, whichkeyNamedidn't rank — programmatic edits ended up appended instead of in canonical position. One-line fix, caught by the new fmt-idempotence test.Verified
still-water-keysrecipe loads, checks clean, and both variants appear inbloom query //songs/creek/...and explain with their recipe hashes.Field's demo commit (promote a variant into creek + a keys track) follows after this merges.
Note
Medium Risk
Changes project loading, validation, and mutable
assets.yamlpromotion logic; safeguards (hash checks, collision rules) limit but do not eliminate risk to referential integrity.Overview
ACE chunk 2 turns
songs/<song>/generation/<name>.yamlinto a validated project file: load,bloom check(variant hashes), andbloom fmtall apply.bloom ace generatenow emits recipes through the same schema and canonicalizer so fresh output cannot disagree with the loader.Numbered variants are graph nodes at
//songs/<song>/generation:<name>-<n>— auditionable viabloom playand explainable, but not clip or rule inputs until promoted.bloom ace choosepromotes a variant by declaring it inassets.yamlin place (no file copy), verifies bytes against the recipe SHA, recordschosenon the recipe (written after assets so a crash understates rather than lies), supports re-choose and--as, and refuses unrelated name collisions or drifted content.The build graph treats generation nodes like committed sources (hash identity, no execution).
canonicalizeDocumentnow ranks keys fromDocument.setIn(plain strings), so programmatic YAML edits stay in canonical order.Reviewed by Cursor Bugbot for commit edeaaaf. Configure here.