fix(cache): validate translator build stamp, prune stale shaders/blobs on upgrade, and add clean-cache CLI #578
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/gamingwithhomie--larp!578
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-578"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@iMarllun on GitHub · 2026-12-06 03:11 UTC · original
iMarllun:fix/shader-cache-validation→main· +758 −0 · 7 files · 2 commits · openSummary
Improves shader/pipeline cache validation and prevents stale cache buildup across translator updates:
Translator build stamp validation & automatic stale cache pruning (crates/larp-gpu/src/shader_cache.rs):
Safe manual cache reset CLI (larp.exe clean-cache [--all]):
Docs & Tests:
Validation
@christopear on GitHub · 2026-12-06 03:15 UTC · original
I’d address the deletion boundaries before merging. I exercised the cleanup functions from
605c3c3on disposable directories in a native Rust harness. The normal separate data directory survived. Two misconfiguration cases are worth guarding because the command promises to leave saves and settings untouched.clean-cachedeleted a dummy settings.ini and printed that the data directory was untouched.Could both entry points preflight all targets before the first mutation, resolve aliases, reject overlap with persistent data and enforce the existing source-tree exclusion? I’d also narrow automatic deletion to demonstrably owned entries. A directory called
pipelines/.stale-notesdisappeared even with a matching stamp.pipelines/blobs-backupdisappeared on a missing or changed stamp.Repeated cold starts on stamp write failure. I blocked the temporary stamp filename with a directory, changed the digest from A to B, then created a fresh blob and removed the obstruction. A second sync with the same B digest deleted the fresh blob again. The first pass had discarded the old generation and silently kept stamp A. Consider a recoverable transition with errors surfaced, or making bulk pruning explicit. A changed translator digest alone also doesn't establish that every host PSO blob is obsolete.
Interaction if #530 lands. After a successful one-recipe hints import,
clean-cache --allremoved the catalog but left imported-hints.txt. The next import skipped and the catalog stayed absent. Removing the completion marker restored the recipe. The opt-in catalog prune reproduced this too. Plain cleanup correctly retained the recipe. Invalidate import completion whenever the corresponding catalog is reset.I used the extracted cleanup bodies with a supplied Config, synchronous deletion for deterministic checks, and #530’s import/cache code with synthetic shader bytes. Six runs covering both catalog settings. No game files, Windows junction tests or concurrent processes involved.
@iMarllun on GitHub · 2026-12-06 03:28 UTC · original
Thanks for the thorough review @christopear — addressed every point in bed22b:
Re-verified with 7 unit tests in cargo test -p larp-gpu --lib cache_clean (all passing) covering .larp-root, data_dir overlap (including .. aliases), unowned dirs, blocked stamp commits, and imported-hints.txt, plus cargo check --release -p larp (0 new warnings).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.