Skip to content

test: pin the Python environment client's failure paths - #268

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/pin-environment-client-failure-paths
Nov 12, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/pin-environment-client-failure-paths

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

A Stage B (unit-test expansion) cycle covering the Python client's EnvironmentService (src/main/python/preponderous/viron/services/environmentService.py), following the entity client (#266) and the grid client (#267). Before this PR, the environment client's only failure test checked that a get_all_environments HTTP error escapes. Eighteen characterization tests are added to src/test/python/preponderous/viron/services/test_environmentService.py; no production code is changed.

What is now pinned:

  • Lookups raise unwrapped on a 404 without reading the body — get_environment_by_id, get_environment_by_name and get_environment_of_entity.
  • create_environment does not wrap its errors. A 400 reaches the caller as HTTPError (body never read) and a ConnectionError as itself.
  • delete_environment raises on a 404 and otherwise returns True without reading the status code. The server answers 204 (@ResponseStatus(HttpStatus.NO_CONTENT)).
  • update_environment_name does not wrap its errors (404, 400, ConnectionError), matching GridService and unlike EntityService.update_entity_name. It returns status_code == 200, so a 204 yields False without raising; EnvironmentController.updateEnvironmentName is a void handler answering 200 today.
  • The bearer token reaches every write (create, delete, rename). Before this PR only get_all_environments was checked.
  • A null body is not guarded. All four reads raise TypeError on a null body, as in the grid client.

Deferred issues

Test plan

  • pytest -q (pytest 9.0.3): 165 passed (147 before, 18 new)
  • python3 -m pytest -q (pytest 7.1.3, Python 3.8): 165 passed
  • CI green on the PR head. The CI workflow's Python jobs run this suite. No Java file is touched.

No tracking issue — gap 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

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

Copy link
Copy Markdown
Member Author

Self-review rubric (performed inline in the same session; not an independent review):

  • Scope: PASS — gh pr diff touches one file, test_environmentService.py; append-only, no production code, no formatting churn.
  • Tests-new: PASS (n/a) — no new public method; every EnvironmentService method now has at least one failure-path test.
  • Tests-fix: n/a — characterization only, no fix to revert.
  • Sibling structure: PASS — functional (module-level) style matches the existing tests in this file; _error_response helper and comments mirror test_gridService.py.
  • Sibling renames: n/a.
  • Docs: PASS — tests only; no row of the Phase 7 table (spec, MVP, PLANNING, REBUILD_PLAN, tickets, README, Postman) describes client error-propagation behaviour.
  • Issue resolution: n/a — no Closes; gap found during triage.
  • CI: PASS — build, python-client (3.8) and python-client (3.12) green on the PR head; locally 165 passed on both pytest 9.0.3 and 7.1.3/py3.8.
  • DTO boundary / Spec alignment / Java-Python parallelism / Override correctness: n/a — no Java or endpoint change.

Findings:

  • src/test/python/preponderous/viron/services/test_environmentService.py — test_delete_environment_returns_true_without_checking_status uses a 200 where the existing test_delete_environment uses 204. Read together the two show the return value does not depend on the status, but the name claims slightly more than a single case proves. Judged acceptable; not changed.
  • Observation, not changed: the environment, grid and location clients raise TypeError on a null body while EntityService maps it to None/[]. The server answers a missing environment 404 rather than a null 200, so this has no practical effect today.

Summary: a test-only PR, green on every CI job, consistent with #266 and #267.

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 b5c90e7 into main Nov 12, 2026
3 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/pin-environment-client-failure-paths branch November 12, 2026 06:24
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