Repository navigation
test: pin the Python grid client's failure paths - #267
Conversation
The grid client's tests asserted only that some Exception escapes a failing call. Every GridService method lets the HTTPError from raise_for_status, or the requests error itself, propagate unwrapped, including update_grid_name, which differs from the entity client's wrapped writes. That is now asserted, along with the JSON body never being read on an error, a non-200 2xx rename returning False, the bearer token reaching the write, and the TypeError a null body produces where the entity client falls back to None or []. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Self-review rubric, scored against the diff and CI run 42977141134:
Judgment call flagged rather than acted on: This comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
Summary
This is a Stage B (unit-test expansion) cycle. It covers the Python client's
GridService(src/main/python/preponderous/viron/services/gridService.py) and follows on from the entity client in #266. Before this PR, the grid client's failure tests asserted only that someExceptionescapes. Two of them also contained anassert grid is Noneinside thepytest.raisesblock, which never runs. This PR adds eleven characterization tests tosrc/test/python/preponderous/viron/services/test_gridService.pyand changes no production code.What is now pinned:
get_all_gridsand a 404 onget_grid_by_id,get_grids_in_environmentandget_grid_of_entityall raise theHTTPErrorfromraise_for_status(). In each case.json()is never read.update_grid_namedoes not wrap its errors. A 404, a 400 and aConnectionErrorreach the caller as their original types (exc_info.type is HTTPError). This is the opposite ofEntityService.update_entity_name, which re-raises a bareException(pinned in test: pin the Python entity client's failure paths #266).update_grid_namereturnsstatus_code == 200. A 2xx other than 200 (here 204) returnsFalsewithout raising.GridController.updateGridNameis avoidhandler, so the server answers 200 today.get_all_gridswas checked for it.get_grid_by_idandget_all_gridsraiseTypeErroron anullbody.Observation (not changed here)
get_grid_by_idandget_grid_of_entityare annotatedOptional[Grid], but neither ever returnsNone. A 404 raises, and a null body raisesTypeError. The environment and location clients behave the same way and annotate withoutOptional.EntityServiceis the only client that maps a null body toNoneor[]. The server answers a missing grid with a 404 rather than a null 200, so this has no practical effect today. It is recorded here instead of being filed as a defect.Deferred issues
pom.xmlbuild-pipeline change that is too large for one cycle.Test plan
pytest -q(pytest 9.0.3): 147 passed (136 before, 11 new)python3 -m pytest -q(pytest 7.1.3, Python 3.8): 147 passedCIworkflow's Python jobs run this suite. No Java file is touched.No tracking issue. The gap was found during triage.
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