Skip to content

ACE generation chunk 2: recipes as project citizens, bloom ace choose - #18

Merged
ninjudd merged 3 commits into
mainfrom
feat/ace-choose
Aug 6, 2026
Merged

ninjudd merged 3 commits into
mainfrom
feat/ace-choose

Conversation

@ninjudd

@ninjudd ninjudd commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Chunk 2 of ace-generation.md §4: variants as takes.

What's here

  • Recipe schema (generationRecipeSchema + KeyOrder): songs/<song>/generation/<name>.yaml is now a validated project file. loadProject loads it, validate enforces filename-is-key, normalized/safe/existing variant paths, and chosen in range; bloom check hash-verifies variant content; bloom fmt covers recipes. bloom ace generate writes through the same schema + canonicalizer, so a fresh recipe can never be one the loader rejects.
  • Variants are addressable: //songs/<song>/generation:<name>-<n> — a new graph node kind, playable via bloom play for 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 in assets.yaml in place — no bytes copied, per build-graph.md's "promotion is a reference to a content-addressed artifact — cheap, and reversible". Records chosen in 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 (--as routes around them).
  • Fix in canonicalizeDocument: pairs added via Document.setIn carry plain-string keys, which keyName didn't rank — programmatic edits ended up appended instead of in canonical position. One-line fix, caught by the new fmt-idempotence test.
  • The PYTHONPATH restore nit from the ACE generation chunk 1: bloom-aced worker, bloom ace generate end to end #17 re-review.
  • Docs: project-model.md "Generation recipes" concretized; ace-generation.md gets a §5 Follow-ups (duration floor, mid-generation quit, ACE-Step's cwd cache).

Verified

  • 180/180 tests (10 new: loader validation, drift detection, playability, choose/re-choose/collision/drift-refusal, fmt idempotence after both writes).
  • Live against field: the chunk-1-written still-water-keys recipe loads, checks clean, and both variants appear in bloom 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.yaml promotion logic; safeguards (hash checks, collision rules) limit but do not eliminate risk to referential integrity.

Overview
ACE chunk 2 turns songs/<song>/generation/<name>.yaml into a validated project file: load, bloom check (variant hashes), and bloom fmt all apply. bloom ace generate now 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 via bloom play and explainable, but not clip or rule inputs until promoted.

bloom ace choose promotes a variant by declaring it in assets.yaml in place (no file copy), verifies bytes against the recipe SHA, records chosen on 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). canonicalizeDocument now ranks keys from Document.setIn (plain strings), so programmatic YAML edits stay in canonical order.

Reviewed by Cursor Bugbot for commit edeaaaf. Configure here.

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).

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ 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.

Comment thread src/commands/ace.ts Resolved
Comment thread src/commands/ace.ts Resolved

@ninjudd ninjudd left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

  1. P3 — a hand-edited ../ variant path passes bloom check but breaks choose's own reversibility promise. Inline on project.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 --bpm orphans 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 (its int() truncates to 30 for the model), the CLI renames the WAVs, and then generationRecipeSchema.parse throws on bpm: z.number().int() — variants on disk, no recipe, and bloom ace generate can't be re-run under the same name because of the exists guard. One-line fix: Number.isInteger in parseBpm, which also closes the gap where the model actually used 30 while a recipe would have recorded 30.5.
  • choose skips slug validation — confirmed with nuance. From a second song, bloom ace choose '../../opener/generation/keys' --song closer --variant 2 --as stolen really 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 the chosen write targets the traversed recipe path while assets go to --song, exactly the split-brain Bugbot describes, and aceGenerate already has the isSlug(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), check ok, 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 → check ok → re-choose moves the reference (one asset entry, chosen: 2 in canonical position) → tampered variant refused with the right message → --variant 0/abc die at the flag.
  • Drift diagnosis: a tampered variant WAV fails bloom check with the actual hash named, exit 1.
  • The emit.ts fix is load-bearing and its test catches it: I removed the added line and re-ran — the fmt-idempotence assertion fails exactly as described. chosen written via setIn lands after seed, not appended.
  • Field confirmation (read-only): bloom check passes 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 isSeq guard for assets:-null files, replace-vs-append via the parsed index, the + sep on the generation prefix (so generation foo can never claim foo-bar's promotions), and refusing to clobber anything a previous choose didn't create.
  • The write ordering (assets first, chosen second) has the right crash semantics and records why — a crash leaves a working promotion the recipe understates, repaired by re-running, never a chosen pointing at a promotion that didn't land.
  • The existsSync recipe 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.
  • aceGenerate writing through schema + canonicalize means it cannot emit a recipe the loader rejects or fmt would rewrite — provenance and formatting guaranteed at the source.
  • Every node.kind discrimination 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.

Comment thread src/model/project.ts Resolved
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 ninjudd left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 fails bloom check with variant 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.5 dies 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 --song hole Bugbot didn't flag was the right catch; generate really is shielded by its loaded-project lookup and choose wasn'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.

@ninjudd
ninjudd merged commit 0c9b076 into main Aug 6, 2026
1 check passed
ninjudd added a commit that referenced this pull request Aug 6, 2026
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 -->
@ninjudd
ninjudd deleted the feat/ace-choose branch September 28, 2026 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant