Preserve the last complete save when a newer version is missing a blob #1981
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!1981
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@WerG0D on GitHub · 2026-11-25 02:15 UTC · original
WerG0D:fix/recover-incomplete-save→main· +58 −4 · 1 files · 1 commits · openOn 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.@DesertGamer on GitHub · 2026-11-25 02:16 UTC · original
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.
@AgneyaK on GitHub · 2026-11-25 02:20 UTC · original
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.
@Yoshi-233 on GitHub · 2026-11-25 03:27 UTC · original
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.@Marvisak on GitHub · 2026-11-25 08:26 UTC · original
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
@Marvisak on GitHub · 2026-11-25 22:02 UTC · original
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.
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.