Repository navigation
chore(game-state): remove dead save_supported flag (issue #415) - #428
Conversation
There was a problem hiding this comment.
AI Automated Review
Full PR review.
Analysis engine: MiniMax-M3 (anthropic) — primary route · pr-reviewer-action v3.4.1
Findings (1 info)
| Severity | Location | Finding |
|---|---|---|
| Info | PR body mentions CI was not run locally beyond suite + smoke replication; CI Check Results show all gates green on the head commit, so this is informational only. |
Recommendation: Approve
This is a 2-line, dead-state cleanup that maps cleanly to issue PR 415's first acceptance path ("delete the variable entirely") and does not change runtime behavior. Verified via diff and independent repo-wide reference sweep.
Change-by-change
scripts/game_state.gd:21—var save_supported := falseremoved.scripts/game_state.gd:38(now:37) —save_supported = trueremoved from_ready().
Both removals are exactly the two write/read sites of save_supported in the diff. Repo Impact Scan term save_supported returned no git grep hits — confirms zero remaining references and no dynamic get("save_supported") access.
PR's quantified claims, falsification pass
- Claim 1 (invariants keep): held. Removing a write-only variable cannot affect save-backend selection, save format, or any call site.
- Claim 2 (
use_local_storage-only gating): unverified at item level. The runtime check needs consumer-side tools I don't have here, but thesave_supportedsymbol was independent ofuse_local_storagein the original code (parallelvars set independently), so deleting one cannot affect the other. Repo Impact Scan termuse_local_storagenot run; the claim is structural rather than behavioral. - Claim 3 (no save-format change, explicit-key
JSON.stringify): unverified at the stringify call site (would needgit grepofJSON.stringifyinscripts/game_state.gd), but the symbolic claim holds —save_supportedwas never written to a save dict. - Claim 4 (loader validates with
data.has(...)): unverified — same caveat, claim is structural. - Claim 5 (zero reads of
save_supportedrepo-wide): held per Repository Impact Scan (termsave_supported→ no git grep hits). Author'sgrepclaim about save-backend selection citing_save_game_impl,load_game,clear_game,save_settings,load_settings,backup_save,_backup_save_local_storage,_prune_old_backups,list_backups,restore_backupinscripts/game_state.gdis plausible; I cannot falsify it without those grep results, but it is consistent with the symbol being unused. - Loading-state safety: removed variable had default
falseand was flipped totruein_ready(). No code path read it (per the issue's evidence and the repo-wide sweep), so removing the default and the assignment cannot leave a stale reader.
Required check disposition
- verify audit findings are addressed: satisfied. Issue PR 415's audit finding is that
save_supportedis write-only, dead state. The PR deletes the declaration and its sole assignment, closes the dead-state audit finding, and the choice ("delete" vs. "make it a real guard") is explicitly defended in the PR body as deliberate scope discipline for a P3 chore. CI Check Results show all eight gates (Headless smoke test,macOS validation,Export validation (Web),Script test suite, three more export validations,Release tag validation) succeeded on heada30bafb4. No behavior change for the desktop build (issue acceptance) — confirmed by removing the only write site and having zero readers.
Standards Compliance
- The change is a minimal, focused chore on a single file (
scripts/game_state.gd), matches the issue's expected-file list, and follows AGENTS.md's "make one focused change" implicit discipline. - Validation matches the AGENTS.md-canonical invocation (
godot --headless --path . --script res://tests/<suite>.gd); the report mentions Pinned Godot 4.7.1-stable (matchesAGENTS.mdandCONTRIBUTING.md). - CI workflow gates (
smoke,script-tests,macOS, three exports) all green on the head commit per CI Check Results.
Linked Issue Fit
Issue PR 415 acceptance criteria:
- "Either delete the variable entirely, or use it as the real guard …" — ✅ chose deletion; explicit, documented choice.
- "If kept as a real guard,
tests/covers the false branch" — N/A (variable deleted, not kept). - "No behavior change for the desktop build" — ✅ satisfied: removed assignment was the only write; zero reads; desktop save path runs unchanged via
use_local_storagebranch logic in_ready().
The PR closes all three acceptance items. Scope is limited to the issue's named file (scripts/game_state.gd), with no scope drift.
Tool Harness Findings
No tool calls were issued; the corpus was reviewed directly. The save_supported reference sweep via Repository Impact Scan came back empty across scripts/scenes/tests/docs/.github/.tscn/.cfg/.json — consistent with the PR's claim of zero remaining references.
Unknowns or Needs Verification
- CI was green on the head commit at PR open, but the PR body acknowledges CI was not run locally beyond suite + smoke replication. Since CI Check Results show success on the actual head SHA, this is moot.
- I did not run
git grep -n JSON.stringify scripts/game_state.gdto fully mechanically verify Claim 3 at the call-site level; the claim is structural and well-supported by the diff regardless.
What
Removes the dead
GameState.save_supportedvariable (declaration + unconditionalsave_supported = truein_ready()), taking the issue's "delete the variable entirely" acceptance path. No other code changed.Chose deletion over "make it a real guard" deliberately: turning it into a gate (e.g.
falsewhen web has nolocalStorage, with call sites checking it) would change web-build save behavior and require new false-branch tests — scope creep for a P3 dead-state cleanup. The actual save/backend decision was and remainsuse_local_storagealone.Closes #415
Invariants this change must keep, and every code path enforcing each
use_local_storageonly (set in_ready()fromOS.has_feature("web")+localStorageavailability). Enforced by_save_game_impl,load_game,clear_game,save_settings,load_settings,backup_save/_backup_save_local_storage,_prune_old_backups,list_backups,restore_backup(all inscripts/game_state.gd). None of them readsave_supported, so none are affected; all still branch solely onuse_local_storage.JSON.stringifyof a caller-built dict), never reflective ofGameStatemember variables, so removing the member cannot alter what is written or break old saves. The loader validates withdata.has(...)checks and needs no migration.grep -rn save_supportedover scripts/, scenes/, tests/, docs/, .github/, .tscn/.cfg/.json → no remaining references; also noget("save_supported")-style dynamic access).register_web_unload_flush(issue [P3] Web build loses debounced progress on tab close — no pagehide/beforeunload flush hooks the browser unload lifecycle #403) gates on_os_has_feature_hook("web")anduse_local_storage, notsave_supported; untouched.Local validation (Godot 4.7.1-stable headless, pinned per godot-toolchain.json, sha256 verified)
.github/actions/load-godot-toolchainrun_tests: 33/33 suites OK, noSCRIPT ERRORin any log (includestest_runner: 119 passed, 0 failed).run_smoke(--fixed-fps 60 --quit-after 300): clean, noSCRIPT ERROR/ERROR:lines.CI (Test workflow: smoke, script-tests, macOS, exports) not run locally beyond the suite + smoke replication above — checks are pending on this PR; operator verifies per repo process.
Head
a30bafb493547465ef5755e0363e67c6e89e7b5d