XGameSave: a stray or unreadable version folder never costs the save (cherry-pick of upstream #1729) #17

Manually merged
github merged 1 commit from gh-pr/17/head into gh-pr/17/base 2026-11-26 03:41:03 +00:00
Owner

@⁠flale1 on GitHub · 2026-11-25 13:09 UTC · original
flale1:fix/xgamesave-stray-versions → main · +129 −24 · 1 files · 1 commits · merged 2026-11-25 13:46 UTC

This is a cherry-pick of b8dbcba by moe-miau, merged upstream in Marvisak/VIctory#1729 (fixes upstream #870). It was item 26e03c3 in #4.

The problem. current() deletes every older version folder before it reads the newest one's manifest (xgamesave.rs:197-199). If the newest v<N> folder is stray or unreadable (for example a partial write), the older good versions are already gone when the read fails, and the player loses the save.

The change. Upstream's fix, unchanged: a version only replaces older ones once it reads back, a folder that is not a canonical version never removes a committed save, and when no version is readable the folder is refused and kept. Applied with git cherry-pick -x, so the original author is kept; it merges without conflicts on e7f9af5.

Tests. CI on my fork, with --no-fail-fast so every crate runs (run): victory-hle 103 passed, 0 failed, including the new an_unreadable_newer_version_does_not_cost_the_save, no_readable_version_is_refused_and_kept and a_noncanonical_folder_does_not_remove_a_committed_save; both cargo clippy steps pass. The only failures are the three already failing on main (run 45617591420): dynamic_allocation_finds_contiguous_range_crossing_search_cursor, warp_budget_saturates_without_wraparound_and_preserves_draw_fields and depth_bounds_pipeline_loads_and_filters_draws. The Linux portable job also fails on main (unused variable: cs in victory-shader), unrelated to this change.

Not tested with the game.

AI-assisted (Claude Code).

**@⁠flale1** on GitHub · 2026-11-25 13:09 UTC · [original](https://github.com/uiliannn/VItoriaBr/pull/17) `flale1:fix/xgamesave-stray-versions` → `main` · +129 −24 · 1 files · 1 commits · merged 2026-11-25 13:46 UTC This is a cherry-pick of [`b8dbcba`](https://github.com/Marvisak/VIctory/commit/b8dbcba) by moe-miau, merged upstream in Marvisak/VIctory#1729 (fixes upstream #870). It was item `26e03c3` in #4. **The problem.** `current()` deletes every older version folder before it reads the newest one's manifest ([`xgamesave.rs:197-199`](https://github.com/uiliannn/VItoriaBr/blob/e7f9af5/crates/victory-hle/src/modules/xgamesave.rs#L197-L199)). If the newest `v<N>` folder is stray or unreadable (for example a partial write), the older good versions are already gone when the read fails, and the player loses the save. **The change.** Upstream's fix, unchanged: a version only replaces older ones once it reads back, a folder that is not a canonical version never removes a committed save, and when no version is readable the folder is refused and kept. Applied with `git cherry-pick -x`, so the original author is kept; it merges without conflicts on `e7f9af5`. **Tests.** CI on my fork, with `--no-fail-fast` so every crate runs ([run](https://github.com/flale1/VItoriaBr/actions/runs/45619834803)): `victory-hle` 103 passed, 0 failed, including the new `an_unreadable_newer_version_does_not_cost_the_save`, `no_readable_version_is_refused_and_kept` and `a_noncanonical_folder_does_not_remove_a_committed_save`; both `cargo clippy` steps pass. The only failures are the three already failing on `main` ([run 45617591420](https://github.com/uiliannn/VItoriaBr/actions/runs/45617591420)): `dynamic_allocation_finds_contiguous_range_crossing_search_cursor`, `warp_budget_saturates_without_wraparound_and_preserves_draw_fields` and `depth_bounds_pipeline_loads_and_filters_draws`. The Linux `portable` job also fails on `main` (`unused variable: cs` in `victory-shader`), unrelated to this change. Not tested with the game. AI-assisted (Claude Code).
Recovery took any name `v<digits>` as a version, so a leftover `v01`
next to a committed `v1` parsed as version 1, and the cleanup rebuilt
the name as `v1` and deleted the committed save (#870). A correctly
named but unreadable newer entry (an empty `v2`, a file, a broken
manifest) did the same: `v1` was pruned as older, the read failed, and
the next update committed a fresh `v1` holding only the changed blobs,
which the following read pruned again.

Now only `v<N>` exactly as `commit` writes it is a version. `current`
takes the newest version whose manifest reads, removes only versions
below it, and leaves unreadable newer entries alone. An update goes
above the highest version name present, so a stray entry neither hides
the save nor blocks writes. With no readable version at all, reads and
updates still fail and nothing is removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit b8dbcba260d1012dca8f06ee572e5244bffba1ac)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:41:01 +00:00
github manually merged commit d1da85a8c0 into gh-pr/17/base 2026-11-26 03:41:03 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.