Preserve the last complete save when a newer version is missing a blob #1979
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1981"
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?
Imported from Marvisak/VIctory. Originally posted by WerG0D on 2026-11-25T02:15:46Z.
On Windows/NTFS, I reproduced a failed read that also deleted the last complete save version. On
940d32f, I created a completev1and av2whose manifest listed two blobs but whose directory contained only the first. Reading the slot removedv1and then returned an error for the missing file.This change checks that each numbered blob named by the manifest exists as a regular file before selecting that version for recovery. Empty files remain valid. Other filesystem errors propagate.
Regression tests verify that recovery returns the exact bytes from
v1, the next update writes and reopensv3, and failed reads and updates preserve both directories when neither version is complete. The tests use synthetic slots.All 13 XGameSave tests passed. The full
victory-hlesuite passed with 145 library tests and two integration tests, both serially and on a parallel rerun. The first parallel run had one failure indstorage::tests::a_page_list_filled_after_its_request_starts. Clippy passed forvictory-hlewith all targets, all features, and warnings treated as errors.Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T02:48:47Z.
Review: COMMENTED
Static review only: victory-hle is Windows-only — nothing compiles or runs on macOS; source review of the diff.
Preserve the last complete save when a newer version misses a blob — save-game corruption hardening; right fallback semantics.
Imported from Marvisak/VIctory. Originally posted by DesertGamer on 2026-11-25T02:16:00Z.
VIctory V2: community PRs, merged and tested
Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.
Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).
⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.
Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2
Unofficial community fork of Marvisak/VIctory, GPL-3.0.
Imported from Marvisak/VIctory. Originally posted by AgneyaK on 2026-11-25T02:20:57Z.
Verified locally on Windows 11 26300 (NTFS), Rust 1.98.1 MSVC.
1d46b2fsits directly onmain940d32f.main, and the tests catch it. With only this PR's test module onmain'sxgamesave.rs, two tests fail with the data loss described:an_unreadable_newer_version_does_not_cost_the_save:missing second blob: v1 was removed; read returned Err(-2138898430)incomplete_versions_survive_failed_reads_and_updates:read removed v1: Err(-2138898430)With the PR, both pass.
cargo test -p victory-hle --lib --locked10 runs in a row,145 passedevery time (parallel test threads).cargo clippy -p victory-hle --all-targets --locked -- -D warnings: clean.Not tested: the title's own save path (this machine can't get far enough into the game to save).
AI use: Claude Code (Claude Opus 5.5) ran these checks and wrote this; the results are from the runs described.
Imported from Marvisak/VIctory. Originally posted by Yoshi-233 on 2026-11-25T03:27:27Z.
I checked one more recovery case on Linux/ext4 at
1d46b2f: a newer blob can be a regular file whose metadata is readable, even though opening it for reading returnsPermissionDenied. On the PR, that can still cost the older readable save.I ran the PR's
load,current,current_namedandreadfunctions in a small native Rust harness with temporary synthetic version directories as a non-root user. Both manifests declared one blob. I wroteOLDunderv1/0, wroteNEWunderv2/0, then set onlyv2/0to mode 000. I confirmed metadata still reported a regular file and a read-only open failed. Reading the slot returned an error, but by thenv1had been pruned. I saw the same on the base.The existing missing-blob fix worked in the same harness: an absent blob or a directory at
v2/0recovered the exact old bytes and keptv1. A readable zero-length blob correctly selectedv2.In a local control, attempting a read-only open of each regular blob in
loadbefore selecting the version propagated the permission error and kept the old bytes on disk; the other cases kept their outcomes. This only checks open-time failure. I haven't checked denied reads or sharing violations on Windows/NTFS.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T08:26:03Z.
Automated triage for the maintainers.
Merge candidate.
This fixes real data loss in
crates/victory-hle/src/modules/xgamesave.rs. Onmain,currenttakes the newest version whose manifest parses and then prunes every older version. A newer version whose manifest names a blob file that is missing then cost the last complete save, and the read failed anyway. With this change,loadtreats such a version as unreadable: the blob is absent or not a regular file, while other I/O errors still propagate.currentthen falls back to the older version without removing it, as it already does for broken manifests.What I checked:
currentonly prunes afterloadreturnsSome, so the fallback keeps older versions until a complete one is found.main.A possible follow-up, not a blocker: a blob that exists but cannot be opened (permission denied, as reported in a comment) still selects that version.
mainbehaves the same way there.CI:
checkpassing.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:02:36Z.
Automated triage for the maintainers, second look (a review against
main, with the PR built and tested).Protecting an older complete save behind a newer one that is missing a blob is right, and this can be merged after one change. As it stands, a container whose only version lost a blob refuses every later save (a probe got an access error on each update), where
mainlets the next update that rewrites every blob commit, so the save heals. Incrates/victory-hle/src/modules/xgamesave.rscurrent, please take the newest complete version, and when no version is complete take the newest whose manifest parses, asmaindoes, instead of returning the "no complete save version" error (for example,loadreturns the names plus acompleteflag andcurrentloops twice; versions are pruned only below the one taken). Thenincomplete_versions_survive_failed_reads_and_updatesshould expect the update to succeed above v2, and a new case should cover "the only version lost a blob; an update that rewrites it returns S_OK".Push the change and it will be reviewed again. Thank you for the contribution.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T18:42:36Z.
Review: CHANGES_REQUESTED
Verified
1d46b2f87936936e1ffddd5407cf89c19f34e9acmerged ontomain(63bcca43) on Windows 11 x64 (xtask policy:191 files ok;cargo clippy --locked -p victory-hle --all-targets -- -D warnings: clean;cargo test --locked -p victory-hle --lib modules::xgamesave:::13 passed, 0 failed).Echoing the pending second-look triage note from 2026-11-25:
crates/victory-hle/src/modules/xgamesave.rs:253-257, 1526-1531): When no complete save version exists on disk (e.g., the container's only version lost a blob),current()returnsErr("no complete save version")(NO_ACCESS) even forupdate(), permanently blocking a subsequent update that writes every blob from healing the container (whereasmainallows the new version to commit). Selecting the newest complete version when one exists and falling back to the newest version whose manifest parses when none is complete (pruning only versions older than the chosen one), along with a test asserting an all-blob rewrite recovers withS_OK, will resolve this cleanly.xgamesave.rs:202-209):load()checksstd::fs::metadata(is_file()) without checking read access, so an unreadable regular blob (e.g.,PermissionDenied) can still select that version and prune older ones beforereadfails.View 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.