HLE: a save of the old layout is not moved without a file it cannot read #3329

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

@⁠Creaa on GitHub · 2026-11-26 18:20 UTC · original
Creaa:hle/xgamesave-migrate-unreadable → main · +186 −11 · 1 files · 1 commits · open

xgamesave::migrate moves a container of the old (pre-versioned) layout into a committed version, then removes the old folder. A .display it could not read became an empty display name, and a blob it could not read was skipped, so a file another process held open (no sharing) was committed without and then lost with the old folder. This keeps the old layout when a file that is there cannot be read; a later listing moves it whole. Covers NEW-215 and NEW-216 from #1633 (their earlier base #2525 is closed).

What is in it

  • crates/victory-hle/src/modules/xgamesave.rs: in migrate, .display not found is still an empty name; any other error reading .display, a blob or an entry of the folder listing logs a warning and returns before commit, leaving the old folder for the next listing.
  • Same file: new old_moved(root, name); Update::submit and delete call it first and return NO_ACCESS while the container's old layout cannot be moved yet, so no version is committed that migrate would then take for its own before removing the old folder. It finds the old folders as containers does (listing the root, by decoded exact name), not by a path that Windows matches regardless of case.
  • Test an_unreadable_old_display_or_blob_leaves_the_old_layout_for_later: for .display and for a blob held with share_mode(0), the old layout stays and nothing is committed, and an update and a delete of the container are refused without committing or removing anything; after the handle is dropped, the next Provider::open moves both blobs and the display name Chapter 1.

Tested

  • Windows 11 build 26300, i7-13700F, Rust 1.98.1 (pinned); on main 63bcca4.
  • The new test passes (#[cfg(windows)], like the other Windows-only test here); with main's migrate it fails at ".display held: nothing committed", and with old_moved always true at ".display held: update".
  • Test a_held_old_layout_is_matched_by_its_exact_decoded_name: with a held Player or %50layer folder, an update/delete of Player is refused, player (another container) is neither blocked nor takes it, and after release Player gets the blob; with a path lookup it fails at "Player: other case".
  • cargo test -q --locked -p victory-hle --lib --no-fail-fast: 154 passed, 0 failed (the_old_layout_moves_over unchanged and passing).
  • cargo clippy --workspace --all-targets --locked -- -D warnings and with --all-features: clean. cargo xtask policy: 191 files ok.

Not tested

  • With the title (synthetic save folders only; no game data). Other locking cases than a share-none handle.

AI use

  • Claude Code (Claude Opus 5.5) wrote the change and the test, ran the checks and drafted this description; I checked it.

🤖 Generated with Claude Code

**@⁠Creaa** on GitHub · 2026-11-26 18:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/3329) `Creaa:hle/xgamesave-migrate-unreadable` → `main` · +186 −11 · 1 files · 1 commits · open `xgamesave::migrate` moves a container of the old (pre-versioned) layout into a committed version, then removes the old folder. A `.display` it could not read became an empty display name, and a blob it could not read was skipped, so a file another process held open (no sharing) was committed without and then lost with the old folder. This keeps the old layout when a file that is there cannot be read; a later listing moves it whole. Covers NEW-215 and NEW-216 from #1633 (their earlier base #2525 is closed). **What is in it** - `crates/victory-hle/src/modules/xgamesave.rs`: in `migrate`, `.display` not found is still an empty name; any other error reading `.display`, a blob or an entry of the folder listing logs a warning and returns before `commit`, leaving the old folder for the next listing. - Same file: new `old_moved(root, name)`; `Update::submit` and `delete` call it first and return `NO_ACCESS` while the container's old layout cannot be moved yet, so no version is committed that `migrate` would then take for its own before removing the old folder. It finds the old folders as `containers` does (listing the root, by decoded exact name), not by a path that Windows matches regardless of case. - Test `an_unreadable_old_display_or_blob_leaves_the_old_layout_for_later`: for `.display` and for a blob held with `share_mode(0)`, the old layout stays and nothing is committed, and an update and a delete of the container are refused without committing or removing anything; after the handle is dropped, the next `Provider::open` moves both blobs and the display name `Chapter 1`. **Tested** - Windows 11 build 26300, i7-13700F, Rust 1.98.1 (pinned); on `main` `63bcca4`. - The new test passes (`#[cfg(windows)]`, like the other Windows-only test here); with `main`'s `migrate` it fails at "`.display` held: nothing committed", and with `old_moved` always true at "`.display` held: update". - Test `a_held_old_layout_is_matched_by_its_exact_decoded_name`: with a held `Player` or `%50layer` folder, an update/delete of `Player` is refused, `player` (another container) is neither blocked nor takes it, and after release `Player` gets the blob; with a path lookup it fails at "`Player`: other case". - `cargo test -q --locked -p victory-hle --lib --no-fail-fast`: 154 passed, 0 failed (`the_old_layout_moves_over` unchanged and passing). - `cargo clippy --workspace --all-targets --locked -- -D warnings` and with `--all-features`: clean. `cargo xtask policy`: 191 files ok. **Not tested** - With the title (synthetic save folders only; no game data). Other locking cases than a share-none handle. **AI use** - Claude Code (Claude Opus 5.5) wrote the change and the test, ran the checks and drafted this description; I checked it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
`migrate` moves a container of the pre-versioned layout into a committed
version and then removes the old folder. A `.display` it could not read
became an empty display name, and a blob it could not read was skipped,
so a file another process held open (no sharing) was committed without
and then lost with the old folder (NEW-215, NEW-216 in #1633).

Now a missing `.display` is still an empty name, but any other read
failure of the display or of a blob leaves the old layout untouched and
returns, so a later listing moves the container whole.

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

@⁠Dukestar69 on GitHub · 2026-11-26 18:27 UTC · original · approved these changes

LGTM — verified on Windows against origin/main (63bcca4).

  • Bailing out of migrate on non-NotFound .display read errors or any blob read error prevents committing an incomplete save and deleting the old layout while another process holds a file.
  • cargo test -p victory-hle --lib modules::xgamesave:: -- --test-threads=1: 12 passed, 0 failed (including an_unreadable_old_display_or_blob_leaves_the_old_layout_for_later).
  • cargo clippy -p victory-hle --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 18:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/3329#pullrequestreview-6078973789) · **approved these changes** LGTM — verified on Windows against `origin/main` (`63bcca4`). - Bailing out of `migrate` on non-`NotFound` `.display` read errors or any blob read error prevents committing an incomplete save and deleting the old layout while another process holds a file. - `cargo test -p victory-hle --lib modules::xgamesave:: -- --test-threads=1`: 12 passed, 0 failed (including `an_unreadable_old_display_or_blob_leaves_the_old_layout_for_later`). - `cargo clippy -p victory-hle --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠borosf on GitHub · 2026-11-26 19:03 UTC · original

Independent local verification on Windows 11 x64, Intel Arc B580 12 GB (12 cores), at this PR's head e419c04:

cargo test -p victory-hle --lib --locked --no-fail-fast -- --test-threads=1
cargo clippy -p victory-hle --all-targets --locked -- -D warnings
cargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings

Result: victory-hle lib: fully green (exit 0) apart from modules::dstorage::tests::a_page_list_filled_after_its_request_starts, which passed on 2x --exact --test-threads=1 re-runs (flake); the PR's new bounds test and all xgamesave tests pass.

Both clippy runs exit 0 (-D warnings, both feature sets). The B580 baseline failures pristine main also hits are: victory-gpu descriptor::host::tests::dynamic_slots_are_held_until_released + memory::tests::lists_share_a_table_and_copies_keep_their_views (#1744/#1829); victory-shader emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros + emit::valu_tests::fspx_programs_run_with_the_hardwares_dot_products. No PR regressions.

Synthetic tests only; no game data used. Full log kept locally. — borosf

**@⁠borosf** on GitHub · 2026-11-26 19:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/3329#issuecomment-7201148014) Independent local verification on Windows 11 x64, Intel Arc B580 12 GB (12 cores), at this PR's head `e419c04`: ``` cargo test -p victory-hle --lib --locked --no-fail-fast -- --test-threads=1 cargo clippy -p victory-hle --all-targets --locked -- -D warnings cargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings ``` Result: victory-hle lib: fully green (exit 0) apart from modules::dstorage::tests::a_page_list_filled_after_its_request_starts, which passed on 2x --exact --test-threads=1 re-runs (flake); the PR's new bounds test and all xgamesave tests pass. Both clippy runs exit 0 (-D warnings, both feature sets). The B580 baseline failures pristine main also hits are: victory-gpu descriptor::host::tests::dynamic_slots_are_held_until_released + memory::tests::lists_share_a_table_and_copies_keep_their_views (#1744/#1829); victory-shader emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros + emit::valu_tests::fspx_programs_run_with_the_hardwares_dot_products. No PR regressions. Synthetic tests only; no game data used. Full log kept locally. — borosf
github-bot force-pushed github-bot/gh-3329 from e419c04bed to 80e854a221 2026-11-26 20:20:44 +00:00 Compare
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 20:14 UTC · original · requested changes

Thanks for guarding old-layout migration against unreadable .display/blob files — keeping the legacy directory on sharing violations is the right direction. However, a few issues remain in crates/victory-hle/src/modules/xgamesave.rs:

  1. High — An Update::submit while legacy migration is deferred can lead to permanent data loss (xgamesave.rs:343, 377, 484, 525):

    • Suppose migrate defers because a legacy file is locked (v1 does not exist yet), and the title then runs Update::submit on that container.
    • Update::submit reads current(&self.dir) as None (484), checks used_bytes(root) (525, where migrate either defers again or commits v1 mid-update while submit still plans number = 1), and can commit a v1 containing only the update's changes (531), returning S_OK.
    • Once the lock is later released, the next migrate sees current_named(&dir, name)?.is_some() == true (343) and executes std::fs::remove_dir_all(old) (377), permanently deleting any un-migrated blobs and .display from the old layout. (Updates/containers should refuse or wait until pending legacy migration completes, rather than treating an update-created v1 as proof migration already happened.)
  2. Medium — read_dir(old).ok()?.flatten() still ignores mid-iteration directory errors (xgamesave.rs:358):

    • While opening read_dir(old) checks .ok()?, .flatten() silently drops Err items yielded during directory iteration, which can still commit a partial container and remove old. Iterating explicitly over Result entries and bailing out on Err like the file reads do closes this path cleanly.
  3. Non-Windows test compilation break (xgamesave.rs:1239):

    • modules/mod.rs:38 does not gate pub mod xgamesave behind #[cfg(windows)] (the sibling Windows-only test at xgamesave.rs:1131 carries #[cfg(windows)]), so use std::os::windows::fs::OpenOptionsExt; inside an_unreadable_old_display_or_blob_leaves_the_old_layout_for_later will fail cargo test -p victory-hle on non-Windows targets unless gated with #[cfg(windows)].

Minor formatting nit: rustfmt --edition 2024 --check flags two lines exceeding 100 columns at xgamesave.rs:1242 and 1256.

Local checks on head e419c04b cleanly merged onto main (63bcca43):

  • cargo run -p xtask -- policy: 191 files ok.
  • cargo clippy --locked -p victory-hle --all-targets -- -D warnings (default and --all-features): clean.
  • cargo test --locked -p victory-hle --lib modules::xgamesave::: 12 passed; 0 failed (1.29s).
**@⁠fuzeofficlal** on GitHub · 2026-11-26 20:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/3329#pullrequestreview-6080026258) · **requested changes** Thanks for guarding old-layout migration against unreadable `.display`/blob files — keeping the legacy directory on sharing violations is the right direction. However, a few issues remain in `crates/victory-hle/src/modules/xgamesave.rs`: 1. **High — An `Update::submit` while legacy migration is deferred can lead to permanent data loss (`xgamesave.rs:343, 377, 484, 525`)**: - Suppose `migrate` defers because a legacy file is locked (`v1` does not exist yet), and the title then runs `Update::submit` on that container. - `Update::submit` reads `current(&self.dir)` as `None` (`484`), checks `used_bytes(root)` (`525`, where `migrate` either defers again or commits `v1` mid-update while `submit` still plans `number = 1`), and can commit a `v1` containing **only** the update's changes (`531`), returning `S_OK`. - Once the lock is later released, the next `migrate` sees `current_named(&dir, name)?.is_some() == true` (`343`) and executes `std::fs::remove_dir_all(old)` (`377`), permanently deleting any un-migrated blobs and `.display` from the old layout. (Updates/containers should refuse or wait until pending legacy migration completes, rather than treating an update-created `v1` as proof migration already happened.) 2. **Medium — `read_dir(old).ok()?.flatten()` still ignores mid-iteration directory errors (`xgamesave.rs:358`)**: - While opening `read_dir(old)` checks `.ok()?`, `.flatten()` silently drops `Err` items yielded during directory iteration, which can still commit a partial container and remove `old`. Iterating explicitly over `Result` entries and bailing out on `Err` like the file reads do closes this path cleanly. 3. **Non-Windows test compilation break (`xgamesave.rs:1239`)**: - `modules/mod.rs:38` does not gate `pub mod xgamesave` behind `#[cfg(windows)]` (the sibling Windows-only test at `xgamesave.rs:1131` carries `#[cfg(windows)]`), so `use std::os::windows::fs::OpenOptionsExt;` inside `an_unreadable_old_display_or_blob_leaves_the_old_layout_for_later` will fail `cargo test -p victory-hle` on non-Windows targets unless gated with `#[cfg(windows)]`. Minor formatting nit: `rustfmt --edition 2024 --check` flags two lines exceeding 100 columns at `xgamesave.rs:1242` and `1256`. Local checks on head `e419c04b` cleanly merged onto `main` (`63bcca43`): - `cargo run -p xtask -- policy`: `191 files ok`. - `cargo clippy --locked -p victory-hle --all-targets -- -D warnings` (default and `--all-features`): clean. - `cargo test --locked -p victory-hle --lib modules::xgamesave::`: `12 passed; 0 failed` (`1.29s`).
Author
Owner

@⁠Creaa on GitHub · 2026-11-26 20:18 UTC · original

@⁠fuzeofficlal thanks, all three were real. Fixed in 80e854a (squashed):

  1. Update::submit and delete now call old_moved(root, name) first (under the same saves_lock): if the container's old layout is still there it is moved now, and if it still cannot be, they return NO_ACCESS and commit/remove nothing. So no version can exist that migrate would take for its own before removing the old folder. The test now checks, for a held .display and a held blob, that an update and a delete are refused and leave the old folder; it fails at ".display held: update" with old_moved forced to true.
  2. The folder listing is iterated over its Results; an entry error leaves the old layout like a read error.
  3. The test is #[cfg(windows)], and its long lines are formatted (rustfmt reports no new lines over main for the file).

Rerun on Windows 11, RTX 4070 machine: cargo test -q --locked -p victory-hle --lib --no-fail-fast 153 passed, 0 failed; cargo clippy --workspace --all-targets --locked -- -D warnings clean; cargo xtask policy 191 files ok.

AI use: Claude Code (Claude Opus 5.5) made the fix and drafted this reply.

**@⁠Creaa** on GitHub · 2026-11-26 20:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/3329#issuecomment-7202520569) @⁠fuzeofficlal thanks, all three were real. Fixed in `80e854a` (squashed): 1. `Update::submit` and `delete` now call `old_moved(root, name)` first (under the same `saves_lock`): if the container's old layout is still there it is moved now, and if it still cannot be, they return `NO_ACCESS` and commit/remove nothing. So no version can exist that `migrate` would take for its own before removing the old folder. The test now checks, for a held `.display` and a held blob, that an update and a delete are refused and leave the old folder; it fails at "`.display` held: update" with `old_moved` forced to true. 2. The folder listing is iterated over its `Result`s; an entry error leaves the old layout like a read error. 3. The test is `#[cfg(windows)]`, and its long lines are formatted (rustfmt reports no new lines over `main` for the file). Rerun on Windows 11, RTX 4070 machine: `cargo test -q --locked -p victory-hle --lib --no-fail-fast` 153 passed, 0 failed; `cargo clippy --workspace --all-targets --locked -- -D warnings` clean; `cargo xtask policy` 191 files ok. AI use: Claude Code (Claude Opus 5.5) made the fix and drafted this reply.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 20:33 UTC · original

I checked 80e854a together with #3104 at c450939. With a legacy blob held, the old layout stays in place and no version is committed. One retry case remains after that blob is released. If an interrupted first write left v1.new locked, the old layout still cannot migrate even though all its files can now be read.

Candidate 6e9fd60 keeps your update/delete guard and uses the next free staging version. The test first holds a legacy blob and the staging blob. Releasing only the legacy blob migrates both original blobs and the display name to v2. An update then preserves the untouched blob. Releasing the staging blob allows a later read to clean it up.

Windows HLE: 156 passed, including all 15 save tests. Strict HLE Clippy with and without diagnostics and the asset policy check passed. The same candidate covers normal updates in #3104. @⁠Creaa, could you review the migration side? If you take the fix, please keep the Git author or use Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 20:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/3329#issuecomment-7202815640) I checked `80e854a` together with #3104 at `c450939`. With a legacy blob held, the old layout stays in place and no version is committed. One retry case remains after that blob is released. If an interrupted first write left `v1.new` locked, the old layout still cannot migrate even though all its files can now be read. [Candidate `6e9fd60`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/6e9fd600ba9a9e3952c7f3e113543c78dfae4a94) keeps your update/delete guard and uses the next free staging version. The test first holds a legacy blob and the staging blob. Releasing only the legacy blob migrates both original blobs and the display name to `v2`. An update then preserves the untouched blob. Releasing the staging blob allows a later read to clean it up. Windows HLE: 156 passed, including all 15 save tests. Strict HLE Clippy with and without diagnostics and the asset policy check passed. The same candidate covers normal updates in [#3104](https://git.gtahub.st/github/Marvisak--VIctory/pulls/3104). @⁠Creaa, could you review the migration side? If you take the fix, please keep the Git author or use `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`.
Author
Owner

@⁠Creaa on GitHub · 2026-11-26 20:36 UTC · original

@⁠andrewpozdnakov7-jpg thanks for checking it with #3104. I agree the case is real, but as I read it, it is a delay rather than a loss, and its fix is outside the migration:

  • On main + this PR, a locked v1.new makes current fail (remove_dir_all(...)?), so migrate returns at current_named(...).ok()? and the old layout stays; with #3104's tolerant current it returns at commit(...).ok()? instead. Either way nothing is committed or removed, old_moved refuses updates and deletes, and the next listing after the staging folder is released moves it whole.
  • What your candidate changes is commit choosing the next free staging version, which is shared with every Update::submit and is what #3104 is about (its commit c450939 is in your candidate too). So I would rather keep #3329 to the migration and see that commit change go into #3104 (or a follow-up on it), where it covers both paths at once; whichever lands second can be rebased onto the other, and I will do that on this side.

If @⁠fuzeofficlal prefers it here instead, I can take your commit with you as its author.

AI use: Claude Code (Claude Opus 5.5) checked the code paths and drafted this reply.

**@⁠Creaa** on GitHub · 2026-11-26 20:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/3329#issuecomment-7202889387) @⁠andrewpozdnakov7-jpg thanks for checking it with #3104. I agree the case is real, but as I read it, it is a delay rather than a loss, and its fix is outside the migration: - On `main` + this PR, a locked `v1.new` makes `current` fail (`remove_dir_all(...)?`), so `migrate` returns at `current_named(...).ok()?` and the old layout stays; with #3104's tolerant `current` it returns at `commit(...).ok()?` instead. Either way nothing is committed or removed, `old_moved` refuses updates and deletes, and the next listing after the staging folder is released moves it whole. - What your candidate changes is `commit` choosing the next free staging version, which is shared with every `Update::submit` and is what #3104 is about (its commit `c450939` is in your candidate too). So I would rather keep #3329 to the migration and see that `commit` change go into #3104 (or a follow-up on it), where it covers both paths at once; whichever lands second can be rebased onto the other, and I will do that on this side. If @⁠fuzeofficlal prefers it here instead, I can take your commit with you as its author. AI use: Claude Code (Claude Opus 5.5) checked the code paths and drafted this reply.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 20:48 UTC · original · requested changes

Thanks for the quick fixes in 80e854a — all three items from the earlier review (Update::submit/delete checking old_moved, read_dir(old) error handling, and #[cfg(windows)] on the new test) are resolved, and local checks pass (xtask policy: 191 files ok, clippy default & --all-features clean, modules::xgamesave:: 12 passed, victory-hle --all-targets 153 lib + 2 integration passed).

However, one data-loss edge case remains in old_moved because it resolves the legacy folder differently from containers:

Remaining blocker

  • [P1] old_moved (crates/victory-hle/src/modules/xgamesave.rs:394-397) uses root.join(file_name(name)) instead of matching containers (312-334):
    containers(root) discovers legacy saves by iterating read_dir(root) and checking decode(&file), and container_dir (109-116) hashes exact bytes so container names are case-sensitive ("Player" and "player" are distinct containers). Because old_moved probes root.join(file_name(name)).is_dir() directly:
    1. Case-insensitive Windows mismatch: if legacy Player was deferred while locked, calling delete("player") or Update::submit for "player" probes root.join("player"), hits physical folder Player via is_dir(), migrates Player's legacy save under the distinct name "player", and removes Player (or deletes it outright in delete("player")).
    2. Percent-encoded folder mismatch: for an encoded folder name such as %50layer (decode("%50layer") == Some("Player")), root.join(file_name("Player")).is_dir() is false, so old_moved returns true and lets Update::submit commit v1 for "Player"; a later containers scan then matches %50layer -> "Player", sees current_named is Some, and deletes %50layer without importing its blobs.
    3. Treating !old.is_dir() as absent also masks metadata errors. Scanning read_dir(root) in old_moved with the same !file.contains('~') && !file.ends_with(".gone") && decode(&file).as_deref() == Some(name) filter (and returning false if read_dir(root) errors) keeps old_moved 1:1 with containers.

Minor non-blocking note

  • Once a lock is released, direct read (587) and blob enumeration (820) still only inspect the versioned directory (and used_bytes excludes pending legacy folders) until a listing triggers migrate.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 20:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/3329#pullrequestreview-6080339273) · **requested changes** Thanks for the quick fixes in `80e854a` — all three items from the earlier review (`Update::submit`/`delete` checking `old_moved`, `read_dir(old)` error handling, and `#[cfg(windows)]` on the new test) are resolved, and local checks pass (`xtask policy`: `191 files ok`, `clippy` default & `--all-features` clean, `modules::xgamesave::` 12 passed, `victory-hle --all-targets` 153 lib + 2 integration passed). However, one data-loss edge case remains in `old_moved` because it resolves the legacy folder differently from `containers`: ### Remaining blocker - **[P1] `old_moved` (`crates/victory-hle/src/modules/xgamesave.rs:394-397`) uses `root.join(file_name(name))` instead of matching `containers` (`312-334`):** `containers(root)` discovers legacy saves by iterating `read_dir(root)` and checking `decode(&file)`, and `container_dir` (`109-116`) hashes exact bytes so container names are case-sensitive (`"Player"` and `"player"` are distinct containers). Because `old_moved` probes `root.join(file_name(name)).is_dir()` directly: 1. **Case-insensitive Windows mismatch:** if legacy `Player` was deferred while locked, calling `delete("player")` or `Update::submit` for `"player"` probes `root.join("player")`, hits physical folder `Player` via `is_dir()`, migrates `Player`'s legacy save under the distinct name `"player"`, and removes `Player` (or deletes it outright in `delete("player")`). 2. **Percent-encoded folder mismatch:** for an encoded folder name such as `%50layer` (`decode("%50layer") == Some("Player")`), `root.join(file_name("Player")).is_dir()` is `false`, so `old_moved` returns `true` and lets `Update::submit` commit `v1` for `"Player"`; a later `containers` scan then matches `%50layer` -> `"Player"`, sees `current_named` is `Some`, and deletes `%50layer` without importing its blobs. 3. Treating `!old.is_dir()` as absent also masks metadata errors. Scanning `read_dir(root)` in `old_moved` with the same `!file.contains('~') && !file.ends_with(".gone") && decode(&file).as_deref() == Some(name)` filter (and returning `false` if `read_dir(root)` errors) keeps `old_moved` 1:1 with `containers`. ### Minor non-blocking note - Once a lock is released, direct `read` (`587`) and blob enumeration (`820`) still only inspect the versioned directory (and `used_bytes` excludes pending legacy folders) until a listing triggers `migrate`.
github-bot force-pushed github-bot/gh-3329 from 80e854a221 to ffa792d37d 2026-11-26 21:01:10 +00:00 Compare
Author
Owner

@⁠Creaa on GitHub · 2026-11-26 20:57 UTC · original

@⁠fuzeofficlal right, thanks. Fixed in ffa792d (squashed): old_moved now lists the root and takes the folders containers would take for that exact name (!contains('~'), decode(&file) == Some(name)), migrating each; a read_dir error other than a missing root, or an entry error, counts as not moved.

New test a_held_old_layout_is_matched_by_its_exact_decoded_name, for a held Player folder and a held %50layer folder: an update and a delete of Player are refused, an update and a delete of player succeed and leave the old folder alone, nothing is committed for Player, and after release the next listing gives Player its blob. With the path lookup it fails at "Player: other case".

On the non-blocking note: agreed; until a listing runs, a direct read or a blob listing sees no container, so a title sees it as absent and any write is refused, which keeps the old folder safe. I have left it as it is to keep this PR to the move.

Rerun (Windows 11, RTX 4070 machine): cargo test -q --locked -p victory-hle --lib --no-fail-fast 154 passed, 0 failed; clippy --workspace --all-targets with and without --all-features clean; cargo xtask policy 191 files ok; rustfmt reports no new lines over main for the file.

AI use: Claude Code (Claude Opus 5.5) made the fix and drafted this reply.

**@⁠Creaa** on GitHub · 2026-11-26 20:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/3329#issuecomment-7203250638) @⁠fuzeofficlal right, thanks. Fixed in `ffa792d` (squashed): `old_moved` now lists the root and takes the folders `containers` would take for that exact name (`!contains('~')`, `decode(&file) == Some(name)`), migrating each; a `read_dir` error other than a missing root, or an entry error, counts as not moved. New test `a_held_old_layout_is_matched_by_its_exact_decoded_name`, for a held `Player` folder and a held `%50layer` folder: an update and a delete of `Player` are refused, an update and a delete of `player` succeed and leave the old folder alone, nothing is committed for `Player`, and after release the next listing gives `Player` its blob. With the path lookup it fails at "`Player`: other case". On the non-blocking note: agreed; until a listing runs, a direct read or a blob listing sees no container, so a title sees it as absent and any write is refused, which keeps the old folder safe. I have left it as it is to keep this PR to the move. Rerun (Windows 11, RTX 4070 machine): `cargo test -q --locked -p victory-hle --lib --no-fail-fast` 154 passed, 0 failed; clippy `--workspace --all-targets` with and without `--all-features` clean; `cargo xtask policy` 191 files ok; rustfmt reports no new lines over `main` for the file. AI use: Claude Code (Claude Opus 5.5) made the fix and drafted this reply.
This pull request can be merged automatically.
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/3329/head:github-bot/gh-3329'
git switch 'github-bot/gh-3329'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3329'
git switch 'github-bot/gh-3329'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3329'
git switch 'github-bot/gh-3329'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3329'
git switch 'main'
git merge --squash 'github-bot/gh-3329'
git switch 'main'
git merge --ff-only 'github-bot/gh-3329'
git switch 'main'
git merge 'github-bot/gh-3329'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!3329
No description provided.