Keep unrelated files when clearing a shared cache folder #598

Open
shiaho777 wants to merge 1 commit from upstream-pr/598 into main
shiaho777 commented 2026-12-04 13:09:46 +00:00 (Migrated from github.com)

Imported from readmet3xt-lab/foxhound. Originally posted by shiaho777 on 2026-12-04T13:09:46Z.


In a shared cache directory, Clear old selects a directory such as shaders/t-screenshots and a file such as shaders/.tmp-notes for deletion. Preparing everything again also selects images/victory-image-backup.dll. A directory selected by Clear old is removed together with its contents.

Check for the 16-digit hex fingerprints used by the shader and image writers and for both decimal fields of a staging filename. A display-profile directory is selected as a unit only when it contains at least one image and every entry can be identified as a generated image.

The cache tests now include unrelated names alongside real cache entries. All three tests passed in the Windows test binary under Wine. I also ran victory caches --delete in temporary directories in its default, --start-over, and --start-over --everything modes and checked the surviving files. Windows-target Clippy and cargo xtask policy passed.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:issue:5647078232 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/pull/598). Originally posted by [shiaho777](https://github.com/shiaho777) on 2026-12-04T13:09:46Z. --- In a shared cache directory, Clear old selects a directory such as `shaders/t-screenshots` and a file such as `shaders/.tmp-notes` for deletion. Preparing everything again also selects `images/victory-image-backup.dll`. A directory selected by Clear old is removed together with its contents. Check for the 16-digit hex fingerprints used by the shader and image writers and for both decimal fields of a staging filename. A display-profile directory is selected as a unit only when it contains at least one image and every entry can be identified as a generated image. The cache tests now include unrelated names alongside real cache entries. All three tests passed in the Windows test binary under Wine. I also ran `victory caches --delete` in temporary directories in its default, `--start-over`, and `--start-over --everything` modes and checked the surviving files. Windows-target Clippy and `cargo xtask policy` passed.
fromthemoonx commented 2026-12-04 15:42:46 +00:00 (Migrated from github.com)

Imported from readmet3xt-lab/foxhound. Originally posted by fromthemoonx on 2026-12-04T15:42:46Z.


Works on native Windows: nothing that isn't the layer's is deleted any more, and everything the layer writes still goes.

victory caches --delete, main against this PR, on the same made-up cache folder (debug builds):

mode main also deleted this PR also deleted
default, and --older t-screenshots, t- with 15 and with 17 hex digits, .tmp-notes, .tmp-12-notes nothing
--start-over .tmp-notes, .tmp-12-notes nothing
--start-over --everything all of the above, victory-image-backup.dll, victory-image-<16 hex>-old.dll, a native-backups folder with victory-image-mine.dll in it nothing

The layer's own entries went or stayed the same on both sides in every mode. A junction named t-aaaaaaaaaaaaaaaa was left alone by both.

I also checked the new patterns against the code that writes the names (translator_stamp, create_tempfile_in, PreparedImage::file_name), at this head and at the tags v0.8.3 to v0.8.3.5: all of them fit, so leftovers of those releases are still found.

One small difference: --everything now leaves an empty native-* folder, which main removed. Harmless as far as I can see.

Tested: 9926cb44, which is on top of current main (5e44415b). Windows 11, RTX 3060 12 GB, Ryzen 7 5700X, 16 GB RAM.

  • cargo test --workspace --locked: 1400 passed, 0 failed, 51 ignored, the same counts as main here.
  • The three caches tests, 3 more times: pass.
  • Each new check undone on its own (t- fingerprint, .tmp- decimals, image fingerprint, empty folder, case of the current folder): the tests fail each time.

Not tested: the launcher's buttons, a cache folder from real play, Clippy.

AI use: tested and written up with Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7416281607 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/pull/598#issuecomment-7416281607). Originally posted by [fromthemoonx](https://github.com/fromthemoonx) on 2026-12-04T15:42:46Z. --- Works on native Windows: nothing that isn't the layer's is deleted any more, and everything the layer writes still goes. **`victory caches --delete`, `main` against this PR**, on the same made-up cache folder (debug builds): | mode | `main` also deleted | this PR also deleted | |---|---|---| | default, and `--older` | `t-screenshots`, `t-` with 15 and with 17 hex digits, `.tmp-notes`, `.tmp-12-notes` | nothing | | `--start-over` | `.tmp-notes`, `.tmp-12-notes` | nothing | | `--start-over --everything` | all of the above, `victory-image-backup.dll`, `victory-image-<16 hex>-old.dll`, a `native-backups` folder with `victory-image-mine.dll` in it | nothing | The layer's own entries went or stayed the same on both sides in every mode. A junction named `t-aaaaaaaaaaaaaaaa` was left alone by both. I also checked the new patterns against the code that writes the names (`translator_stamp`, `create_tempfile_in`, `PreparedImage::file_name`), at this head and at the tags v0.8.3 to v0.8.3.5: all of them fit, so leftovers of those releases are still found. One small difference: `--everything` now leaves an empty `native-*` folder, which `main` removed. Harmless as far as I can see. **Tested:** `9926cb44`, which is on top of current `main` (`5e44415b`). Windows 11, RTX 3060 12 GB, Ryzen 7 5700X, 16 GB RAM. - `cargo test --workspace --locked`: 1400 passed, 0 failed, 51 ignored, the same counts as `main` here. - The three `caches` tests, 3 more times: pass. - Each new check undone on its own (`t-` fingerprint, `.tmp-` decimals, image fingerprint, empty folder, case of the current folder): the tests fail each time. **Not tested:** the launcher's buttons, a cache folder from real play, Clippy. **AI use:** tested and written up with Claude Code (Claude Opus 5.5).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/598:upstream-pr/598'
git switch 'upstream-pr/598'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/598'
git switch 'upstream-pr/598'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/598'
git switch 'upstream-pr/598'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/598'
git switch 'main'
git merge --squash 'upstream-pr/598'
git switch 'main'
git merge --ff-only 'upstream-pr/598'
git switch 'main'
git merge 'upstream-pr/598'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
readmet3xt-lab/foxhound!598
No description provided.