XGameSave: a stray or unreadable version folder never costs the save (#870) #1729
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1729
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1729/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@moe-miau on GitHub · 2026-11-24 21:27 UTC · original
moe-miau:fix/xgamesave-stray-versions→main· +129 −24 · 1 files · 1 commits · merged 2026-11-25 00:09 UTCFixes #870, including the case found in the review of the earlier attempts.
The three PRs for #870 (#1006, #1035, #1102) were closed by their authors, so nothing open fixes it on its own. As measured in the issue, they covered
v01-style names but not a correctly named stray: an emptyv2, a file namedv2, or av2with a broken manifest next to a committedv1still cost the save.v1was pruned as older, the read failed, and the next update returnedS_OKwhile committing a freshv1with only the changed blobs, which the following read pruned again.Change (
crates/victory-hle/src/modules/xgamesave.rsonly)v<N>exactly ascommitwrites it is a version (version_number): no leading zeros, no sign, notv0.v01,v+1,v001are neither read, counted nor removed.currenttakes the newest version whose manifest reads, removes only versions below it, and leaves unreadable newer entries alone. Only directories are versions.Version::highest), so a strayv2neither hides the save nor blocks writes; the next read then treats the stray as older and removes it.NO_ACCESS) and nothing is removed, as before.This follows the "fuller fix" in winne42's comment on #870. A crash between
commit's rename and the removal of the old version still leaves two readable versions, of which the newer one wins, as before.Tests
Three synthetic tests in temporary directories (no game data):
a_noncanonical_folder_does_not_remove_a_committed_save:v01,v001,v+1,v0,v02next tov1.an_unreadable_newer_version_does_not_cost_the_save: an emptyv2folder, a file namedv2, and av2with a broken manifest. Each reads the old save, keepsv1, then updates (lands asv3with the kept blob), and reads again.no_readable_version_is_refused_and_kept: a corrupt only version is refused for read and update and stays on disk.The first two fail on
main(ffe310e) with only the tests applied (the committed save is removed), and pass with the change. The existing crash test (a_kill_at_any_step_leaves_old_or_new) and the other save tests pass unchanged.On Windows 11 x64, Rust 1.98.1 MSVC:
cargo clippy --workspace --all-targets --locked -- -D warnings, and the--all-featuresvariant: cleancargo test --workspace --locked: pass (victory-hle: 97 passed)cargo xtask policy: okAI-assisted (Claude Code); I reviewed the change and ran the checks.
🤖 Generated with Claude Code
v18446744073709551615folder makes an update lose the save in release builds (follow-up to #1729) #2497@kais7654 on GitHub · 2026-11-24 22:49 UTC · original
Reviewed and verified: 10/10 xgamesave tests pass on Windows, including
the three new ones — a stray
v01no longer removes the committedsave, an unreadable newer version neither hides nor prunes it and the
next update goes above it, and with nothing readable nothing is removed
and reads fail. Canonical
v<N>only, directories only,highest + 1to commit: solid.