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

Open
github-bot wants to merge 1 commit from github-bot/gh-327 into main AGit
Owner

@⁠PAYS0 on GitHub · 2026-11-24 23:34 UTC · original
PAYS0:fix/xgamesave-legacy-migration → main · +68 −9 · 1 files · 1 commits · open

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

**@⁠PAYS0** on GitHub · 2026-11-24 23:34 UTC · [original](https://github.com/fxceless/victory-fork/pull/327) `PAYS0:fix/xgamesave-legacy-migration` → `main` · +68 −9 · 1 files · 1 commits · open 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)
Migrating a container of the old one-file-per-blob layout skipped any
folder entry or blob it could not read, committed v1 with the rest and
then deleted the old folder, so the unread blob was lost for good.

The blobs are now read in a loop that stops at the first error for an
entry or a recognized blob name. On error nothing is committed and the
old folder stays as it is, so a later open retries the move; a warning
names the container. Files that are not encoded blob names are still
skipped, and the optional `.display` file is read as before.

The new test holds one blob open with no sharing: the first open keeps
both files and commits nothing, and once the handle is closed the next
open moves both blobs over. It fails on the old code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:40:48 +00:00
Author
Owner

@⁠kaayzouee on GitHub · 2026-11-25 00:22 UTC · original

Duplicate of #322?

**@⁠kaayzouee** on GitHub · 2026-11-25 00:22 UTC · [original](https://github.com/fxceless/victory-fork/pull/327#issuecomment-7148440140) Duplicate of #322?
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/327/head:github-bot/gh-327'
git switch 'github-bot/gh-327'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-327'
git switch 'github-bot/gh-327'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-327'
git switch 'github-bot/gh-327'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-327'
git switch 'main'
git merge --squash 'github-bot/gh-327'
git switch 'main'
git merge --ff-only 'github-bot/gh-327'
git switch 'main'
git merge 'github-bot/gh-327'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.