Skip to content

test: pin a save in an unknown place, an uncopyable damaged save and closing the log unread - #56

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/game-recovery-tests
Nov 16, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/game-recovery-tests

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Stage B (unit-test expansion) cycle. The only open issue, #18, is waiting on a story decision (see its comment), so it was not picked up. A documentation accuracy sweep was run first and found no drift: the README's counts (18 facts, a 5-fact trail, 20 days, 3 watches, 7 places, 3 endings, 15 days of store, 3 from the depot and 2 from a seal), the env-var names, the usage-reporting events and schemas/save.json were each checked against facts.py, state.py, config.py, usageReporting.py and State.toDict, and all of them match.

Three behaviour-bearing paths that no test reached before are now pinned. Only tests change:

  • game.py — a save in a place the game no longer has (_runGameLoop's fallback): the save loads without counting as a failed load, resumes in the galley, and keeps the facts already learned.
  • game.py — a damaged save that cannot be copied aside (_preserveDamagedSave's OSError branch): the player is told "It could not be copied aside.", no .damaged-* file is left behind, and a fresh winter starts.
  • scenes/office.py — closing the station log unread: costs no watch and teaches no fact.

After this change, game.py and scenes/office.py are both at 100% statement coverage.

Test plan

  • python3 -m pytest: 196 passed (193 before, plus 3 new)
  • pytest --cov: game.py and scenes/office.py at 100%
  • No production code changed. FULL_RUN and tests/test_endings.py run unmodified.
  • CI green on the PR head

black --check could not be run in this sandbox. No changed line goes past black's 88-column limit, and CI does not enforce black.

This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).

🤖 Generated with Claude Code


drafted by Claude on behalf of Daniel Stephenson

…closing the log unread

Three paths no test reached: a save whose location the game no longer
has resumes in the galley with its facts kept; a damaged save that cannot
be copied aside says so and leaves no backup behind; and opening the
station log and closing it unread costs no watch and teaches nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (internal; not an independent review):

  • Scope: PASS. The diff touches only tests/test_game.py and tests/test_scenes.py, adds 3 tests and 1 import, and changes no production code.
  • Tests-new: PASS (not applicable). No new public method or function was added. Each of the 3 new tests targets a branch that pytest --cov reported as missed before this change: game.py:155, game.py:190-191 and scenes/office.py:94. All three are covered now.
  • Tests-fix: not applicable. This is a characterization cycle with no bug fix, so no fix exists to revert.
  • Sibling structure: PASS. The new game tests reuse the scripted fixture and the write-the-save-then-Load Slot 1 pattern from test_a_damaged_save_is_kept_aside_and_a_fresh_winter_starts. The office test reuses scene() and FakeGame, like the other test_scenes.py tests.
  • Sibling renames: not applicable. Nothing was renamed.
  • Docs: PASS. Only tests changed, and the README's Development section still describes the suite correctly. A repo-wide docs sweep found no drift (details in the PR body).
  • Issue resolution: not applicable. No Closes line. A report to Base after the twelfth day never brings the dark flight, but Dov, the journal and the last page don't know that #18 was deferred because it is waiting on a story decision.
  • CI: PASS. test (3.8), test (3.12) and docker are all green on the head SHA.
  • Knowledge-gated / Calendar in one place / One RNG / Flags and endings: PASS. No src/ file changed.
  • Save format: PASS. state.py and schemas/save.json are untouched. The galley test writes a schema-valid save whose location the game does not know, which schemas/save.json allows because location is a free string.
  • Solvable: PASS. FULL_RUN and tests/test_endings.py run unmodified, and the suite passes 196 of 196.
  • Vendored client untouched: PASS. trace_client.py is not in the diff.

Finding to note:

  • tests/test_game.py — test_a_damaged_save_that_cannot_be_copied_aside_says_so patches shutil.copy2 on the module object shared with the stdlib. The patch goes in only after the first game has written the save, so only the reload sees it, and monkeypatch undoes it at teardown. Accepted as is.

Verdict: a test-only PR with CI green and no paths on the do-not-auto-merge list. It is eligible to merge.

This comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit f88c110 into main Nov 16, 2026
3 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/game-recovery-tests branch November 16, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant