Repository navigation
Cover the voyage stats in the Stats persistence tests - #223
Merged
Merged
Conversation
The nine voyage/adventure lifetime totals were written and read by StatsJsonReaderWriter but never exercised by a test. Add a round trip and a legacy-save default test for them, plus guards that the writer, the schema and Stats() agree on the full field set and that an empty save falls back to every default. Complete the Stats() defaults test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric (diff: 2 test files, +127 lines, no production code):
Judgment call flagged for a human reader:
Out-of-diff note: locally (not in CI), This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stage B (unit-test expansion) cycle targeting
StatsandStatsJsonReaderWriter. Only test files are changed; no production code is touched.totalHaulingContracts,totalTransportRuns,totalRaids,totalPlunder,totalMoneyFromVoyages,crewLostToPiracy,boatsOwned,totalVoyagesCaptained,totalVoyagesFoundered) were written and read bysrc/stats/statsJsonReaderWriter.pybut were not mentioned by any test. A round-trip test (distinct per-field values, float money values, schema-validated) and a legacy-save test (fields deleted → load as0, other fields kept) are added.createJsonFromStatsmust write exactly the attributes ofStats()and exactly the properties ofschemas/stats.json, andcreateStatsFromJson({})must reproduce everyStats()default (the existing missing-fields test only checked the seven core fields).tests/stats/test_stats.pypreviously asserted 10 of the 29 defaults; the remaining 19 are now asserted, plus a check that theearnedMilestones/unlockedFeatureslists are not shared between instances.No tracking issue — the gap was found during triage (no issues were open at triage time, so no issues were deferred).
Test plan
python3 -m compileall -q srcpytest.main): 985 passed, 1 failed. The single failure,tests/test_saveFileManager.py::test_migrate_old_save_files_skips_a_slot_holding_any_file, reproduces identically on unchangedmainin this environment and is caused by the locally installed editabletakdiffering from therequirements.txtpin; CI onmainpasses it.Run Unit Testsgreen on the PR headThis 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