HLE: reject duplicate blob changes in one save update #590
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!590
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@Quat3rnion on GitHub · 2026-11-24 05:14 UTC · original
Quat3rnion:victory-save-duplicates→main· +18 −3 · 1 files · 1 commits · openWhat
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.
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.@geiyiliyabumo on GitHub · 2026-11-24 12:53 UTC · original
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.
@Marvisak on GitHub · 2026-11-25 01:23 UTC · original
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
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.