fix(hle): a save version that cannot be removed does not fail the container #253

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

@⁠mutlusinan on GitHub · 2026-11-27 20:09 UTC · original
mutlusinan:fix/saves-held-version → main · +61 −2 · 1 files · 1 commits · open

Problem

current in modules/xgamesave.rs removes unfinished versions (.new) and every version older than the newest readable one, and propagated any error with ?.

A file of an older version held open by another program — a virus scanner, a backup in progress — cannot be deleted. With the error propagated, the container read as unreadable and every save of it failed for as long as the file was held, even though the newest version was intact.

Fix

Both removals are best-effort and logged (debug for .new, info for older versions). The newest readable version is the container whatever is left below it; leftovers are removed at a later call, when the file is free.

Verification

  • cargo check -p victory-hle --all-targets --target x86_64-pc-windows-msvc --locked — clean.
  • New #[cfg(windows)] test an_older_version_that_cannot_be_removed_does_not_fail_the_saves_after_it: holds a version's blob with share_mode(0), saves twice more, checks the state, releases, saves again and checks the leftovers are gone (not run here: needs Windows; victory-hle does not build on macOS).

Ported from fxceless/victory-fork 6a42ed27, GPL-3.0-or-later.

**@⁠mutlusinan** on GitHub · 2026-11-27 20:09 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/253) `mutlusinan:fix/saves-held-version` → `main` · +61 −2 · 1 files · 1 commits · open ### Problem `current` in `modules/xgamesave.rs` removes unfinished versions (`.new`) and every version older than the newest readable one, and propagated any error with `?`. A file of an older version held open by another program — a virus scanner, a backup in progress — cannot be deleted. With the error propagated, the container read as unreadable and **every save of it failed** for as long as the file was held, even though the newest version was intact. ### Fix Both removals are best-effort and logged (`debug` for `.new`, `info` for older versions). The newest readable version is the container whatever is left below it; leftovers are removed at a later call, when the file is free. ### Verification - `cargo check -p victory-hle --all-targets --target x86_64-pc-windows-msvc --locked` — clean. - New `#[cfg(windows)]` test `an_older_version_that_cannot_be_removed_does_not_fail_the_saves_after_it`: holds a version's blob with `share_mode(0)`, saves twice more, checks the state, releases, saves again and checks the leftovers are gone (not run here: needs Windows; `victory-hle` does not build on macOS). Ported from fxceless/victory-fork `6a42ed27`, GPL-3.0-or-later.
`current` removed unfinished and older save versions and propagated any
error. A file another program holds without letting it be deleted (a virus
scanner, a backup in progress) then failed the whole lookup: the container
read as unreadable and every save of it failed for as long as the file was
held, though the newest readable version was intact.

Both removals are now best-effort and logged; the leftovers go at a later
save, when the file is free.

Ported from fxceless/victory-fork 6a42ed27, GPL-3.0-or-later.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 20:16:05 +00:00
Author
Owner

@⁠mutlusinan on GitHub · 2026-11-27 20:21 UTC · original

Risk assessment (porting review)

  • Removal errors are swallowed by design: a held file no longer fails the container or the saves after it. Trade-off: leftovers go only on a later call, and if deletion fails permanently (permissions, a permanent lock) old versions accumulate without a bound.
  • .new directories are never read as versions (version_number ignores them), so leaving one behind is safe.
  • The test needs Windows (share_mode(0)) and was not run here.
  • Compatibility: merges cleanly and type-checks against main at e69e39c.
**@⁠mutlusinan** on GitHub · 2026-11-27 20:21 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/253#issuecomment-7227424120) ### Risk assessment (porting review) - Removal errors are swallowed by design: a held file no longer fails the container or the saves after it. Trade-off: leftovers go only on a later call, and if deletion fails permanently (permissions, a permanent lock) old versions accumulate without a bound. - `.new` directories are never read as versions (`version_number` ignores them), so leaving one behind is safe. - The test needs Windows (`share_mode(0)`) and was not run here. - **Compatibility:** merges cleanly and type-checks against `main` at `e69e39c`.
Author
Owner

@⁠1tsethan on GitHub · 2026-11-27 23:00 UTC · original

Independent Windows validation of PR #253.

Tested commit: 0438a1b7467cfa33bfe59336cb99326ae9c4561a.

cargo test --locked -p victory-hle an_older_version_that_cannot_be_removed -- --nocapture --test-threads=1

Exit: 0.

  • test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 173 filtered out; finished in 0.05s

Independent verification with OpenAI Codex assistance. Windows 11 Pro build 26200; Rust 1.98.1 MSVC; Windows SDK libraries from Microsoft.Windows.SDK.CPP.x64 10.0.28000.2957. Test harness used an RTX 3070 Ti / AMD integrated-GPU host; adapter identity was not captured for every test. These are focused checks on the stated PR commit, not gameplay, FPS, or a merged-main integration result.

**@⁠1tsethan** on GitHub · 2026-11-27 23:00 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/253#issuecomment-7229790672) Independent Windows validation of PR #253. Tested commit: `0438a1b7467cfa33bfe59336cb99326ae9c4561a`. `cargo test --locked -p victory-hle an_older_version_that_cannot_be_removed -- --nocapture --test-threads=1` Exit: **0**. - test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 173 filtered out; finished in 0.05s Independent verification with OpenAI Codex assistance. Windows 11 Pro build 26200; Rust 1.98.1 MSVC; Windows SDK libraries from Microsoft.Windows.SDK.CPP.x64 10.0.28000.2957. Test harness used an RTX 3070 Ti / AMD integrated-GPU host; adapter identity was not captured for every test. These are focused checks on the stated PR commit, not gameplay, FPS, or a merged-main integration result. <!-- victory-native-validation-20261128 -->
Author
Owner

@⁠cloph-dsp on GitHub · 2026-11-28 00:17 UTC · original

Independent local verification of PR #253 (an older XGameSave version that cannot be removed does not fail the saves after it).

  • Windows, Rust 1.100.0/MSVC (Scoop rust-msvc, no rustup/clippy), cargo test --locked, synthetic inputs only.
  • Head 0438a1b7467cfa33bfe59336cb99326ae9c4561a, merge base 0cef07e9d766df48f0e95f13ce3bbbe2290fe9d3, worktree-local CARGO_TARGET_DIR.
  • Command: cargo test --locked -p victory-hle --lib -- modules::xgamesave::tests::an_older_version_that_cannot_be_removed_does_not_fail_the_saves_after_it --exact --test-threads=1 --quiet → test result: ok. 1 passed; 0 failed; 173 filtered out, exit 0.
  • Negative control: git grep -F an_older_version_that_cannot_be_removed_does_not_fail_the_saves_after_it 0cef07e9 -- crates/victory-hle/src/modules/xgamesave.rs → exit 1 (test absent on base).
  • git diff --check 0cef07e9 HEAD clean.

Only the named test was replayed; full suite not run. GPU/driver N/A (CPU-only XGameSave test). AI-assisted (Hy4 flash). No game data, assets, extracted shaders, DRM or decrypt.

**@⁠cloph-dsp** on GitHub · 2026-11-28 00:17 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/253#issuecomment-7230797351) Independent local verification of PR #253 (an older XGameSave version that cannot be removed does not fail the saves after it). - Windows, Rust 1.100.0/MSVC (Scoop rust-msvc, no rustup/clippy), `cargo test --locked`, synthetic inputs only. - Head `0438a1b7467cfa33bfe59336cb99326ae9c4561a`, merge base `0cef07e9d766df48f0e95f13ce3bbbe2290fe9d3`, worktree-local `CARGO_TARGET_DIR`. - Command: `cargo test --locked -p victory-hle --lib -- modules::xgamesave::tests::an_older_version_that_cannot_be_removed_does_not_fail_the_saves_after_it --exact --test-threads=1 --quiet` → `test result: ok. 1 passed; 0 failed; 173 filtered out`, exit 0. - Negative control: `git grep -F an_older_version_that_cannot_be_removed_does_not_fail_the_saves_after_it 0cef07e9 -- crates/victory-hle/src/modules/xgamesave.rs` → exit 1 (test absent on base). - `git diff --check 0cef07e9 HEAD` clean. Only the named test was replayed; full suite not run. GPU/driver N/A (CPU-only XGameSave test). AI-assisted (Hy4 flash). No game data, assets, extracted shaders, DRM or decrypt.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/253/head:github-bot/gh-253'
git switch 'github-bot/gh-253'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-253'
git switch 'github-bot/gh-253'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-253'
git switch 'github-bot/gh-253'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-253'
git switch 'main'
git merge --squash 'github-bot/gh-253'
git switch 'main'
git merge --ff-only 'github-bot/gh-253'
git switch 'main'
git merge 'github-bot/gh-253'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.