Cache: preserve unrelated files during age-based pruning #4238

Closed
github-bot wants to merge 1 commit from github-bot/gh-4237 into main AGit
Owner

@⁠RanoGames on GitHub · 2026-11-30 17:40 UTC · original
RanoGames:fix/pipeline-prune-cache-entries → main · +44 −6 · 1 files · 1 commits · closed without merging

## What it changes

With VICTORY_SHADER_CACHE_DAYS enabled, the cache pruner applies its age limit to files one directory below the cache root. It can remove a backup in a sibling folder or a notes file beside a cached shader.

Limit expiration to regular files in the layout that Cache::path_for writes. Two lowercase hexadecimal digits identify a shard, and the remaining 62 identify the entry inside it.

How it was tested

  • GPU and profile — CPU-only filesystem test on Windows, using a temporary cache.
  • Before — aging one cached entry, a backup copy and a notes file caused pruning to remove all three.
  • After — the same call removes one entry and both other files retain their original contents.
  • cargo test --locked -p victory-pipeline passed.

Checked for overlap

  • Searched open and closed PRs for cache pruning and reviewed open changes to the cache implementation. #1581 introduced age-based pruning. #2826 covers recovering a cleared cache root and verifying publication.
**@⁠RanoGames** on GitHub · 2026-11-30 17:40 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4237) `RanoGames:fix/pipeline-prune-cache-entries` → `main` · +44 −6 · 1 files · 1 commits · closed without merging ## What it changes With `VICTORY_SHADER_CACHE_DAYS` enabled, the cache pruner applies its age limit to files one directory below the cache root. It can remove a backup in a sibling folder or a notes file beside a cached shader. Limit expiration to regular files in the layout that `Cache::path_for` writes. Two lowercase hexadecimal digits identify a shard, and the remaining 62 identify the entry inside it. ## How it was tested - GPU and profile — CPU-only filesystem test on Windows, using a temporary cache. - Before — aging one cached entry, a backup copy and a notes file caused pruning to remove all three. - After — the same call removes one entry and both other files retain their original contents. - `cargo test --locked -p victory-pipeline` passed. ## Checked for overlap - [x] Searched open and closed PRs for cache pruning and reviewed open changes to the cache implementation. #1581 introduced age-based pruning. #2826 covers recovering a cleared cache root and verifying publication.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 18:09:15 +00:00
Author
Owner

@⁠babuakhil on GitHub · 2026-11-30 18:17 UTC · original

Checked on Windows 11 (Rust 1.98.1, pinned), on main (84bd61e2), which this is based on. Clippy on victory-pipeline is clean with -D warnings, and its 16 tests pass, three runs out of three, the new one among them.

It does what it says, and it can't leave a real entry behind. Everything the cache writes is path_for's lowercase BLAKE3 hex split 2 + 62, or a .tmp- staging file, and the cache is opened only on the shaders folder (cache_subdir("shaders"), replay's folder.join("shaders")), with pipelines beside it rather than inside. So a real entry always passes is_hex_name, and anything else in a shard is something the cache didn't write.

A throwaway test (not part of this PR) put these in a cache folder, made them all three days old along with touched-since, and pruned at one day:

file main this PR
old cache entry removed removed
fresh cache entry kept kept
.tmp-… staging file in a shard kept kept
notes.txt in a shard removed kept
entry-named copy in backup/ removed kept
file in backup/old/ (two levels down) kept kept
entry-named file in a 2-character non-hex folder zz/ removed kept
entry-named file in an upper-case shard AB/ removed kept
63-hex-digit name in a shard removed kept
62-hex-digit directory in a shard kept kept
file at the root kept kept

On main that's 6 removed; with this PR, only the 1 old entry.

**@⁠babuakhil** on GitHub · 2026-11-30 18:17 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4237#issuecomment-7287637284) Checked on Windows 11 (Rust 1.98.1, pinned), on `main` (`84bd61e2`), which this is based on. Clippy on `victory-pipeline` is clean with `-D warnings`, and its 16 tests pass, three runs out of three, the new one among them. **It does what it says, and it can't leave a real entry behind.** Everything the cache writes is `path_for`'s lowercase BLAKE3 hex split 2 + 62, or a `.tmp-` staging file, and the cache is opened only on the `shaders` folder (`cache_subdir("shaders")`, replay's `folder.join("shaders")`), with `pipelines` beside it rather than inside. So a real entry always passes `is_hex_name`, and anything else in a shard is something the cache didn't write. A throwaway test (not part of this PR) put these in a cache folder, made them all three days old along with `touched-since`, and pruned at one day: | file | `main` | this PR | |---|---|---| | old cache entry | removed | removed | | fresh cache entry | kept | kept | | `.tmp-…` staging file in a shard | kept | kept | | `notes.txt` in a shard | **removed** | kept | | entry-named copy in `backup/` | **removed** | kept | | file in `backup/old/` (two levels down) | kept | kept | | entry-named file in a 2-character non-hex folder `zz/` | **removed** | kept | | entry-named file in an upper-case shard `AB/` | **removed** | kept | | 63-hex-digit name in a shard | **removed** | kept | | 62-hex-digit *directory* in a shard | kept | kept | | file at the root | kept | kept | On `main` that's 6 removed; with this PR, only the 1 old entry.
github-bot force-pushed github-bot/gh-4237 from 62c603de71 to 659f51a499 2026-12-01 16:23:35 +00:00 Compare
github-bot closed this pull request 2026-12-01 18:50:21 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:45 UTC · original

Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:45 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4237#issuecomment-7321472688) Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!4238
No description provided.