startup: reject new updates on a closed save container #1976

Manually merged
github merged 1 commit from gh-pr/1976/head into gh-pr/1976/base 2026-11-26 23:47:02 +00:00
Owner

@⁠avt0m4t48 on GitHub · 2026-11-24 22:27 UTC · original
avt0m4t48:fix/startup-save-closed-update → main · +4 −1 · 2 files · 1 commits · merged 2026-11-24 22:34 UTC

Refs #1200. A pending update pins the container name until that update ends. Creating another update requires a live container reference, so use the reference count for that check. The source-built fixture closes a container while its first update is open, checks that the first update still resolves the pinned name, and checks that the closed container cannot start a second update.

g++ -std=c++17 -O2 -Wall -Wextra -pedantic -pthread -Isrc/startup_stubs tests/startup_gamesave_persist.cpp -o <test> followed by running the binary passed on Linux (GCC 14.2). The added assertion fails on the original save_store.h. The focused save enumeration, cross-process publication, lock and blob-packing controls also passed. Windows provider execution and the reported second-start setup behavior remain unverified.

Source-built inputs only. AI-assisted using Codex.

**@⁠avt0m4t48** on GitHub · 2026-11-24 22:27 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1976) `avt0m4t48:fix/startup-save-closed-update` → `main` · +4 −1 · 2 files · 1 commits · merged 2026-11-24 22:34 UTC Refs #1200. A pending update pins the container name until that update ends. Creating another update requires a live container reference, so use the reference count for that check. The source-built fixture closes a container while its first update is open, checks that the first update still resolves the pinned name, and checks that the closed container cannot start a second update. `g++ -std=c++17 -O2 -Wall -Wextra -pedantic -pthread -Isrc/startup_stubs tests/startup_gamesave_persist.cpp -o <test>` followed by running the binary passed on Linux (GCC 14.2). The added assertion fails on the original `save_store.h`. The focused save enumeration, cross-process publication, lock and blob-packing controls also passed. Windows provider execution and the reported second-start setup behavior remain unverified. Source-built inputs only. AI-assisted using Codex.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:47:00 +00:00
github manually merged commit 2260b7a41a into gh-pr/1976/base 2026-11-26 23:47:02 +00:00
Author
Owner

@⁠ChazY11 on GitHub · 2026-11-24 22:30 UTC · original

Built and ran it on Windows/MSVC — the platform the description leaves unverified

Windows 11 build 26300.9974, MSVC 19.44, dev preset:

cmake --build --preset dev --target startup_gamesave_persist    # exit 0
ctest --preset dev -R '^startup_gamesave_persist$'
1/10 Test #110: startup_gamesave_persist ... Passed 1.42 sec

(The other nine gamesave entries in that filter report "Not Run" because they need executables I did not build — my selection, not
the PR.)

Two mutations, both caught

mutation result
refs_[container] == 0 → names_[container].empty() (the original check) caught
container >= capacity || refs_[container] == 0 → container >= capacity only caught

The first is the one that matters: it is the pre-change line, so the fixture genuinely fails without the fix rather than merely
passing with it. The second shows the reference-count check is not decorative — dropping it accepts a closed container with a name
still pinned by the pending update.

Why the reference count is the right predicate here

A pending update keeps the name alive after the container is closed, so names_[container].empty() answers "does this slot have a
name", not "can I start an update". Using refs_ asks the question the caller actually needs, and the fixture's sequence — open,
start update, close, resolve the pinned name, then try a second update — is the shortest one that distinguishes the two.

What is unverified

The Windows provider path and the reported second-start behaviour, as the description says, are not exercised here; the fixture is a
host-side model of the store. Whether the real provider pins the name across a close is a claim about the provider, not about this
header.

Verdict

Reviewed. One-line change, the fixture fails on the old line, and both halves of the condition are pinned.

Notes

  • AI-assisted review.
**@⁠ChazY11** on GitHub · 2026-11-24 22:30 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1976#issuecomment-7146312329) ## Built and ran it on Windows/MSVC — the platform the description leaves unverified Windows 11 build 26300.9974, MSVC 19.44, `dev` preset: ```powershell cmake --build --preset dev --target startup_gamesave_persist # exit 0 ctest --preset dev -R '^startup_gamesave_persist$' 1/10 Test #110: startup_gamesave_persist ... Passed 1.42 sec ``` (The other nine `gamesave` entries in that filter report "Not Run" because they need executables I did not build — my selection, not the PR.) ## Two mutations, both caught | mutation | result | |---|---| | `refs_[container] == 0` → `names_[container].empty()` (the original check) | **caught** | | `container >= capacity \|\| refs_[container] == 0` → `container >= capacity` only | **caught** | The first is the one that matters: it is the pre-change line, so the fixture genuinely fails without the fix rather than merely passing with it. The second shows the reference-count check is not decorative — dropping it accepts a closed container with a name still pinned by the pending update. ## Why the reference count is the right predicate here A pending update keeps the name alive after the container is closed, so `names_[container].empty()` answers "does this slot have a name", not "can I start an update". Using `refs_` asks the question the caller actually needs, and the fixture's sequence — open, start update, close, resolve the pinned name, then try a second update — is the shortest one that distinguishes the two. ## What is unverified The Windows provider path and the reported second-start behaviour, as the description says, are not exercised here; the fixture is a host-side model of the store. Whether the real provider pins the name across a close is a claim about the provider, not about this header. ## Verdict Reviewed. One-line change, the fixture fails on the old line, and both halves of the condition are pinned. ## Notes - AI-assisted review.
This discussion has been locked. Commenting is limited to contributors.
No description provided.