Repository navigation
Conversation
Dukestar69
left a comment
There was a problem hiding this comment.
LGTM — verified on Windows against origin/main (63bcca4).
- Bailing out of
migrateon non-NotFound.displayread 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 (includingan_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).
|
Independent local verification on Windows 11 x64, Intel Arc B580 12 GB (12 cores), at this PR's head 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 |
fuzeofficlal
left a comment
There was a problem hiding this comment.
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:
-
High — An
Update::submitwhile legacy migration is deferred can lead to permanent data loss (xgamesave.rs:343, 377, 484, 525):- Suppose
migratedefers because a legacy file is locked (v1does not exist yet), and the title then runsUpdate::submiton that container. Update::submitreadscurrent(&self.dir)asNone(484), checksused_bytes(root)(525, wheremigrateeither defers again or commitsv1mid-update whilesubmitstill plansnumber = 1), and can commit av1containing only the update's changes (531), returningS_OK.- Once the lock is later released, the next
migrateseescurrent_named(&dir, name)?.is_some() == true(343) and executesstd::fs::remove_dir_all(old)(377), permanently deleting any un-migrated blobs and.displayfrom the old layout. (Updates/containers should refuse or wait until pending legacy migration completes, rather than treating an update-createdv1as proof migration already happened.)
- Suppose
-
Medium —
read_dir(old).ok()?.flatten()still ignores mid-iteration directory errors (xgamesave.rs:358):- While opening
read_dir(old)checks.ok()?,.flatten()silently dropsErritems yielded during directory iteration, which can still commit a partial container and removeold. Iterating explicitly overResultentries and bailing out onErrlike the file reads do closes this path cleanly.
- While opening
-
Non-Windows test compilation break (
xgamesave.rs:1239):modules/mod.rs:38does not gatepub mod xgamesavebehind#[cfg(windows)](the sibling Windows-only test atxgamesave.rs:1131carries#[cfg(windows)]), souse std::os::windows::fs::OpenOptionsExt;insidean_unreadable_old_display_or_blob_leaves_the_old_layout_for_laterwill failcargo test -p victory-hleon 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).
`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 Marvisak#1633). Now a missing `.display` is still an empty name, but any other read failure of the display, of a blob or of the folder listing leaves the old layout untouched and returns, so a later listing moves the container whole. While it waits, an update or a delete of that container moves it first and is refused if it still cannot: `migrate` takes a committed version for its own (a crash after its commit) and removes the old folder, so a version an update committed meanwhile would have cost the old blobs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e419c04 to
80e854a
Compare
|
@fuzeofficlal thanks, all three were real. Fixed in
Rerun on Windows 11, RTX 4070 machine: AI use: Claude Code (Claude Opus 5.5) made the fix and drafted this reply. |
|
I checked Candidate 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 |
|
@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:
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. |
fuzeofficlal
left a comment
There was a problem hiding this comment.
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) usesroot.join(file_name(name))instead of matchingcontainers(312-334):
containers(root)discovers legacy saves by iteratingread_dir(root)and checkingdecode(&file), andcontainer_dir(109-116) hashes exact bytes so container names are case-sensitive ("Player"and"player"are distinct containers). Becauseold_movedprobesroot.join(file_name(name)).is_dir()directly:- Case-insensitive Windows mismatch: if legacy
Playerwas deferred while locked, callingdelete("player")orUpdate::submitfor"player"probesroot.join("player"), hits physical folderPlayerviais_dir(), migratesPlayer's legacy save under the distinct name"player", and removesPlayer(or deletes it outright indelete("player")). - Percent-encoded folder mismatch: for an encoded folder name such as
%50layer(decode("%50layer") == Some("Player")),root.join(file_name("Player")).is_dir()isfalse, soold_movedreturnstrueand letsUpdate::submitcommitv1for"Player"; a latercontainersscan then matches%50layer->"Player", seescurrent_namedisSome, and deletes%50layerwithout importing its blobs. - Treating
!old.is_dir()as absent also masks metadata errors. Scanningread_dir(root)inold_movedwith the same!file.contains('~') && !file.ends_with(".gone") && decode(&file).as_deref() == Some(name)filter (and returningfalseifread_dir(root)errors) keepsold_moved1:1 withcontainers.
- Case-insensitive Windows mismatch: if legacy
Minor non-blocking note
- Once a lock is released, direct
read(587) and blob enumeration (820) still only inspect the versioned directory (andused_bytesexcludes pending legacy folders) until a listing triggersmigrate.
xgamesave::migratemoves a container of the old (pre-versioned) layout into a committed version, then removes the old folder. A.displayit 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: inmigrate,.displaynot 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 beforecommit, leaving the old folder for the next listing.old_moved(root, name);Update::submitanddeletecall it first and returnNO_ACCESSwhile the container's old layout cannot be moved yet, so no version is committed thatmigratewould then take for its own before removing the old folder.an_unreadable_old_display_or_blob_leaves_the_old_layout_for_later: for.displayand for a blob held withshare_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 nextProvider::openmoves both blobs and the display nameChapter 1.Tested
main63bcca4.#[cfg(windows)], like the other Windows-only test here); withmain'smigrateit fails at ".displayheld: nothing committed", and withold_movedalways true at ".displayheld: update".cargo test -q --locked -p victory-hle --lib --no-fail-fast: 153 passed, 0 failed (the_old_layout_moves_overunchanged and passing).cargo clippy --workspace --all-targets --locked -- -D warningsand with--all-features: clean.cargo xtask policy: 191 files ok.Not tested
AI use
🤖 Generated with Claude Code