serve: prune collapsed (xn-) bundle names precisely on revalidation - #26
Merged
Conversation
Every content change swept the entire xn- class — names over the storage cap can't be parsed back to their source hash, so they were over-invalidated wholesale. On a preview scene whose path-based ids sit near the cap that meant reconverting half the corpus (1186 of ~2000 entries) for a one-file edit, turning hot reload into a near-full rebuild. The corpus build now records collapsed-name → source-hash in a names index next to the digest record, and prune resolves xn- entries through it, falling back to the old sweep only for names the index does not know (true orphans, and one final sweep when upgrading past this commit).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
prune_stale_bundlesdeliberately over-invalidatesxn-entries (storage names over the 200-byte cap, collapsed to a hash of themselves) because they can't be parsed back to their source content hash. On production corpora that class is empty — real hashes are short. But on SDK preview scenes the ids are base64-of-path-plus-hostname, and a scene with moderately deep folders sits right at the cap: on Genesis Plaza's central-plaza, 1,186 of ~2,000 cache entries arexn-, so a one-file edit made hot reload reconvert half the corpus (~1,900 files rewritten, a wall ofABGEN_BUILD, tens of seconds), every single time.Change
The corpus build already knows each
(storage name → source hash)pair at write time. It now records the collapsed ones in a names index (<digests>/<key>.names.json, merged incrementally, atomic rename) and revalidation's prune resolvesxn-entries through it — they prune exactly like verbatim names,.brsidecars included. Names the index doesn't know keep the old wholesale sweep: that covers true orphans, and doubles as a one-time self-heal when upgrading past this commit (first revalidation rebuilds the class once and populates the index; every edit after that reconverts only what changed).Verification
xn-entries prune iff their hash changed (dep-changed GLB path included), unknownxn-names are swept, verbatim names unaffected.cargo test -p abgen --lib: live + abcdn suites green (the 15gpu::wgpu_bc7golden failures on this machine reproduce on unmodifiedmain— pre-existing Metal divergence).