Skip to content

One resolver answers where committed bytes live - #133

Merged
ninjudd merged 1 commit into
mainfrom
model/one-source-resolver
Aug 11, 2026
Merged

ninjudd merged 1 commit into
mainfrom
model/one-source-resolver

Conversation

@ninjudd

@ninjudd ninjudd commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

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

@ninjudd
ninjudd force-pushed the model/one-source-resolver branch from 6cca39f to 06ba588 Compare August 11, 2026 01:11
@minjudd

minjudd commented Aug 11, 2026

Copy link
Copy Markdown

Starting review of 06ba588, against its base 1ba8b61 (#132's head, which I have just approved).

Base automatically changed from cleanup/retire-residue to main August 11, 2026 01:15
@ninjudd
ninjudd force-pushed the model/one-source-resolver branch from 06ba588 to b9ea729 Compare August 11, 2026 01:15
@minjudd

minjudd commented Aug 11, 2026

Copy link
Copy Markdown

#132 merged and this branch restacked onto main, so 06ba588 became b9ea729. git range-diff 1ba8b61..06ba588 ec62cce..b9ea729 reports the commit identical — starting review of b9ea729, re-running the gate against the new base rather than carrying the old one over.

@minjudd minjudd 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.

Approving b9ea729. #132 merged and this restacked onto main while I was reading it; git range-diff 1ba8b61..06ba588 ec62cce..b9ea729 marks the commit identical, and I re-ran the gate against the new base rather than carrying the old one over.

"Behaviour is unchanged" is the claim a consolidation lives or dies on, so I measured it instead of reading it. Two worktrees — one at the base, one at this head — both built, then field explain over six labels spanning every arm of the resolver: creek/track:main, creek/track:space, creek/track:drums, creek/track:kit-punch, tall-grass/track:main, and creek/gen:still-water-keys, comparing action keys, input hashes, plans and output hashes.

$ diff /tmp/e-base.txt /tmp/e-head.txt
(no output)

Every action key identical, so nothing re-renders and no cache entry moves — which is the strongest form the claim can take, because an action key is exactly what would shift if the resolver answered differently anywhere the planner reads it.

The two implementations really were equivalent, and the merged one keeps both behaviours. The graph's seed came from sharedByName, built at graph.ts:143 from project.shared.data.assets — the same collection the resolver now reads, so the shared arm is the same set by construction. The keying differs in spelling only: the old map held the full //shared/asset:<name> string, the resolver calls sharedAssetName(ref) and looks the name up, and both answer undefined for a shared ref the ledger does not hold. A bare name still falls through to the song ledger in both.

The laziness does not change when anything is answered. The old map got its chosen-variant entries mid-mint at what is now line 258, and every consumer — committedRate, and the loop-tiling framesBySource walk — is defined or runs after that point, so no caller could ever have observed the map without its gen entries. The resolver answering gen refs from the first call is therefore the same behaviour, not a widened one.

Coverage. The new test pins three arms directly (ledger name, gen: to the chosen variant, track: and an unknown name to undefined). The fourth — the shared arm, the one whose construction actually moved — is not in it, but it is covered through both consumers by tests already there: shared sources loop-tile at their own length exercises validate's side, where the resolver has to find a shared file to read its frame count, and a clip plays a shared asset through the full label, wired into the graph exercises the graph's. bloom's shared ledger is empty, so my end-to-end comparison above did not reach that arm; those two tests are what does.

pnpm typecheck clean, 39 files / 624 tests all passing against the v8 daemon, CI's linux job green on this SHA.

No findings.

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
ninjudd force-pushed the model/one-source-resolver branch from b9ea729 to ac7bc98 Compare August 11, 2026 01:21
@minjudd

minjudd commented Aug 11, 2026

Copy link
Copy Markdown

Starting review of ac7bc98.

@ninjudd
ninjudd merged commit 01d4fe6 into main Aug 11, 2026
1 check passed
@ninjudd
ninjudd deleted the model/one-source-resolver branch August 11, 2026 01:25

@minjudd minjudd 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.

Approving ac7bc98. This is b9ea729 with a rewritten commit message and nothing else — same tree, same parent:

$ git rev-parse b9ea729^{tree} ac7bc98^{tree}
486499f91e5e23611dc7bed8636eeeb219564622
486499f91e5e23611dc7bed8636eeeb219564622
$ git rev-parse b9ea729^ ac7bc98^
ec62cce672baf5407725843182c6ad7e36387f45
ec62cce672baf5407725843182c6ad7e36387f45

Identical trees make the code review at b9ea729 apply verbatim rather than by assumption, so I have not re-run the suite — it cannot produce a different answer over the same bytes with the same dependencies. CI's linux job did run on this SHA and is green.

The new message is the better one, and it is accurate where it is more specific: "the shared ledger, the song's ledger, and a generative entry's chosen take, in that order" is exactly the order of the three lookups in committedFileResolver, and naming #58 as the rule being applied puts the why in the commit rather than only in the PR body — which matters here, since the body is what the squash keeps.

Carried over from b9ea729, where I did the work: action keys, input hashes, plans and outputs are byte-identical across the refactor over six labels spanning every arm of the resolver; the graph's old seed and the resolver read the same collection so the shared arm is the same set by construction; and the laziness cannot widen anything, because every consumer of the old map ran after its mid-mint insertion.

No findings.

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.

2 participants