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

Closed
mutlusinan wants to merge 1 commit from upstream-pr/253 into main
mutlusinan commented 2026-11-27 20:09:56 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mutlusinan on 2026-11-27T20:09:56Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5532505341 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/253). Originally posted by [mutlusinan](https://github.com/mutlusinan) on 2026-11-27T20:09:56Z. --- ### 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 commented 2026-11-27 20:21:30 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mutlusinan on 2026-11-27T20:21:30Z.


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.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7227424120 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/253#issuecomment-7227424120). Originally posted by [mutlusinan](https://github.com/mutlusinan) on 2026-11-27T20:21:30Z. --- ### 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`.
1tsethan commented 2026-11-27 23:00:08 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by 1tsethan on 2026-11-27T23:00:08Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7229790672 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/253#issuecomment-7229790672). Originally posted by [1tsethan](https://github.com/1tsethan) on 2026-11-27T23:00:08Z. --- 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 -->
cloph-dsp commented 2026-11-28 00:17:28 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by cloph-dsp on 2026-11-28T00:17:28Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7230797351 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/253#issuecomment-7230797351). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-28T00:17:28Z. --- 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.
trustno1-coder commented 2026-11-28 02:49:35 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-11-28T02:49:35Z.


Merged into main (8fc2254) and shipped in v2026.11.27.10. The commit keeps you as its author, so it counts toward the contributors list. GitHub shows this as closed rather than merged only because the commits were applied on top of the newest main (new commit IDs). Thank you!

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7232618260 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/253#issuecomment-7232618260). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-11-28T02:49:35Z. --- Merged into main (8fc2254) and shipped in [v2026.11.27.10](https://github.com/trustno1-coder/VIctory-NVIDIA/releases/tag/v2026.11.27.10). The commit keeps you as its author, so it counts toward the contributors list. GitHub shows this as closed rather than merged only because the commits were applied on top of the newest main (new commit IDs). Thank you!

Pull request closed

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
trustno1-coder/VIctory-NVIDIA!253
No description provided.