Skip to content

Layout migration: sounds, types, sources — the project-layout revision made real - #31

Merged
ninjudd merged 8 commits into
mainfrom
feat/layout-migration
Aug 6, 2026
Merged

ninjudd merged 8 commits into
mainfrom
feat/layout-migration

Conversation

@ninjudd

@ninjudd ninjudd commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Implements the full project-layout.md revision (#30) plus its §4 vocabulary, decided mid-migration so code and field only migrate once.

The format (project-layout §1, §4): authored specs are one file per sound — songs/<song>/sounds/<name>.yaml, discriminated by type: (supercollider, say, normalize, eq, limit, reverb, generate), fed by source: with three syntactically disjoint spellings: a bare slug resolves in the song's one namespace (assets and sounds together, collisions are check errors), //shared/assets:<name> crosses into the shared scope (the only cross-scope reference), and for supercollider a path names the program file (bare filenames resolve in shared/instruments/). Mixes are per-file in mixes/; clips carry the same source: field. shared/ lands on three contract-named shelves — instruments (make sound), samples (are sound), plugins (change sound) — with shared/assets.yaml as the shared ledger.

Deliberate generation (§1.4, §4.8): generate sounds carry provenance + variants + chosen:; variants live in audio/<sound>/<n>.wav and audition as sounds:<name>-<n>; the sound's own label resolves to the chosen variant, so bloom choose is a pure repoint (one-line diff, every clip follows) and the ledger-copy promotion (and --as) is gone. bloom generate/choose/setup replace the ace prefix, no aliases.

The engine (§4.7): executors are Generator<T> in src/generators/ — §1.2's own noun; a deliberate type has no in-graph Generator, which is the trigger policy in the type system (BuildableSound). The action-key JSON keeps its serialized rule field as a deliberate fossil, so the only re-key is the sc-render → supercollider type value — verified on field: exactly the two SC sounds re-rendered (bit-identically), and every stem, mix, effect, and say render came through the whole migration as cache hits, ending at a full //... build with zero executions.

Safety: the old layout (targets.yaml, mix.yaml, generation/) is diagnosed with pointers, never silently ignored; generation-node inputs get the same tamper verification as assets; bloom explain speaks type:; "target" retires from CLI output in favor of label.

Docs: project-model.md and build-graph.md rewritten for the migrated layout (pointer note replaced); project-layout.md gains §4.6–4.8 (instruments merge with the loops-precedent reasoning, Generator naming with renderer/synths recorded as rejected, choose-repoints) and in-place notes at §1.1/§1.4/§1.6/§3; project-core §3.4, ace-generation, and voice-generation carry back-pointers.

231 tests (8 new shared-scope, reworked choose suite). field's migration — including the demo shared sample clipped across the scope boundary — is staged locally and lands on merge.


Note

High Risk
Flag-day layout and vocabulary touch loading, the graph, CLI, and every YAML reference path; wrong migration or missed renames would break projects until field migrates, though diagnostics and broad test coverage reduce silent breakage.

Overview
This PR lands the project-layout revision: authored specs move to per-file sounds/ and mixes/, YAML uses type: and unified source: (song namespace, //shared/assets: pins, program paths for SuperCollider), and shared/ is three shelves plus shared/assets.yaml.

Deliberate generation is no longer generation/ + ledger promotion: bloom generate writes a generate sound and variants under audio/<name>/, and bloom choose only updates chosen: so //songs/.../sounds:<name> and clips follow repoints—ace / --as are removed.

Engine rename: src/rules/ → src/generators/, RuleImpl → Generator, sc-render → supercollider (action-key JSON still serializes the field as rule). CLI build/explain/query speak labels and print type: on explain.

Safety: leftover targets.yaml, mix.yaml, and generation/ are diagnosed (not read); docs and project lists are updated; tests replace the ACE choose suite with choose-as-repoint coverage.

Reviewed by Cursor Bugbot for commit ea67104. Configure here.

ninjudd added 4 commits August 5, 2026 22:37
…dger, generate/choose verbs

WIP snapshot — docs and PR held pending the vocabulary question.
Decided mid-migration, before any §1.3 file shape shipped, so the
implementation and field only migrate once. targets/ becomes sounds/
(contract-named like the shared shelves; audio is committed bytes, a
sound is a definition — and a sound wrapped in an effect is a
different sound, so the algebra closes). rule: becomes type:, the
format's existing discriminator convention (tracks, eq bands), which
also stops lying about generate. asset:/target:/program: unify as
source: with syntactically disjoint spellings — bare slug (song
namespace, now shared with assets, enforced), // label (cross-scope,
answering §3's open question), path (program file; a bare filename
resolves on the type's home shelf, never a search path). sc-render
becomes supercollider; 'target' retires as a term. Recorded as §4 so
existing citations stay stable. Also re-flows two overlong lines from
the review-fix commit.

@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 1 potential issue.

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 ea67104. Configure here.

Comment thread src/commands/import.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 ea67104. CI green; two P3s inline (a docs-vocabulary polish batch, and generate's missing audition-label pre-check), plus Bugbot's import finding, which I reproduced — it's real and worth fixing alongside. Everything else verified clean, including the migration's central empirical claims, several of them by execution.

A note on method first: the working tree went dirty mid-review (the generate → generative rename is visibly in flight, tests half-updated), so I verified the committed head from a git archive copy in my scratchpad rather than the shared checkout — nothing in your tree was touched, and the local test failures I saw are the in-flight edit's, not the PR's. This review covers ea67104; the rename commit will need its own look when it lands.

Verified by execution (scratchpad copy of the head):

  • Typecheck clean; 214 passed / 17 env-skipped of 231 (the archive lacks the built daemon binary; CI ran the full set green).
  • The bit-identical re-render claim is provable from field's action cache, and it holds: exactly two old sc-render entries and two new supercollider entries, whose recorded output hashes match pairwise (2236bd… and 590d87…) — new keys, same bytes. The other 67 cached actions (eq, mix, normalize, reverb, say, track-render) kept their old keys, consistent with everything-else-cached.
  • All three old-layout diagnostics fire with pointers (targets.yaml, mix.yaml, generation/), never silent.
  • The one-namespace diagnostic fires (sound colliding with asset), as does unknown-source, unknown-shared-asset, and the unchosen-generate message (bloom choose gen1 first).
  • The whole shared-scope + choose chain works end-to-end: pinned a sample in shared/assets.yaml, clipped it as //shared/assets:water beside a source: gen1 generate sound; choose repointed (one-line diff), check went clean, the stem built consuming both and rebuilt as a full cache hit.
  • The new generation-node tamper guard refuses correctly: appending a byte to the chosen variant → refusing to build: input //songs/verse/sounds:gen1 content does not match its recorded sha256.

Verified by reading, no issues found:

  • The action-key story is airtight: parameters exclude type exactly as they excluded rule, wiring fields cover the renamed source fields, the serialized key keeps the rule spelling (the recorded fossil), so the only re-key is the sc-render → supercollider value — which the cache forensics above confirm empirically. planTrack preserves the spec shape and the committed-by-hash / buildable-by-name source ordering.
  • Check remains the gate: an unchosen generate sound diagnoses at validate; the graph never registers its bare label, so nothing downstream can meet it. Variant containment is normalize-then-prefix (structurally closing the ../escapee class from #18). Audition-label collisions (<name>-<n>) are diagnosed against both sounds and assets.
  • §4's record-keeping is the discipline at its best: in-place amendment notes at §1.1/§1.4/§1.6/§3, appended section, rejected alternatives with reasons, and the §1.4 follow-on honestly relabeled "landed inside the migration, forced by §4.3." The three back-pointed records (project-core §3.4, ace-generation, voice-generation) all read correctly cold.
  • refLabel's classification (shared → assets → sounds) matches validate's resolution order; a re-choose flows content hashes through every consumer's key, so stems re-render exactly when what they play changes — scope-stable references with correct invalidation.
  • Field's staged migration matches §2.2–2.3: programs → shared/instruments/, recipe → sounds/, variants → audio/still-water-keys/<n>.wav, and the demo shared sample (creek-water) clipped across the boundary in the new water track.

Two housekeeping observations, no threads: (1) field has an untracked leftover songs/creek/targets.yaml — its deletion is staged, but the file still exists on disk with old content, so post-merge field will sit check-red on the old-layout diagnostic until it's actually removed; worth deleting before the merge story is "field migrates on merge." (2) The variant-collision message says audition label "x-1" collides with "x-1" — naming the same string twice; "collides with an existing sound/asset" would say which kind it hit.

On Bugbot's import finding: confirmed by execution — bloom import tone.wav --name gen1 with sound gen1 present succeeds and leaves the project check-red with the §4.3 collision. Same species as my inline P3 on generate: the namespace guard exists (generate has it for assets), it just isn't symmetric. One fix can cover both directions.

Comment thread docs/projects/all/project-layout.md Resolved
Comment thread src/commands/generate.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.

Addendum at head 6925868, covering the fix round and the two rename commits (9475e28 generative, d22caff stem) that postdate the reviewed head. The fixes are all genuinely in — every resolved thread carries its fix — but the rename commits introduce two P3s of exactly the record-integrity species this repo polices, inline. Both are sentence-level; worth landing before the merge that signs the record off.

Fix round, verified:

  • takenSongNames is the right shape: assets + sound filenames + every audition label a generative sound mints, safeParse-tolerant so pre-flight never crashes on a file check owns diagnosing. generate now checks everything the run would mint (name + N labels) before model-minutes; import refuses shadowing before copying a byte. Both new tests pin the two directions; 233/233 pass here, typecheck clean (in place — the tree is clean at head this time).
  • Docs: the §7 cite now names project-core.md; overview.md's glossary pass is better than asked (Target → Label is the §4.5 retirement done properly, and dropping the loops shelf from the Project entry catches a straggler I'd missed); the variant-collision message now says what it hit.
  • Bugbot's thread, mine, and the docs thread all resolved with the fix on the branch — confirmed.

The rename commits, verified by execution:

  • The stem re-key claim holds forensically: field's action cache has exactly 6 stem-keyed outputs byte-identical to old track-render-keyed outputs — the six migration-time stems re-rendered deterministically under new keys (the other 9 stem entries postdate the rename: water track, subsequent edits). Consistent with mixes staying cached, since mix inputs are stem output hashes.
  • Field end-to-end at this head: bloom check clean, bloom build //... = 20/20 cached, zero executions. The leftover targets.yaml is confirmed gone.
  • generative re-keys nothing (no Generator, no action keys) — confirmed no cache impact by reading, and the schema/graph/loader renames are mechanical and complete (no stale 'generate' type strings).

The two P3s, in one sentence each: inserting decision 8 renumbered §4.8 → §4.9 and silently broke three cross-file citations (the §4 preamble's own warning, realized); and the stem rename — a §4-class decision with a real re-key cost — has no record entry at all, while its commit message cites a §4.10 that doesn't exist.

Comment thread docs/projects/all/project-layout.md Resolved
Comment thread docs/build-graph.md Resolved
ninjudd added a commit that referenced this pull request Aug 6, 2026
Plan doc for `bloom play --loop --watch` (and the underlying `bloom
build --watch`), sketched with Justin and decided: v1 swaps at the loop
wrap (daemon gains a `reload` that queues takeover; you always hear
whole passes), with the bar-synced in-place swap recorded as the
successor rather than built now.

The load-bearing decisions: a red project never stops the music (`check`
gates every rebuild; half-saved files are the common case); "did
anything audible change" is an output-hash question the cache answers,
so `fmt` and comment edits swap nothing while a fader move re-runs one
sum; trigger policy holds under watch for free (build never generates
generative sounds), which makes `bloom choose` against a running watch
live variant A/B-ing; and slow renders can't glitch — the old mix loops
until the new artifact lands atomically.

Queued in next.md behind the MCP surface line. Written in the §4
vocabulary that lands with #31; nothing here depends on the migration
beyond spellings. Note next.md is also touched by #31 — whichever merges
second gets a trivial rebase.
@ninjudd
ninjudd merged commit 42accda into main Aug 6, 2026
1 of 3 checks passed
ninjudd added a commit that referenced this pull request Aug 6, 2026
#31 merged and field migrated (field 7fbdbc5, the sounds layout plus the
first shared sample), so this updates the two status lines that said the
migration was still staged: project-layout.md's status line now records
done with the field commit, and now.md drops the layout-migration line
per the list rules (delete when genuinely over). Docs only.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Documentation-only edits to project status and now.md; no code or
build behavior changes.
> 
> **Overview**
> **Closes out documentation** for the project layout migration after
#31 and the field repo migration (commit `7fbdbc5`).
> 
> In `project-layout.md`, the **Status** line moves from “Decided” with
migration still staged to **Done**, citing #31 for loader/CLI and §4
vocabulary and the field commit for the sounds layout plus the first
shared sample.
> 
> In `now.md`, the **Layout migration** bullet is removed under the list
rule that work is deleted when genuinely over; **Project core** remains
the only active line.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
a7e760b. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
ninjudd added a commit that referenced this pull request Aug 7, 2026
The `voice: Siri` test asserted two consecutive renders were
byte-identical. That failed twice on CI in two days (#31, #41), both
times on changes that cannot touch audio, with genuinely different
hashes — and passes every time on a machine where the voice is long
installed.

That is not flakiness to retry around; it is a false assertion. `Siri`
selects the machine's Spoken Content voice, which the design already
accepts may be fetched, warmed, or changed by a Settings toggle — the
recorded price of reaching the best voices from a recipe. A system voice
that can be materialized on first use is exactly the thing we said we
would not promise bytes for, so asserting stability made a true
statement about Samantha into a false one about Siri.

The test keeps what the escape hatch actually guarantees: no `-v`, and
audio out of both renders. The determinism contract stays covered where
it holds — the nameable-voice test directly above, which has never
flaked. build-graph.md records the weaker guarantee and why.

Retrying or CI-skipping would have kept a wrong claim in the suite and
spent a rerun on it every few days.
ninjudd added a commit that referenced this pull request Aug 7, 2026
The recurring CI flake, fixed by deleting the assertion that was wrong
rather than retrying it.

### What was happening

`voice: Siri renders with the system voice` asserted two consecutive
renders were byte-identical. It failed on #31 and again on #41 — two
days apart, both on changes that cannot touch audio rendering (a layout
migration and a label rename), with genuinely different hashes, while
passing on demand locally.

### Why it is a false assertion, not a flake

`Siri` omits `-v` and takes the machine's Spoken Content voice. The
design already accepts that those bytes follow a Settings toggle — the
recorded price of making the best voices reachable from a recipe. A
system voice that may be fetched or warmed on first use is precisely
what we said we would not promise bytes for. So the assertion took a
true statement about Samantha and made a false one about Siri.

The determinism contract is covered where it actually holds: the
nameable-voice test immediately above, which has never flaked. This test
keeps what the escape hatch guarantees — no `-v`, audio out of both
renders.

### Why not retry or skip

A retry annotation keeps a wrong claim in the suite and pays a rerun for
it every few days; a CI-only skip keeps the claim while hiding the
evidence against it. Both treat the symptom of a test asserting more
than the system does.

`build-graph.md` now records the weaker guarantee, so the next person to
wonder why Siri is exempt finds the reason rather than the flake.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Test and documentation only; no change to the say generator or caching
behavior.
> 
> **Overview**
> Removes the **byte-identical** assertion from the `voice: Siri`
integration test and documents why **`Siri`** is outside the
nameable-voice determinism contract.
> 
> The test still runs two renders and checks both produce non-trivial
audio (the escape hatch: no `-v`, speech out). **Determinism** stays
covered by the **Samantha** case above, which has not flaked on CI.
> 
> **`build-graph.md`** now states explicitly that **`Siri`** is weaker
than same-machine reproducibility: back-to-back renders can differ when
the system voice is not already warmed or fetched—observed twice on
CI—while nameable voices remain the determinism claim.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
485bc5f. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
ninjudd added a commit that referenced this pull request Aug 7, 2026
`targets` was the package the layout migration (#31) renamed to
`sounds`, one PR before packages went singular (#41). The singular hint
only knew about plurals, so the one spelling every pre-#31 doc produces
fell through it and got nothing back:

```
$ field build //songs/creek/targets:pad-sc
pattern matched no labels: //songs/creek/targets:pad-sc
```

A flat dead end — and it was reachable from *every* command in the
sample project's README until okamnesiac/bloom#2 rewrote it. Now:

```
$ field build //songs/creek/targets:pad-sc
pattern matched no labels: //songs/creek/targets:pad-sc (targets: is now sound: try //songs/creek/sound:pad-sc)
```

## The wording is its own, deliberately

"packages are singular" is true of `sounds` and **false** of `targets`,
which was a rename, not a pluralization. Borrowing the grammar lesson
would teach the wrong thing. So the lead-in moved into the table beside
each mapping:

```ts
const PACKAGE_HINTS: Record<string, { to: string; why: string }> = {
  sounds:  { to: 'sound', why: 'packages are singular:' },
  ...
  targets: { to: 'sound', why: 'targets: is now sound:' },
};
```

Each `why` carries its own punctuation — the two lead-ins don't share a
shape, and gluing a colon on in the template gave `targets:` two of
them.

Everything else is unchanged: the suggestion still keeps the shape it
was given (`:all` → `:all`, tree → tree), and still fires only when the
target package actually exists.

## Verified

New test covers the label, tree, and `:all` shapes for `targets`, and
asserts the **plural** wording alongside them so the two cannot drift.
`pnpm typecheck` clean; 297 passed, 23 skipped.

The schema-side hint in `common.ts` needed no change — a `source:` only
ever takes a bare name or `//shared/asset:`, so `targets` was never
reachable there.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> User-facing error-message improvements only; no build graph or label
resolution behavior beyond hint text and the new `targets` mapping.
> 
> **Overview**
> Label resolution now gives **actionable hints** when users type the
pre-migration **`targets:`** package (renamed in layout #31), which
previously produced a bare “no labels” error with no correction.
> 
> The plural/singular hint logic moves into a **`PACKAGE_HINTS`** table
where each legacy spelling has its own **`why`** text. **`targets`**
maps to **`sound`** with *“targets: is now sound:”* instead of the
*“packages are singular”* message, which would be misleading for a
rename rather than a plural.
> 
> Hint behavior is unchanged: suggestions preserve pattern shape (label,
tree `...`, or `:all`) and only appear when the corrected package exists
in the graph.
> 
> Tests cover **`targets:`** in all three shapes and lock in that
**`sounds:`** still uses the singular-package wording.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
b1b2f3a. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
eve-nyx-13 added a commit that referenced this pull request Aug 20, 2026
Three defects, found by opening the thing — which nothing before this
had done. The protocol tests all passed because they drove the
WebSocket directly; the render path had no coverage at all, and that is
exactly where the bugs were.

The blank page: devicesResponseSchema returns {name, default} objects
and the device picker rendered them as React children, so React threw
error #31 during the first render and took the whole page down. A
mis-declared interface in the client hid it from the compiler. The
picker now renders d.name and selects by the status device or the
declared default.

The mute break: materialize copies to a temp path and renames over the
destination, which is how a rebuild avoids truncating bytes a daemon is
streaming (watch.md §1.6). That is POSIX semantics — the reader keeps
its inode — and Windows refuses with EPERM unless the reader opened the
file share-delete, which JUCE's streams do not. So every
rebuild-behind-the-play failed while playing, which is what clicking
mute triggers. Materialize now returns early when the destination
already holds exactly these bytes (the common case under watch, and the
one that was failing), and renames with a bounded retry otherwise,
failing with the cause named rather than a bare errno.

The invariant test asserted the mechanism rather than the property: its
runner copied its input, so a re-key produced identical bytes and the
"fresh inode" assertion was checking a rebuild with nothing to write.
It now uses a spec-sensitive runner so the rename path is genuinely
exercised, and a second test pins the other half — an already-correct
artifact is left alone, which is the half Windows enforces.

Also: the window is an Electron shell rather than a browser tab, since
a tab in whatever browser is default is not what "open my project"
should mean; the page paints its own uncaught errors instead of going
blank; and the shell mirrors the renderer console to the terminal,
which is how the React error above was found.

Co-Authored-By: Claude Fable 5 <[email protected]>
@ninjudd
ninjudd deleted the feat/layout-migration 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