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

Closed
SinisterRob wants to merge 1 commit from upstream-pr/2674 into main
SinisterRob commented 2026-11-25 17:56:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by SinisterRob on 2026-11-25T17:56:59Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6610504060 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2674). Originally posted by [SinisterRob](https://github.com/SinisterRob) on 2026-11-25T17:56:59Z. --- 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 commented 2026-11-25 19:06:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T18:23:03Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7170832927 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2674#issuecomment-7170832927). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T18:23:03Z. --- **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 commented 2026-11-25 19:06:24 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T18:35:10Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7171111829 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2674#issuecomment-7171111829). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T18:35:10Z. --- 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 commented 2026-11-25 20:06:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T19:15:51Z.


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.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7172052369 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2674#issuecomment-7172052369). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T19:15:51Z. --- 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 commented 2026-11-25 21:03:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Kajanos on 2026-11-25T20:43:25Z.


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)

<!-- greyfinch-sync:Marvisak/VIctory:comment:7174096770 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2674#issuecomment-7174096770). Originally posted by [Kajanos](https://github.com/Kajanos) on 2026-11-25T20:43:25Z. --- **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)
Marvisak commented 2026-11-26 00:03:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T23:24:16Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7177512647 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2674#issuecomment-7177512647). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T23:24:16Z. --- <!-- 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)_
upstream-sync closed this pull request 2026-11-26 06:02:40 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!2672
No description provided.