xgameruntime_gamesave: undo a partly applied update instead of leaving it (RT-GAMESAVE-COMMIT-ROLLBACK) #992
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!992
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/992/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Snooozs on GitHub · 2026-11-24 16:33 UTC · original
Snooozs:gamesave-commit-rollback→main· +185 −13 · 2 files · 1 commits · merged 2026-11-24 22:31 UTCClaimed in the coordination issue as: RT-GAMESAVE-COMMIT-ROLLBACK (#14)
Depends on: none. #147 changes the quota loop of the same function; whichever lands second may need a small rebase.
What and why
commit()inruntime/shims/xgameruntime_gamesave.cppreplaced blobs one rename at a time. If a later rename failed (another process, such as a backup or antivirus tool, holds the blob open withoutFILE_SHARE_DELETE),XGameSaveSubmitUpdatereturnedE_GS_OUT_OF_LOCAL_STORAGE, but the earlier blobs were already new and a~file stayed. The container then held blobs of two different updates, against the file's own "a failed write leaves the container as it was".<blob>~b~before changing it; a failed op undoes the applied ones, newest first, and the same error is returned.~, whichencode_namenever produces anddecode_namerejects, so enumeration and the quota do not see them.Not covered: there is no journal. A process that dies midway leaves each blob old or new, as before. The path where the undo itself fails has no test. Names that differ only in case are unchanged.
Tested
Windows 10 Pro 22H2 (19045), VS 2022 RelWithDebInfo,
ctest -R gamesave:xgameruntime_gamesave_test: 76 checks, 0 failures. The new test withmain's shim: 76 checks, 5 failures.tests/test_saves.py(70 OK, 3 skipped) andtests/test_saves_import_args.pypass.check_no_game_data.pyon both files: clean. Synthetic saves only.GPUs tested: n/a
AI-assisted: yes. Claude Code (a Haiku 5.5 subagent found the bug and wrote the change, Claude Opus 5.5 reviewed and corrected it and reran the tests).
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator rule)🤖 Generated with Claude Code
@moffington on GitHub · 2026-11-24 17:45 UTC · original
Reviewed
34e6b2968under Wine 11.20.The game-save tests passed all 76 checks, compared with 56 on base. Running the updated tests against the base implementation produced five expected failures.
I also ran additional fault-injection tests covering mixed writes/deletes, blocked file operations, rollback failures, stale temporary/backup files, and post-rollback quota and enumeration behavior:
Verified that Wine enforces the file-sharing restrictions used to trigger these failures. The rollback path correctly retains backups when restoration fails and continues rolling back earlier operations.
No actionable defects found within the PR's scope. The quota changes in #147 appear complementary.
@Snooozs on GitHub · 2026-11-24 18:00 UTC · original
Thanks @moffington, the rollback-failure and stale-backup injections are exactly the path I listed as untested in the description, so it is good to have them covered independently, and on Wine as well.
@QemmHD on GitHub · 2026-11-24 22:31 UTC · original
Merging.
Why merged: RT-GAMESAVE-COMMIT-ROLLBACK: a game-save commit() backs up each blob to "
b" and, if a step fails, undoes the applied steps newest-first, so a failed save can't leave a half-written container. At startup it removes the stray "~" temporaries a commit that died midway left behind, only inside the container directory and leaving backups alone. moffington ran it under Wine: 76 checks pass, versus 5 expected failures with the new tests against the old code.Why it's good: xgameruntime_gamesave passes both plain and under validation.
Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main
4a50cafc7, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative of this batch (13 PRs) on main540d5111f: the repo-consistency set gives 573 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 316/317 with the usual 11 skips; the only failure is main's pre-existing d3d12_depth_resolve. All d3d12_* tests under validation: 119/120 with 0 VUIDs. The full semantic suite has the same single environment-only failure as main. git merge-tree against current main51a6074d2: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.AI-assisted (Claude Code, Claude Opus 5.5).
@Snooozs on GitHub · 2026-11-25 12:23 UTC · original
My Discord username is
snoozs_(for the developer role request).