HLE: reject duplicate blob changes in one save update #590
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/590"
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?
Imported from Marvisak/VIctory. Originally posted by Quat3rnion on 2026-11-24T05:14:58Z.
What
XGameSave permits only one write or delete of a blob per update.
WriteBloband
DeleteBlobaccepted repeated changes andsubmitsilently kept thelast one, so a title could pass locally and then fail the same transaction on
a console. A second change to a blob already in the update is now refused
with
E_INVALIDARG, keeping the first. The existing save test that relied onwrite-then-delete was corrected to expect the refusal.
An AI tool wrote part of this change.
Evidence
The one-change rule is documented in the public API reference: "you can only write one modification/deletion per blob in an update context" (XGameSaveSubmitBlobWrite remarks) and "a single blob can only have one modification to it per update" (XGameSave API overview), both at https://learn.microsoft.com/en-us/gaming/gdk/docs/features/common/game-save/xgamesave . The references do not name a specific HRESULT for a repeated change; this module returns
E_INVALIDARGfor other invalid update arguments, so the guard follows that convention.Tested
cargo test --workspace: 164 passed, 0 failed, 3 ignored. The save fixture now checks that both a delete and a second write of the same blob fail in one update, and verifies the committed blob set.cargo check --target x86_64-pc-windows-gnu --workspace --testspasses. No Windows host here.cargo xtask policypasses (150 files ok). No game files or data from them were added.Checklist
cargo xtask policypasses. No game files or data from them were added.Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T05:16:13Z.
Review: APPROVED
Verified on Windows 11:
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T11:33:41Z.
Review: APPROVED
Tested
32e0690on Windows 11, RTX 5070, MSVC:cargo test -p victory-hle87 passed, including the updated save fixture. Clippy's 1 warning is the existingfield_reassign_with_defaultat xmem.rs:747.WriteBlobandDeleteBlobnow checkupdate.changesfor the name before recording, and the first change is kept. That matches the GDK rule that a blob takes one write or delete per update, and a title that breaks it now fails here as it would on a console instead of passing silently.changesis fine at the GDK's per-update blob limit.AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T12:53:40Z.
Review: reject duplicate blob changes in one save update
Diff read:
crates/victory-hle/src/modules/xgamesave.rsonly, +18 / -3. Full hunks reviewed.What it does
write_blob(xgamesave.rs:881-884) anddelete_blob(xgamesave.rs:892-893) now reject a second change to a blob already queued in the sameUpdate, returningE_INVALIDARG.saves_persist_across_providerstest is updated: a delete of"gone"after writing it is now refused, so the container reports 3 blobs / 8 bytes instead of 2 / 7 (xgamesave.rs:1265,(2,7)?(3,8)), and the new assertions check both the duplicate-delete and duplicate-write rejections.Findings
No correctness or memory-safety bug.
Stringequality, consistent with howUpdate::submitmerges changes (blobs.retain(|(n, _)| n != name),xgamesave.rs:444-449) and with blob names being stored as exact strings in the manifest (no case folding; cf.names_are_exact). So this does not introduce a case-sensitivity mismatch.Behaviour change worth confirming (not a blocker)
This intentionally changes prior semantics: previously a write-then-delete in one update was applied in order in
submitand netted to a deletion, and multiple writes were last-wins. Now any repeat is an error. That matches the GDK rule the PR cites ("loads only one write or delete of a blob per update"), but I could not verify that rule against the GDK headers/docs offline. The only real risk is a title that legitimately writes the same blob more than once per update (e.g. chunked/incremental writes) and previously relied on last-wins ? such a title would now fail the whole update withE_INVALIDARG. Worth a quick check against observed title behaviour.Minor nit:
write_blobcopiesdatainto aVec(xgamesave.rs:875-880, up to 16 MiB) before the duplicate check atxgamesave.rs:881; running the guard first would avoid the copy on the rejected path. Non-blocking.Commands actually run (proxy cleared,
--locked,CARGO_INCREMENTAL=0, shared target dir):cargo xtask policy?asset policy: 154 files ok(exit 0)cargo clippy -p victory-hle --all-targets --locked -- -D warnings? exit 0, no diagnosticscargo clippy -p victory-hle --all-targets --features diagnostics --locked -- -D warnings? exit 0, no diagnosticscargo test -p victory-hle --locked -- xgamesave?7 passed; 0 failed(saves_persist_across_providers,names_are_exact,a_kill_at_any_step_leaves_old_or_new,a_full_disk_is_not_the_quota,the_old_layout_moves_over,an_empty_configuration_id_is_the_default_one,crash_child)Verdict: approve-worthy. Correct and internally consistent; the one thing to sanity-check is the GDK "one write/delete per blob per update" rule against real title behaviour.
AI-assisted; synthetic tests only, no game files.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:23:35Z.
Automated triage for the maintainers.
Needs work.
What it does:
write_blobanddelete_blobincrates/victory-hle/src/modules/xgamesave.rsnow returnE_INVALIDARGwhen the same update already has a change to that blob. The test is updated to expect this. The check itself is consistent with howUpdate::submitmatches names.What it needs:
E_INVALIDARGrather than a failure at submit time.write_blob, run the duplicate check before copyingdata(up to 16 MiB) into aVec.CI: passing.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Quat3rnion on 2026-11-27T02:49:30Z.
@Marvisak Addressed the triage in new head
f58cd1d07: the comment no longer names an SDK acronym, and the duplicate check runs before the up-to-16-MiB blob copy. I added the public documentation for the one-change-per-blob rule to the PR description; the docs do not name an HRESULT for a repeat, soE_INVALIDARGfollows this module's other invalid-update paths. Clippy-D warningspasses on the Windows target.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.