Skip to content

Test the journal, its calendar and the count page - #9

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/journal-tests
Oct 4, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/journal-tests

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Stage B (unit-test expansion) cycle — no production code is changed. The journal is the player's own record of the winter, but scenes/journal.py was 17% covered, and winter.calendar and Galley.sum (the count page the journal shows) had no tests of their own. A new tests/test_journal.py characterises what each page says today:

  • Descriptor: the day, the facts known out of facts.FACTS, and progress along facts.TRAIL.
  • What you know: "Nothing yet." when empty; entries in registry order rather than learning order, with the day each fact was learned and */- trail markers.
  • Leads: the rumour web lists where each known fact points, and a lead disappears once its target is learned.
  • Calendar (winter.calendar): only the plane at first; the ice once heard of (THE_ICE) or lived through; the storm once it has come; the dark flight only while it is coming (gone once the ending is set).
  • The count (Galley.sum): the opening sum is four days short; with Aksel at the table on half rations the sum closes and the manifest line names the 24 missing rations.
  • Menu: "The count" only appears after the store is counted, "The last page" only once the winter is over, and closing the journal goes to the bunkroom, or to the epilogue once the winter is over.

Coverage: scenes/journal.py 17% → 100%, winter.py 90% → 99%, scenes/galley.py 78% → 91%. The tests use the existing FakeGame and ScriptedUI from tests/conftest.py. No real network or save I/O is used.

No production behaviour looked wrong while these tests were written, so no bug issue was filed.

No tracking issue — the backlog was empty at triage (no open issues or PRs), so this cycle was spent on test expansion. A Stage A documentation sweep was done first: README's counts (18 facts, a trail of 5, 20 days, 3 watches, three endings) and its food arithmetic (60/12/8 rations, nineteen nights to the plane), along with docs/STORY.md's count and choices, were checked against facts.py, state.py and winter.py. No drift was found.

Test plan

  • python3 -m compileall -q src tests
  • python3 -m pytest — 57 passed (45 existing + 12 new)
  • Solvability tests in tests/test_game.py / tests/test_endings.py unchanged and passing
  • CI Run Unit Tests green on the PR head
  • black --check could not be run in this sandbox (the command needed approval that a headless run cannot give). The file was hand-wrapped to 88 columns in black's style, but it has not been checked by 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

The journal was 17% covered and winter.calendar and Galley.sum had no
test of their own. These characterise what each page says today: the
descriptor's counts, registry order and trail markers, the leads that
drop away as facts are found, the calendar rows that appear as the ice,
the storm and the dark flight become known, and the count's arithmetic
short, closed and with the manifest.

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

Copy link
Copy Markdown
Member Author

Self-review rubric (scored after Run Unit Tests went green on head 27b7ea8):

  • Scope: PASS — the diff is one new file, tests/test_journal.py (+163). No production file is touched.
  • Tests-new: PASS (not applicable) — no new public method is added. Every method in Journal (run, descriptor, knownText, leadsText, calendarText) plus winter.calendar and Galley.sum is now exercised. Local coverage shows journal.py at 100%.
  • Tests-fix: not applicable — no bug fix is claimed. These are characterisation tests of current behaviour.
  • Sibling structure: PASS — the file follows sibling test files: snake_case test_ names that read as sentences, FakeGame/ScriptedUI from conftest (imported the same way as in tests/test_web_build.py), and no class wrappers.
  • Sibling renames: not applicable — nothing is renamed.
  • Docs: PASS — no behaviour changes, so no documentation row is affected. The Stage A sweep before this cycle found no drift between README/STORY.md and facts.py/state.py/winter.py.
  • Issue resolution: not applicable — there is no Closes, because the backlog was empty.
  • CI: PASS — run 37110630044 (Run Unit Tests) passed, including the coverage run and the browser bundle step.
  • Knowledge-gated / Calendar in one place / One RNG / Flags and endings: PASS — no src/ change. The tests set state.day directly, but only as test setup. test_no_person_or_scene_gates_on_the_day_number scans only src.
  • Save format / Vendored client: PASS — state.py, schemas/save.json and trace_client.py are untouched.
  • Solvable: PASS — tests/test_game.py and tests/test_endings.py are unmodified and pass (57/57 locally).

Notes for the reviewer:

  • tests/test_journal.py:75 and :100 hard-code the literal day numbers ("Day 20", "Day 12") in the expected calendar text. This makes them sensitive to a change in PLANE_DAY/DARK_FLIGHT_DAY. That is deliberate, because the text is what the player reads, but it could be changed to use the constants if that is preferred.
  • black --check could not be run in this sandbox. The file was hand-wrapped to 88 columns, and CI does not enforce black.

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


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit 1c4d188 into main Oct 4, 2026
3 checks passed
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