fix(hle): account for save replacements before clamping quota #1110

Open
divyeshganta wants to merge 1 commit from upstream-pr/1110 into main
divyeshganta commented 2026-11-24 15:48:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by divyeshganta on 2026-11-24T15:48:25Z.


Related to #923. Quota checks now account for replaced save data before clamping the remaining quota, so replacements cannot hide an existing quota excess. Adds regression coverage for quota boundaries, deletion, and disk-space errors. Patch by DocBlack89 (d2ce712926).

<!-- greyfinch-sync:Marvisak/VIctory:issue:6585734226 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1110). Originally posted by [divyeshganta](https://github.com/divyeshganta) on 2026-11-24T15:48:25Z. --- Related to #923. Quota checks now account for replaced save data before clamping the remaining quota, so replacements cannot hide an existing quota excess. Adds regression coverage for quota boundaries, deletion, and disk-space errors. Patch by DocBlack89 (d2ce712926b2ee163fa9f8bdb5ba52ded90f39ff).
DenRakEiw commented 2026-11-24 16:04:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T16:01:24Z.

Review: APPROVED


Tested merged cleanly onto main (ffe310e) on Windows 11 x64 (Rust 1.98.1 MSVC):

  • cargo test -p victory-hle: 95 passed, 0 failed (plus no_dll_planting: 1 passed)
  • cargo clippy -p victory-hle --all-targets: 0 warnings
  • cargo xtask policy: ok

Clean quota accounting fix for in-place save replacements. Approving.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6042812239 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1110#pullrequestreview-6042812239). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-24T16:01:24Z. **Review:** APPROVED --- Tested merged cleanly onto `main` (`ffe310e`) on Windows 11 x64 (Rust 1.98.1 MSVC): - `cargo test -p victory-hle`: **95 passed, 0 failed** (plus `no_dll_planting`: 1 passed) - `cargo clippy -p victory-hle --all-targets`: **0 warnings** - `cargo xtask policy`: ok Clean quota accounting fix for in-place save replacements. Approving. AI-assisted (Gemini 4 Neon).
Zipettte commented 2026-11-24 18:06:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T18:01:48Z.


Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at d2ce712: cargo test -p victory-hle passes, 96 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7140054112 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1110#issuecomment-7140054112). Originally posted by [Zipettte](https://github.com/Zipettte) on 2026-11-24T18:01:48Z. --- Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at d2ce712: `cargo test -p victory-hle` passes, 96 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
mercuryVM commented 2026-11-24 19:02:24 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T18:58:22Z.

Review: APPROVED


Tested d2ce7129 on Windows 11, RTX 5070, MSVC:

  • cargo test -p victory-hle passes on the head (95 passed).
  • Merged into our fork: workspace tests, shader tests and clippy -D warnings (default and all features) are all clean.

The fix is right. QUOTA - (used - replaced) is the room left after the replaced blobs go away. The old QUOTA.saturating_sub(used) + replaced clamped the excess to zero first and then credited the replacement. The new tests cover:

  • the over-quota provider,
  • the exact boundary,
  • deletion with written == 0,
  • the separate host-disk check.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6045458384 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1110#pullrequestreview-6045458384). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T18:58:22Z. **Review:** APPROVED --- Tested d2ce7129 on Windows 11, RTX 5070, MSVC: - `cargo test -p victory-hle` passes on the head (95 passed). - Merged into our fork: workspace tests, shader tests and `clippy -D warnings` (default and all features) are all clean. The fix is right. `QUOTA - (used - replaced)` is the room left after the replaced blobs go away. The old `QUOTA.saturating_sub(used) + replaced` clamped the excess to zero first and then credited the replacement. The new tests cover: - the over-quota provider, - the exact boundary, - deletion with `written == 0`, - the separate host-disk check. AI-assisted (Claude Code).
Marvisak commented 2026-11-25 02:05:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:19:33Z.


Automated triage for the maintainers.

Needs work. no_room in crates/victory-hle/src/modules/xgamesave.rs changes from written > QUOTA - used (clamped) + replaced to written > QUOTA - (used - replaced) (clamped). The two agree whenever used <= QUOTA. They differ only when a provider is already over quota. The update's own check keeps an emulated save from getting there, so the case only arises from data placed there some other way, for example an old version left behind after a crash (submit removes it after the commit).

In that case the new rule returns QUOTA_EXCEEDED for every update that does not shrink the save. The title would then fail to save where it succeeds today. That changes a runtime return value, and the PR gives no evidence for it. What would move this forward:

  • evidence of how the console's save service handles a container that is already over quota (public documentation or a measurement), or
  • a concrete case in VIctory where used > QUOTA arises and the current behaviour causes a problem.

The new test checks the new arithmetic, not the console's behaviour. The PR also has almost no description. Please state the problem it fixes rather than pointing to #923.

CI: no check runs on the head commit.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149431895 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1110#issuecomment-7149431895). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T01:19:33Z. --- <!-- victory-triage v1 head=d2ce712926b2ee163fa9f8bdb5ba52ded90f39ff verdict=needs-work at=2026-11-25T01:19:30Z --> Automated triage for the maintainers. **Needs work.** `no_room` in `crates/victory-hle/src/modules/xgamesave.rs` changes from `written > QUOTA - used (clamped) + replaced` to `written > QUOTA - (used - replaced) (clamped)`. The two agree whenever `used <= QUOTA`. They differ only when a provider is already over quota. The update's own check keeps an emulated save from getting there, so the case only arises from data placed there some other way, for example an old version left behind after a crash (`submit` removes it after the commit). In that case the new rule returns `QUOTA_EXCEEDED` for every update that does not shrink the save. The title would then fail to save where it succeeds today. That changes a runtime return value, and the PR gives no evidence for it. What would move this forward: - evidence of how the console's save service handles a container that is already over quota (public documentation or a measurement), or - a concrete case in VIctory where `used > QUOTA` arises and the current behaviour causes a problem. The new test checks the new arithmetic, not the console's behaviour. The PR also has almost no description. Please state the problem it fixes rather than pointing to #923. CI: no check runs on the head commit. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1110:upstream-pr/1110'
git switch 'upstream-pr/1110'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/1110'
git switch 'upstream-pr/1110'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1110'
git switch 'upstream-pr/1110'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1110'
git switch 'main'
git merge --squash 'upstream-pr/1110'
git switch 'main'
git merge --ff-only 'upstream-pr/1110'
git switch 'main'
git merge 'upstream-pr/1110'
git push origin 'main'
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!1110
No description provided.