flush a kept save blob that had to be copied #1667

Manually merged
github merged 1 commit from gh-pr/1667/head into gh-pr/1667/base 2026-11-26 04:40:52 +00:00
Owner

@⁠imjustprism on GitHub · 2026-11-24 20:35 UTC · original
imjustprism:fix/save-kept-blob-sync → main · +34 −2 · 1 files · 1 commits · merged 2026-11-25 00:15 UTC

when a save update keeps a blob, commit hard-links it from the previous version, and if the link fails it falls back to std::fs::copy. that copy was never flushed, but the new version is renamed in and the old one deleted right after, so a power cut could leave a committed version with an empty kept blob and no old version to go back to. the fallback now goes through the same write + sync_all as new data.

the fallback only runs where hard links fail: a data folder on a volume without them (fat32/exfat, some shares), or a blob that already has 1024 links. i checked on ntfs that another process holding the old blob open does not make the link fail, so that is not a trigger.

no test can see whether bytes reached the disk, so there is no test that fails without this. the new test forces the fallback through the ntfs link limit and checks the committed version has the kept blob's exact bytes, which nothing covered before. clippy both ways, cargo test --workspace (343 passed) and xtask policy on windows 11.

touches the same two lines as #237.

**@⁠imjustprism** on GitHub · 2026-11-24 20:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/1667) `imjustprism:fix/save-kept-blob-sync` → `main` · +34 −2 · 1 files · 1 commits · merged 2026-11-25 00:15 UTC when a save update keeps a blob, commit hard-links it from the previous version, and if the link fails it falls back to std::fs::copy. that copy was never flushed, but the new version is renamed in and the old one deleted right after, so a power cut could leave a committed version with an empty kept blob and no old version to go back to. the fallback now goes through the same write + sync_all as new data. the fallback only runs where hard links fail: a data folder on a volume without them (fat32/exfat, some shares), or a blob that already has 1024 links. i checked on ntfs that another process holding the old blob open does not make the link fail, so that is not a trigger. no test can see whether bytes reached the disk, so there is no test that fails without this. the new test forces the fallback through the ntfs link limit and checks the committed version has the kept blob's exact bytes, which nothing covered before. clippy both ways, cargo test --workspace (343 passed) and xtask policy on windows 11. touches the same two lines as #237.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:40:50 +00:00
github manually merged commit eb7cc2d437 into gh-pr/1667/base 2026-11-26 04:40:52 +00:00
Author
Owner

@⁠acetonahard-code on GitHub · 2026-11-24 22:09 UTC · original

Tested on Windows 11 with the repo toolchain, merged into current main (70564ae):

cargo test -p victory-hle passed failed ignored
main 99 0 0
main + this PR 100 0 0
  • The new test passes.
  • cargo clippy --all-targets -- -D warnings, with and without --all-features: clean.

I didn't test with game data.


Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.

**@⁠acetonahard-code** on GitHub · 2026-11-24 22:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/1667#issuecomment-7145880609) Tested on Windows 11 with the repo toolchain, merged into current `main` (70564ae): | `cargo test -p victory-hle` | passed | failed | ignored | |---|---|---|---| | `main` | 99 | 0 | 0 | | `main` + this PR | 100 | 0 | 0 | - The new test passes. - `cargo clippy --all-targets -- -D warnings`, with and without `--all-features`: clean. I didn't test with game data. --- <sub>Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.</sub>
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!1667
No description provided.