XGameSave: keep an old-layout save whose blob cannot be read (#242) #327

Open
PAYS0 wants to merge 1 commit from upstream-pr/327 into main
PAYS0 commented 2026-11-24 23:34:43 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by PAYS0 on 2026-11-24T23:34:43Z.


Fixes #242.

Problem

Migrating a container of the old one-file-per-blob layout (migrate in crates/victory-hle/src/modules/xgamesave.rs) built its blob list with read_dir(..).flatten().filter_map(..), so a folder entry or blob that could not be read was silently skipped. It then committed v1 with the remaining blobs and deleted the old folder, so the unread blob was lost for good.

Fix

  • The blobs are read by a new legacy_blobs helper in a loop that returns the first error for a folder entry or a recognized (encoded) blob name.
  • On error nothing is committed, the old folder is left intact so a later open retries the move, and a warning names the container.
  • Files that are not encoded blob names are still skipped, and the optional .display file is read as before.

Tests

  • New test an_unreadable_old_blob_keeps_the_old_layout (Windows only): holds one blob open with no sharing, so reading it fails. The first Provider::open keeps both files and commits nothing; after the handle is closed, the next open moves both blobs over.
  • The new test fails on the old code and passes with the fix.
  • cargo test -p victory-hle on Windows 11: 96 passed, 0 failed. No clippy warnings in the changed file.

Developed with Claude Code on Claude Opus 5.5.

🤖 Generated with Claude Code

<!-- greyfinch-sync:fxceless/victory-fork:issue:6593597094 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/327). Originally posted by [PAYS0](https://github.com/PAYS0) on 2026-11-24T23:34:43Z. --- Fixes #242. ## Problem Migrating a container of the old one-file-per-blob layout (`migrate` in `crates/victory-hle/src/modules/xgamesave.rs`) built its blob list with `read_dir(..).flatten().filter_map(..)`, so a folder entry or blob that could not be read was silently skipped. It then committed v1 with the remaining blobs and deleted the old folder, so the unread blob was lost for good. ## Fix - The blobs are read by a new `legacy_blobs` helper in a loop that returns the first error for a folder entry or a recognized (encoded) blob name. - On error nothing is committed, the old folder is left intact so a later open retries the move, and a warning names the container. - Files that are not encoded blob names are still skipped, and the optional `.display` file is read as before. ## Tests - New test `an_unreadable_old_blob_keeps_the_old_layout` (Windows only): holds one blob open with no sharing, so reading it fails. The first `Provider::open` keeps both files and commits nothing; after the handle is closed, the next open moves both blobs over. - The new test fails on the old code and passes with the fix. - `cargo test -p victory-hle` on Windows 11: 96 passed, 0 failed. No clippy warnings in the changed file. Developed with Claude Code on Claude Opus 5.5. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
kaayzouee commented 2026-11-25 01:11:58 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by kaayzouee on 2026-11-25T00:22:20Z.


Duplicate of #322?

<!-- greyfinch-sync:fxceless/victory-fork:comment:7148440140 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/327#issuecomment-7148440140). Originally posted by [kaayzouee](https://github.com/kaayzouee) on 2026-11-25T00:22:20Z. --- Duplicate of #322?
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/327:upstream-pr/327'
git switch 'upstream-pr/327'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/327'
git switch 'upstream-pr/327'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/327'
git switch 'upstream-pr/327'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/327'
git switch 'main'
git merge --squash 'upstream-pr/327'
git switch 'main'
git merge --ff-only 'upstream-pr/327'
git switch 'main'
git merge 'upstream-pr/327'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!327
No description provided.