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

Closed
github-bot wants to merge 1 commit from github-bot/gh-2674 into main AGit
Owner

@⁠SinisterRob on GitHub · 2026-11-25 17:56 UTC · original
hle/portable-save-copy-test → main · +27 −15 · 1 files · 1 commits · closed without merging

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.

**@⁠SinisterRob** on GitHub · 2026-11-25 17:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/2674) `hle/portable-save-copy-test` → `main` · +27 −15 · 1 files · 1 commits · closed without merging 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:11:44 +00:00
github-bot closed this pull request 2026-11-26 06:30:49 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 18:23 UTC · original

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.

**@⁠oni-swr** on GitHub · 2026-11-25 18:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2674#issuecomment-7170832927) **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.
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 18:35 UTC · original

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.

**@⁠kotekompotek** on GitHub · 2026-11-25 18:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/2674#issuecomment-7171111829) 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.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 19:15 UTC · original

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.
**@⁠fuzeofficlal** on GitHub · 2026-11-25 19:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/2674#issuecomment-7172052369) 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.
Author
Owner

@⁠Kajanos on GitHub · 2026-11-25 20:43 UTC · original

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)

**@⁠Kajanos** on GitHub · 2026-11-25 20:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/2674#issuecomment-7174096770) **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)
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 23:24 UTC · original

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

**@⁠Marvisak** on GitHub · 2026-11-25 23:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/2674#issuecomment-7177512647) <!-- victory-triage v1 head=d81fbb241f723152e1303c1467a6c72184f6a26c verdict=merge-candidate at=2026-11-25T23:24:04Z --> 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](https://claude.ai/code)_

Pull request closed

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!2674
No description provided.