xgamesave: preserve older versions on manifest error #399

Closed
github-bot wants to merge 1 commit from gh-pr/399/head into gh-pr/399/base
Owner

@⁠lordon1a on GitHub · 2026-11-24 02:56 UTC · original
fix/xgamesave-preserve-older-version → main · +25 −3 · 1 files · 1 commits · closed without merging

AI-assisted.

Problem

In victory_hle::modules::xgamesave::current, older committed save directories (v1, etc.) were deleted with remove_dir_all before reading and validating the newest version's manifest. If the latest version's manifest was missing, unreadable, or corrupt, the previous good save version had already been destroyed.

Fix

  • Read and validate the latest version's manifest before pruning older committed version directories.
  • Add unit test modules::xgamesave::tests::unreadable_latest_manifest_preserves_previous_version verifying that both a missing manifest and an empty/corrupt manifest preserve v1, and that v1 is pruned once v2's manifest is valid.

Verification

  • cargo xtask policy: 151 files ok
  • cargo test -p victory-hle xgamesave: 6 passed; 0 failed
  • cargo clippy -p victory-hle --all-targets: 0 warnings in xgamesave.rs
**@⁠lordon1a** on GitHub · 2026-11-24 02:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/399) `fix/xgamesave-preserve-older-version` → `main` · +25 −3 · 1 files · 1 commits · closed without merging AI-assisted. ### Problem In `victory_hle::modules::xgamesave::current`, older committed save directories (`v1`, etc.) were deleted with `remove_dir_all` **before** reading and validating the newest version's manifest. If the latest version's manifest was missing, unreadable, or corrupt, the previous good save version had already been destroyed. ### Fix - Read and validate the latest version's manifest before pruning older committed version directories. - Add unit test `modules::xgamesave::tests::unreadable_latest_manifest_preserves_previous_version` verifying that both a missing manifest and an empty/corrupt manifest preserve `v1`, and that `v1` is pruned once `v2`'s manifest is valid. ### Verification - `cargo xtask policy`: `151 files ok` - `cargo test -p victory-hle xgamesave`: `6 passed; 0 failed` - `cargo clippy -p victory-hle --all-targets`: 0 warnings in `xgamesave.rs`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:02:31 +00:00
github-bot closed this pull request 2026-11-26 04:02:31 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-24 04:29 UTC · original

Thanks @⁠lordon1a for preserving the previous save version when the latest manifest cannot be read. I tested head 54f8cee58682bcdac13067542b07d1116fb8b66e with:

cargo test --locked -p victory-hle --lib unreadable_latest_manifest_preserves_previous_version -- --test-threads=1

Result: 1 passed, 0 failed (86 filtered out). The test uses a synthetic save layout with an unreadable latest manifest and verifies the older version remains available. It does not exercise a title’s save workflow.

**@⁠jeremygold02** on GitHub · 2026-11-24 04:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/399#issuecomment-7122073624) Thanks @⁠lordon1a for preserving the previous save version when the latest manifest cannot be read. I tested head `54f8cee58682bcdac13067542b07d1116fb8b66e` with: ``` cargo test --locked -p victory-hle --lib unreadable_latest_manifest_preserves_previous_version -- --test-threads=1 ``` Result: 1 passed, 0 failed (86 filtered out). The test uses a synthetic save layout with an unreadable latest manifest and verifies the older version remains available. It does not exercise a title’s save workflow.

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/Marvisak--VIctory!399
No description provided.