Repository navigation
Characterize main's unguarded cache and location failures - #56
Merged
dmccoystephenson merged 2 commits intoNov 4, 2026
Merged
Conversation
Line coverage of main.py is already 100%, but no test or doc said what happens when environments.json is damaged, when an entry has no environment_id, or when fetching locations fails. All of these propagate out of main(), and a non-object cache file only fails after Viron has created an environment. Pin that and describe it in the README. window.close() is left unasserted, since that is the question open in #42. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every run against such a file creates another unrecorded environment, and it was the only listed failure without a recovery step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric (anchored on CI run 41813543390, which passed at head
Inline notes:
The diff is review-ready. No do-not-auto-merge path is touched, and no file has more than 50 lines deleted. This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
dmccoystephenson
deleted the
feature/characterize-unguarded-main-failures
branch
November 4, 2026 10:22
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, with the matching README note.
main.pyalready had 100% line coverage, but no test or document described its failure paths outside the two calls already covered (get_environment_by_id, which is guarded, andcreate_environment, which was characterized in #43). No production code is changed.New
TestUnguardedFailurescases intests/test_main.py:environments.jsonthat is empty or malformed:JSONDecodeErrorpropagates before Viron is contacted, and the file is left as it was.environments.jsonholding valid JSON that is not an object ([]):TypeErrorpropagates, but only aftercreate_environmenthas run, so a new Viron environment goes unrecorded.environment_id:KeyErrorpropagates, because the lookup sits just above thetry, so theError loading environmentpath is not taken.get_locations_in_environmentfailing after a creation, with and without--exit-after-create: the exception propagates, the environment stays recorded, andenvironment-createdhas already been reported.get_locations_in_environmentfailing after a successful load: the exception propagates and no load error is drawn.README.mdgains a short list under the existing failure paragraphs, including how each state is recovered from where a recovery exists.Nothing here asserts on
window.close(). Pygame is left initialised on every one of these paths, the same asymmetry #42 asks about, and that question remains open.No tracking issue: the gap was found during triage. The related question is recorded as a comment on #42 instead of a new issue, since one decision covers both.
Test plan
python3 -m unittest discover -s tests: 165 tests ran, OK (159 before, plus 6 new)python3 -m py_compileon every module listed in the CI workflow passespython3 headless_run.py: all three scenarios PASS with the real Pygame on SDL's dummy driverspygame.get_init()stillTruemain.pywas temporarily changed to tolerate a damaged cache file, to move theenvironment_idlookup inside thetry, and to catch both location fetches. All 6 new tests failed (7 failures counting subtests), and restoring the source returned the suite to greenpython3 main.py 10 --exit-after-createagainst a live Viron) is UNVERIFIED-not-applicable: no rendering or Viron-service code is touched. The exceptions from real HTTP failures were not observed; the service source was read to confirmraise_for_status()is called on the location fetchDeferred issues
Vironsubmodule requires explicit authorization.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