xgamesave: preserve last complete save when a newer version is incomplete or an old-layout blob is unreadable #673
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
hle
input
INTEL
lighting
linux-proton
memory
MULDER
needs-info
needs-logs
needs-rebase
NVIDIA
performance
post-merge
pr-diagnostics
pr-docs
pre-merge
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
relevance
high
relevance
low
relevance
medium
relevance
very-high
rendering
report
roadmap-proposal
saves
series-s
shaders
startup
status
blocked-by-rework
status
needs-test-report
status
needs-triage
status
ready-for-review
status
stale
status
superseded
status
wip
tools
ui
upstream
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
TrustNo1/Darner!673
Loading…
Reference in a new issue
No description provided.
Delete branch "MasterWolf/Darner:pr/post-merge-xgamesave-recovery"
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?
Not run in the game (verified via
cargo build,cargo test,cargo clippy, andcargo check --workspaceona156401; container recovery and old-layout migration paths are covered by unit tests).Contributor role (optional)
What it changes
post-merge: read fromcrates/darner-hle/src/modules/xgamesave.rs(28a9b42, carried over from CNF without save-recovery hardening):current()deletes all older committed versions (v1..v(N-1)) before reading/validating the newest folder'smanifestand verifying that every blob file0..blobs.len()exists. IfvNhas a broken manifest or missing blob, every older save is erased and loading fails.current()propagates?when removing.newleftovers or olderv<old>directories; if a scanner or backup briefly holds a file in an old version folder, save reads/updates fail.current()accepts non-canonicalv0/v01/v+1names, andUpdate::submit()usescurrent.number + 1, which can collide with a skipped brokenv(N+1)folder.migrate()silently skips blobs whosestd::fs::readfails (filter_map), treats non-NotFound.displayread errors as empty, and then deletes the old folder anyway.This PR:
load()and scans committed canonicalv<N>folders newest-first incurrent(), falling back to the highest complete version and deleting older versions (committed[at + 1..]) and.newleftovers on a best-effort basis only after a complete save is loaded.highestversion number inVersionand addsnext_version()so commits always step strictly above any existing canonicalv<N>folder, even when a newer folder was skipped as incomplete.migrate()to keep the legacy folder intact if.display(other thanNotFound) or any decoded blob fails to read, and leaves cleanup errors non-fatal after commit.How it was tested
a156401(on top ofpost-merge28a9b42)cargo test --offline -p darner-hle --lib modules::xgamesave—4 passed; 0 failed(0.04s)cargo clippy --offline -p darner-hle --tests— passed (0 warnings indarner-hle)cargo build --offline -p darner— passed (0 errors)cargo check --offline --workspace— passed (0 errors)cargo build,cargo test,cargo clippy,cargo check --workspaceChecklist
post-merge.Checked for overlap
[pr-fix][saves] xgamesave: preserve last complete save when a newer version is incomplete or an old-layout blob is unreadableto xgamesave: preserve last complete save when a newer version is incomplete or an old-layout blob is unreadableView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.