HLE XGameSave: tolerate locked old or unfinished version cleanup #3104

Open
github-bot wants to merge 1 commit from github-bot/gh-3104 into main AGit
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 08:12 UTC · original
fuzeofficlal:fix/hle-xgamesave-tolerate-locked-cleanup → main · +85 −5 · 1 files · 1 commits · open

Summary

  • In crates/victory-hle/src/modules/xgamesave.rs (current), treat std::fs::remove_dir_all failures when cleaning stale *.new staging folders or older v<old> committed versions as non-fatal (tracing::warn! and continue) instead of aborting container reads and blocking subsequent updates (e.g., when Windows AV/backup scanners temporarily hold a file in an older version folder without delete sharing).
  • Critical I/O errors that affect reading or committing the active version (read_dir, load, commit staging/rename, or missing readable manifests) continue to propagate unchanged.
  • Added two Windows-native regression tests using OpenOptionsExt::share_mode(0) verifying that reads, subsequent updates, and post-unlock cleanup all succeed when an old version or stale .new directory is locked.

(Issue pattern originally noted in fxceless/victory-fork 6a42ed27; implemented cleanly against main with Windows-native locked-file regression tests.)

Verification

  • cargo test -p victory-hle --locked -- modules::xgamesave::: 13 passed, 0 failed.
  • cargo clippy -p victory-hle --all-targets --locked -- -D warnings: clean.
  • cargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings: clean.
  • cargo test -p xtask --locked policy::tests::repository_passes_policy: 1 passed, 0 failed.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 08:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/3104) `fuzeofficlal:fix/hle-xgamesave-tolerate-locked-cleanup` → `main` · +85 −5 · 1 files · 1 commits · open ## Summary - In `crates/victory-hle/src/modules/xgamesave.rs` (`current`), treat `std::fs::remove_dir_all` failures when cleaning stale `*.new` staging folders or older `v<old>` committed versions as non-fatal (`tracing::warn!` and continue) instead of aborting container reads and blocking subsequent updates (e.g., when Windows AV/backup scanners temporarily hold a file in an older version folder without delete sharing). - Critical I/O errors that affect reading or committing the active version (`read_dir`, `load`, `commit` staging/rename, or missing readable manifests) continue to propagate unchanged. - Added two Windows-native regression tests using `OpenOptionsExt::share_mode(0)` verifying that reads, subsequent updates, and post-unlock cleanup all succeed when an old version or stale `.new` directory is locked. (Issue pattern originally noted in `fxceless/victory-fork` `6a42ed27`; implemented cleanly against `main` with Windows-native locked-file regression tests.) ## Verification - `cargo test -p victory-hle --locked -- modules::xgamesave::`: 13 passed, 0 failed. - `cargo clippy -p victory-hle --all-targets --locked -- -D warnings`: clean. - `cargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings`: clean. - `cargo test -p xtask --locked policy::tests::repository_passes_policy`: 1 passed, 0 failed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:24:29 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 08:24 UTC · original

Automated triage for the maintainers.

Merge candidate. In crates/victory-hle/src/modules/xgamesave.rs, current now logs and continues when remove_dir_all fails on a leftover *.new staging folder or an older v<N> version. Before, a file held open without delete sharing (a scanner, a backup tool) made every read and update of that container fail. I checked that the cleanup is the only thing relaxed:

  • read_dir, load, commit and the commit rename still propagate their errors.
  • A partly removed older version is never chosen: the newest readable version is picked first, and older folders are only cleanup targets.

The two Windows tests lock a file with share_mode(0) and check that reads and updates still work, and that cleanup finishes once the lock is gone. CI (check, windows-latest) passes.

A note: a locked leftover named v<highest+1>.new still fails the next update. commit removes that exact folder first and propagates the error, as on main. That is the usual crash leftover, so the test with v99.new steps around it. It is not a regression, but a follow-up could commit to a fresh name in that case.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 08:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/3104#issuecomment-7186561134) <!-- victory-triage v1 head=c4509390cfc9bb03a83eee135cb18913e96158e9 verdict=merge-candidate at=2026-11-26T08:18:11Z --> Automated triage for the maintainers. **Merge candidate.** In `crates/victory-hle/src/modules/xgamesave.rs`, `current` now logs and continues when `remove_dir_all` fails on a leftover `*.new` staging folder or an older `v<N>` version. Before, a file held open without delete sharing (a scanner, a backup tool) made every read and update of that container fail. I checked that the cleanup is the only thing relaxed: - `read_dir`, `load`, `commit` and the commit rename still propagate their errors. - A partly removed older version is never chosen: the newest readable version is picked first, and older folders are only cleanup targets. The two Windows tests lock a file with `share_mode(0)` and check that reads and updates still work, and that cleanup finishes once the lock is gone. CI (`check`, windows-latest) passes. A note: a locked leftover named `v<highest+1>.new` still fails the next update. `commit` removes that exact folder first and propagates the error, as on main. That is the usual crash leftover, so the test with `v99.new` steps around it. It is not a regression, but a follow-up could commit to a fresh name in that case. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠oni-swr on GitHub · 2026-11-26 08:28 UTC · original

Independent Windows CPU verification of PR #3104 at c4509390cf (single commit, parent 63bcca43c6 = main). Claim: #1633 . Windows 11 x64, no GPU, no gamepad, cargo test --locked -j 4 -p victory-hle --lib xgamesave, isolated tempdirs only, synthetic data only.

  • Head: 13/13 pass, including the two new tests (locked old version, locked unfinished .new version).
  • Parent: 11/11 pass (the two new tests do not exist there).
  • Control: head tests with only the two cleanup hunks reverted to remove_dir_all(...)? fail both new tests with Windows error 32 (sharing violation), so the tests do exercise the change.
  • Extra scratch test (not committed, not proposed): zero-share directory handles on an old v1 and a v50.new staging dir. Repeated reads returned the newer committed version, update to v3 succeeded, both locked dirs were left in place, and after release the next read removed both. With a zero-share lock on the active version's manifest: read and update both returned the same error (NO_ACCESS), v3 was kept, no v4 was created; after release, read and update worked normally.

Not checked: source review, other platforms, clippy. Test report only; no source changes and no PR from me.

AI use: Claude Code (Claude Sonnet 5.5) ran the checks, coordinated by Codex (gpt-6.2-sol).

**@⁠oni-swr** on GitHub · 2026-11-26 08:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/3104#issuecomment-7186636964) Independent Windows CPU verification of PR #3104 at c4509390cfc9bb03a83eee135cb18913e96158e9 (single commit, parent 63bcca43c6a00a758510398fa43096ce7e4f7df0 = main). Claim: https://git.gtahub.st/github/Marvisak--VIctory/issues/1633 . Windows 11 x64, no GPU, no gamepad, `cargo test --locked -j 4 -p victory-hle --lib xgamesave`, isolated tempdirs only, synthetic data only. - Head: 13/13 pass, including the two new tests (locked old version, locked unfinished `.new` version). - Parent: 11/11 pass (the two new tests do not exist there). - Control: head tests with only the two cleanup hunks reverted to `remove_dir_all(...)?` fail both new tests with Windows error 32 (sharing violation), so the tests do exercise the change. - Extra scratch test (not committed, not proposed): zero-share directory handles on an old `v1` and a `v50.new` staging dir. Repeated reads returned the newer committed version, update to `v3` succeeded, both locked dirs were left in place, and after release the next read removed both. With a zero-share lock on the active version's manifest: read and update both returned the same error (NO_ACCESS), `v3` was kept, no `v4` was created; after release, read and update worked normally. Not checked: source review, other platforms, clippy. Test report only; no source changes and no PR from me. AI use: Claude Code (Claude Sonnet 5.5) ran the checks, coordinated by Codex (gpt-6.2-sol).
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 08:30 UTC · original · approved these changes

Verified against origin/main (63bcca4):

  • cargo test -p victory-hle --lib modules::xgamesave:: -- --test-threads=1: 13/13 passed (including a_locked_old_version_does_not_block_reads_or_updates and a_locked_unfinished_version_does_not_block_reads_or_updates).
  • cargo clippy -p victory-hle --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Cleanly tolerates locked old or unfinished version directories during XGameSave cleanup instead of failing reads/updates.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 08:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/3104#pullrequestreview-6070721410) · **approved these changes** Verified against `origin/main` (`63bcca4`): - `cargo test -p victory-hle --lib modules::xgamesave:: -- --test-threads=1`: 13/13 passed (including `a_locked_old_version_does_not_block_reads_or_updates` and `a_locked_unfinished_version_does_not_block_reads_or_updates`). - `cargo clippy -p victory-hle --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Cleanly tolerates locked old or unfinished version directories during XGameSave cleanup instead of failing reads/updates. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3104/head:github-bot/gh-3104'
git switch 'github-bot/gh-3104'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3104'
git switch 'github-bot/gh-3104'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3104'
git switch 'github-bot/gh-3104'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3104'
git switch 'main'
git merge --squash 'github-bot/gh-3104'
git switch 'main'
git merge --ff-only 'github-bot/gh-3104'
git switch 'main'
git merge 'github-bot/gh-3104'
git push origin 'main'
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/Marvisak--VIctory!3104
No description provided.