Skip to content

XGameSave: test the copy fallback without an NTFS volume - #2674

Closed
SinisterRob wants to merge 1 commit into
Marvisak:mainfrom
SinisterRob:hle/portable-save-copy-test
Closed

SinisterRob wants to merge 1 commit into
Marvisak:mainfrom
SinisterRob:hle/portable-save-copy-test

Conversation

@SinisterRob

Copy link
Copy Markdown

The kept-blob regression currently makes 1,024 hard links and expects the last one to fail. Under Wine on ext4 the filesystem accepts it, so the test fails before checking the save.

Pass a link function into the version writer. Production supplies the filesystem hard-link call. The regression supplies a link operation that returns TooManyLinks for the kept blob, then checks the committed version still contains that blob's original bytes alongside the updated blob.

Tested on Wine 11.22 on ext4. The original test failed because the extra link succeeded. The revised test passes, along with the save interruption and recovery tests. Separate Winsock test behavior on Wine is tracked in #2249. No game data. AI-assisted.

@oni-swr

oni-swr commented Nov 25, 2026

Copy link
Copy Markdown

Independent verification of #2674 (XGameSave: copy-fallback test without an NTFS volume)

PR head d81fbb241f723152e1303c1467a6c72184f6a26c, merges cleanly onto origin/main 13f91caee25f2fdf2c062be5f7a27f058e51cbca.

Environment: Windows 11 Pro 10.0.26200, rustc 1.98.1, CPU only, -j 4 --locked.

Tests/clippy vs baseline. origin/main: cargo test -p victory-hle --lib --locked = 146 passed, 0 failed. With #2674: 146 passed, 0 failed (the test is rewritten, not added). cargo clippy -p victory-hle --all-targets --locked: 0 warnings on both.

Diff review. Production behaviour is unchanged: commit now calls commit_with_link with std::fs::hard_link, and the closure replaces the direct call. The test injects ErrorKind::TooManyLinks for exactly the kept blob, asserts the source and destination paths it receives, then checks the new version's contents and that the old blob is gone. It no longer needs an NTFS temp folder or 1023 extra links, and it is no longer cfg(windows).

Negative control (scratch, not committed). Changing the production line to link(from, &path)? (no copy fallback) makes the test fail: called Result::unwrap() on an Err value: Kind(TooManyLinks). With the fallback restored it passes.

Findings: no bugs. Nit: the test no longer runs the real hard_link path (it only checks that commit forwards it), and the old assertion that the other links to the old blob stay intact went away with the link flood; fine for a unit test, but nothing now checks that a real over-limit hard_link reports TooManyLinks on NTFS.

Limits: no non-NTFS volume was available, so a real FAT/exFAT path was not run; the injected error stands in for it. No game files.

AI-assisted: independent verification by Claude Code / Claude Sonnet 5.5, run on behalf of oni-swr. Claims for #1633.

@kotekompotek

Copy link
Copy Markdown

Injecting the link operation is the right fix - the test now exercises the fallback deterministically instead of depending on NTFS's 1024-link ceiling, and it works on filesystems without a hard-link limit (ext4/Wine). Dropping the cfg(windows) gate is a bonus. Verified: production still passes std::fs::hard_link, and the test asserts the kept blob's bytes survive via the copy path.

@fuzeofficlal

Copy link
Copy Markdown
Contributor

Independent Windows 11 verification and review of d81fbb2 (on 13f91ca):

Verification (rustc 1.98.1 MSVC)

  • cargo clippy --locked -p victory-hle --all-targets -- -D warnings and --features diagnostics: 0 warnings.
  • cargo test --locked -p victory-hle --lib -- xgamesave: 11 passed, 0 failed (including a_kept_blob_past_the_link_limit_is_copied).
  • cargo test --locked -p victory-hle: 146 passed (lib), plus fidelityfx (1) and no_dll_planting (1) clean.

Review Notes

  • Factoring commit onto commit_with_link(..., std::fs::hard_link) preserves the exact atomic v{n}.new -> sync_all -> MANIFEST -> rename production path while letting a_kept_blob_past_the_link_limit_is_copied deterministically trigger ErrorKind::TooManyLinks without relying on NTFS's 1024 hard-link limit. Clean and ready to merge.

@Kajanos

Kajanos commented Nov 25, 2026

Copy link
Copy Markdown

Linux / Wine run (no NTFS), head d81fbb241f merged onto main 13f91caee2.

Setup: Linux (Gentoo) / wine-proton 11.0.3 / vkd3d-proton 3.1, RTX 5080, NVIDIA 620.73.04; cross-built with cargo-xwin for x86_64-pc-windows-msvc, rustc 1.98.1. The Wine temp folder is on ext4.

  • On main, xgamesave::tests::a_kept_blob_past_the_link_limit_is_copied fails here with the temp folder must be on NTFS, which allows 1024 links to a file.
  • With this PR it passes. cargo xwin test -p victory-hle: 145 passed, 1 failed. The one failure, net::tests::only_loopback_is_reachable (ws2_32.dll lacks WSAConnectByList), is a Wine gap that also fails on main.

Not run: Windows/NTFS (others above have covered it), clippy.

AI-assisted (Claude Code)

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 25, 2026

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

This splits commit in crates/victory-hle/src/modules/xgamesave.rs into a thin wrapper over commit_with_link, which takes the link function; production still passes std::fs::hard_link, so the save path is unchanged. The test a_kept_blob_past_the_link_limit_is_copied now injects TooManyLinks for the kept blob instead of creating 1,023 real links, so it no longer depends on NTFS and drops its cfg(windows) gate while still checking that the copy fallback keeps the blob's bytes. It merges cleanly alongside #2675, which edits the same file. CI (check) passes.

This is a recommendation for a maintainer to look, not an approval.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants