Skip to content

Label packages are singular: sound:, track:, asset:, mix: - #41

Merged
ninjudd merged 3 commits into
mainfrom
feat/singular-packages
Aug 7, 2026
Merged

ninjudd merged 3 commits into
mainfrom
feat/singular-packages

Conversation

@ninjudd

@ninjudd ninjudd commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor
bloom play creek/mix:bed        # files live in songs/creek/mixes/
bloom play creek/tracks:keys    # files live in songs/creek/tracks/

Those two lines next to each other are the bug report. The rule you
would infer from any label — the package is its directory — was wrong
exactly once, and wrong on the label you type most, since the main mix
is what you play.

What changed

//songs/creek/sound:pad, //songs/creek/track:keys,
//songs/creek/asset:water, //shared/asset:rain — joining mix:,
which was singular all along.

Directories stay plural, and so does the ledger's assets: YAML key.
That is the point rather than an exception: a folder and a list hold
many, a label addresses one. So the mapping stays mechanical — the
directory is the package's plural — and a label now reads as what it
names: //songs/creek/track:keys is "the keys track".

Why singular rather than pluralizing mix:

Pluralizing would have restored "the directory is the package"
(project-layout.md §1.1.3) with a smaller diff. Singular won on how it
reads out loud, which is what a label is for.

mix: became the odd one out in the layout migration: §4.5 kept the
package while the file moved to mixes/<name>.yaml. That record created
a tension with §1.1.3 and did not notice it. Both are amended with
what changed and why, per the repo's rule for reopening a (DECIDED) —
not quietly diverged from.

Cache-neutral, verified

The label is not in the action key, so nothing re-renders. Checked
rather than asserted: after migrating field's cross-scope references in
a scratch clone, the whole mix rebuilt as twelve cache hits and zero
re-renders. Only .bloom/out/ paths move (old ones linger harmlessly).

The old spelling gets a hint

pattern matched no labels: //songs/creek/tracks:keys
  (packages are singular: try //songs/creek/track:…)

Fires only when the singular package actually exists, so it never
guesses at a package the project does not have — tested both ways. It
covers sounds/tracks/assets/mixes, including the mixes: nobody
could ever type successfully.

Field must land after this, not before

field's six source: //shared/assets:water clips (plus two comments)
need one substitution. The schema admits exactly two spellings, so the
old one fails check with a message naming the new form — clear, but it
means the two repos are a flag day in this order. I have the migration
ready and verified in the clone; I will push it to field once this
merges, so your checkout is never broken by a version skew.

302 tests green, pnpm typecheck exit 0.


Note

Medium Risk
Breaking label grammar across CLI, graph, and schema touches core addressing; mitigated by cache-neutral keys, migration hints, and a coordinated flag day with the field repo for //shared/asset: clips.

Overview
Build labels now use singular packages so they read like what they name: //songs/creek/sound:pad, //songs/creek/track:keys, //songs/creek/asset:water, and //shared/asset:rain, alongside mix: which was already singular. Plural directories (sounds/, tracks/, mixes/) and the ledger’s assets: key stay plural; only the //… package segment changes.

The graph builder, play/export resolution, cross-scope source: validation, and CLI examples are updated to emit and resolve the new spellings. export flattens labels into filenames like creek-sound-pad-normalized-v1.wav instead of creek-sounds-….

Typing the old plural (//songs/creek/tracks:keys, etc.) now errors with a hint toward the singular when that package exists; if the singular package isn’t in the project, you still get a plain “matched no labels” (no guessing).

Docs record the amendment to the label-grammar decision: singular won over pluralizing mix: because labels address one thing. Cache-neutral — the label is not in the action key, so renders don’t re-run; only .bloom/out/ path materialization moves.

Reviewed by Cursor Bugbot for commit f9fefc7. Configure here.

`bloom play creek/mix:bed` beside `bloom play creek/tracks:keys` — the
rule you would infer from any label was wrong exactly once, and wrong on
the label you type most, since the main mix is what you play.

`mix:` had been the odd one out since the layout migration: §4.5 kept it
while the file moved to `mixes/<name>.yaml`, which left it the only
package that did not equal its directory and quietly contradicted
§1.1.3's "the directory is the package". Both records are amended rather
than diverged from.

Resolved toward singular rather than by pluralizing `mix:`, because it
reads as what it addresses: `//songs/creek/track:keys` is "the keys
track". Directories stay plural — a folder holds many — and so does the
ledger's `assets:` key, which is a list. So the mapping is still
mechanical: the directory is the package's plural.

Cache-neutral, and verified rather than assumed: the label is not in the
action key, so after migrating field's cross-scope references the whole
mix rebuilt as twelve cache hits and zero re-renders. Only `.bloom/out/`
paths move.

Typing the old plural gets a hint instead of a bare no-such-label:

    pattern matched no labels: //songs/creek/tracks:keys
      (packages are singular: try //songs/creek/track:…)

It fires only when the singular package actually exists, so it never
guesses at a package this project does not have — tested both ways.

Field needs its `//shared/assets:` clip references migrated (one
substitution, six clips and two comments) and must land after this, not
before: the schema admits exactly the two spellings, so the old one
fails check with a message naming the new form.

@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 f9fefc7. Configure here.

Comment thread src/graph/graph.ts Resolved
Bugbot, correctly: a tree pattern that failed on a plural package was
answered with a single-label suggestion —

    //songs/creek/sounds/...  →  try //songs/creek/sound:…

which is a second thing that does not work. The hint now corrects the
package and re-formats the *same* pattern, so a tree gets a tree, `:all`
gets `:all`, and a label gets that exact label, complete enough to
paste:

    //songs/creek/sounds/...      → try //songs/creek/sound/...
    //songs/creek/tracks:all      → try //songs/creek/track:all
    //songs/creek/tracks:keys     → try //songs/creek/track:keys

Reproduced all three shapes against the field clone before and after.
The formatting the error already did for the pattern it echoes is now
shared with the suggestion, which is what makes them agree by
construction rather than by matching literals.
Comment thread docs/projects/all/project-core.md Resolved
Comment thread docs/projects/all/project-layout.md Resolved
Comment thread src/graph/build.test.ts Resolved
Comment thread src/schema/common.ts Resolved
Comment thread src/schema/sounds.ts Resolved
Comment thread src/graph/graph.ts Resolved
@ninjudd

ninjudd commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Review of c72f3d2 — local, verified by running the code

Reviewed in a throwaway clone at c72f3d2375a3267107a433b7fe3bb08af105e867 (never in the working checkout). Head is already on top of current main (5c4ddde), so there is no merge to test — gh pr view reports MERGEABLE.

What I ran

result
npx tsc --noEmit -p tsconfig.json exit 0 (this is the only thing that typechecks test files)
npx vitest run exit 0 — Test Files 25 passed | 1 skipped, Tests 279 passed | 23 skipped (302)
own probe suite (10 tests, throwaway) pass
real CLI against a real project in a tmpdir pass

Migration completeness. Grepped the whole tree (src/, docs/, README.md, .github/, fixtures) for sounds:, tracks:, assets:, mixes: in label position. The only survivors are the four deliberate negative-test lines in build.test.ts. Directory names, the ledger's assets: YAML key, mixSchema.tracks, and SourceNames.sounds correctly stay plural — the PR body and the amended §1.3 draw that line explicitly and the code follows it.

Every pattern shape still resolves. Built a project with a song asset, a buildable sound, two clip tracks (one on a shared pin), a mix, and a shared ledger, then resolved 15 forms: //..., //songs/..., //songs/creek/..., //songs/creek/track/..., :all on all five packages, //shared/..., //shared/asset/..., absolute labels, songs-relative (creek/track:keys), and bare song name. All resolve. bloom explain creek/mix:main prints input: //songs/creek/track:drums.

Backward compatibility, exercised for real. A project on disk with source: //shared/assets:rain:

$ bloom check
songs/creek/tracks/drums.yaml: must be a name in the song or //shared/asset:<name> at clips.0.source
songs/creek/mixes/main.yaml: mix "main" references unknown track "drums"
exit=1

One substitution → ok, exit 0. Clean flag day, as described. The second line is a pre-existing cascade (an unrelated bogus: key produces the same pair at this head), not something this PR introduces.

Stale .bloom/out paths are genuinely inert. outPath() derives from node.label.pkg, so outputs move to .bloom/out/songs/creek/sound/…. Confirmed nothing in src/ ever reads .bloom/out back (no readdirSync over it, no path→label parse), so the old plural directories are dead weight rather than a hazard — the PR body's claim holds.

A/B'd the tests, and they hold up. Rather than trust the assertions, I reverted pieces in the clone:

mutation result
singularHint returns '' build.test.ts "points at the singular…" fails
revert the shape fix (label-shaped suggestion for every shape) same test fails
graph.ts: ${pkgBase}/asset → ${pkgBase}/assets 22 tests fail across 6 files
mixes → mix special case broken (mixes → mixe) 279 passed, 0 failed ← gap

I also diffed every *.test.ts change with plural→singular normalization applied: every removed line has a renamed counterpart, and the only net-new test lines are the hint test. Nothing was weakened to make the rename pass.


Findings

severity reproduced
project-layout.md §1.1.3 does not exist — should be §1.3 (3 places + PR body) P2 yes, by grepping the cited file and the convention across the tree
mixes: → mix: hint branch has no test; suite is green with it broken P2 yes, 279 passed under mutation
On-disk old grammar gets no singular hint, only the schema message P3 yes, via the CLI
src/schema/sounds.ts:7-10 comment contradicts the §1.3 it cites P3 reading, not runtime

None are blocking correctness. Details and suggested fixes are in the inline threads.

CI

The only check run at c72f3d2 is test, and it concluded failure — but not on anything in this PR:

FAIL src/generators/say.test.ts > sayGenerator.execute > voice: Siri renders with the system voice
AssertionError: expected 'd9b41f841ccca07dea…' to be 'd6edc813e64ccd5168…'
Tests  1 failed | 300 passed | 1 skipped (302)

That is the Siri determinism flake, unrelated to label grammar; say.test.ts passes 6/6 locally at this exact head. This is its second recorded occurrence (first was 2026-08-06), so it is drifting from "once" toward "recurring" — worth deciding on a retry or a CI-skip citing the recorded escape-hatch caveat, separately from this PR. A re-run should clear the check here.

Credit where it's due

  • The (DECIDED) record is properly amended, not diverged from: project-core.md §3.4 gains a dated amendment naming the rejected alternative (pluralize mix:) and why it lost, and both project-layout.md §1.3 and §4.5 are amended — including §4.5 owning up to having created the tension it now resolves. This is the repo's own process followed to the letter; the only defect is the section number it points at.
  • c72f3d2 (shape-preserving hint) is the right fix for the Bugbot finding, and sharing formatPattern between the echo and the suggestion makes them agree by construction. I verified all 8 suggestion shapes actually resolve.
  • The "only hint when the singular package really exists" guard holds up under adversarial input — a song literally named tracks resolves cleanly as //songs/tracks/track:drums with no misfire.
  • Cache-neutrality is real: the label is not in the action key, and the asset/assets mutation above changed 22 test expectations without touching a single cache-hit assertion.

Not merging and not resolving anything — that is yours.

Four findings, all reproduced before fixing.

**The citation was broken** — `project-layout.md §1.1.3` does not
exist; that document numbers two-level and §1.3 is the item meant,
which eleven other files already cite correctly. Three occurrences,
all mine, all in text arguing that a wrong citation is worse than none.

**The `mixes:` → `mix:` branch had no test.** The assertion that looked
like it covered the mapping is the negative case: the fixture has no
clip'd track, so no mix node exists and the hint bails at the existence
check first. The reviewer's mutation (mapping `mixes` to `mixe`) left
the suite green. A second test gives the song a clip'd track and a mix
that lists it, so the plural spelling has something to point at — and
that mutation now fails it. Notable because it is the branch the PR body
singles out, on the package people type most.

**The flag-day path had no hint at all.** The pattern machinery catches
a mistyped command; the case that actually bites is the old spelling
already sitting in a project file, which got only the generic grammar
message. It now names the substitution:

    songs/creek/tracks/water.yaml: packages are singular:
      //shared/assets: is now //shared/asset: (try //shared/asset:water)

Verified against an unmigrated field clone.

**A comment contradicted the amendment it cites** — sounds.ts still read
"the directory is the package, so the label reads as directory +
filename", which is exactly what §1.3 stopped saying.
@ninjudd

ninjudd commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Verification pass at c94eedb — all four fixes hold

Re-checked in the same scratch clone. Not a fresh review; just the deltas.

fix verdict
P2 mixes: coverage holds — A/B'd
P2 §1.1.3 → §1.3 holds — grep'd
P3 flag-day message holds — run against an old-grammar project
P3 sounds.ts comment holds

The mixes: gap is genuinely closed. I re-ran the exact mutation rather than trusting the description — graph.ts:238, plural === 'mixes' ? 'mix' : plural.slice(0, -1) → plural.slice(0, -1):

× build > maps mixes: to mix:, the one package that was singular already
  → expected [Function] to throw error including 'try //songs/creek/mix:main'
    but got 'pattern matched no labels: //songs/cr…'
Tests  1 failed | 279 passed | 23 skipped (303)

Previously that mutation left the suite fully green. The new test is a real positive case — it reaches the mapping rather than bailing at the existence check — and your diagnosis of why the old assertion looked like coverage is exactly right.

Citations. grep -rn "1\.1\.3" across the tree returns nothing; all three occurrences are gone. project-layout.md §1.3 now counts 9 (was 8) plus the two bare §1.3 inside project-layout.md itself. Confirmed §1.3 is genuinely the right target — section 1 item 3, "Authored specs get a file each; ledgers get a table", which is where the "directory is the package" amendment lives. The fix commit introduced no new section references beyond §1.3.

Flag-day path, run for real against a project carrying the old spelling:

$ bloom check
songs/creek/tracks/drums.yaml: packages are singular: //shared/assets: is now //shared/asset: (try //shared/asset:rain) at clips.0.source
exit=1

That is a substitution a person can act on without reading the grammar. Also verified the guard rails: a genuinely foreign scope (//songs/opener/asset:borrowed) still gets the plain must be a name in the song or //shared/asset:<name>, so the hint never fires where there is nothing to substitute; and a sound file's source: gets the same message at at source. After the one substitution, bloom check → ok, exit 0.

sounds.ts now reads "the directory is the package's plural, so sounds/<name>.yaml is //songs/<song>/sound:<name>", which matches the amended §1.3 it cites.

Green. npx tsc --noEmit -p tsconfig.json exit 0. npx vitest run: Test Files 25 passed | 1 skipped, Tests 280 passed | 23 skipped (303) — one more than at c72f3d2, the new positive case. CI at this exact SHA (c94eedba) is success, completed 04:35:29Z.

Resolution honesty. Checked each resolved thread against the branch: every one carries the fix it claims, at the commit it names. Nothing resolved without a corresponding change. The graph.ts:237 thread was my own verification note with no fix owed, so resolving it with a reply is correct.


One small thing, P3, not blocking and not worth another round: the new flag-day branch in common.ts is itself untested. Reverting the stale !== null arm back to the generic message leaves the suite at 280 passed | 23 skipped, 0 failed — the same shape as the gap that was just closed one file over. shared-assets.test.ts already asserts the generic message for the cross-song case, so a sibling assertion on //shared/assets:rain would be a couple of lines. Worth catching whenever this area is next touched.

(Cosmetic, mentioning only for completeness: the suggestion is a textual substitution, so //shared/assets:Rain Loop proposes //shared/asset:Rain Loop, which is still not a slug. The name was invalid either way and the next error says so — harmless.)

Nothing outstanding that should hold this up. Still not merging and not resolving anything.

@ninjudd
ninjudd merged commit f0adc09 into main Aug 7, 2026
1 check passed
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 -->
@ninjudd
ninjudd deleted the feat/singular-packages branch September 28, 2026 04:11
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