Skip to content

feat: adopt contree-client~=0.4.0 - #20

Merged
insomnes merged 2 commits into
masterfrom
feature/contree-client-0.4
Sep 3, 2026
Merged

feat: adopt contree-client~=0.4.0#20
insomnes merged 2 commits into
masterfrom
feature/contree-client-0.4

Conversation

@mosquito

@mosquito mosquito commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Bump contree-client to ~=0.4.0 (was >=0.2.1); update uv.lock accordingly.
  • ContreeAPIError was renamed to APIStatusError upstream -- renamed every import/catch site across the CLI (auth.py, cd.py, images.py, operation.py, run.py, docker/kw_from.py, shell/repl.py) and tests.
  • CliClient.retryable_errors/nonretryable_errors were removed upstream (transport failures now normalize uniformly to APIConnectionError); simplified run.py's SIGNAL_ERRORS to (ContreeError, OSError) instead of reaching into backend-specific tuples.
  • error_for_response()'s signature changed from (response) to (status, headers, body) -- fixed the two raw-RequestSpec call sites in ls.py and session.py.
  • SSEStreamError was removed upstream; a mid-stream SSE error now surfaces as a plain ConnectionError carrying a dynamic last_event_id attribute. Updated the one test that constructed the old exception type to match.
  • parse_whoami() no longer raises the status-error hierarchy for a bad HTTP status or a non-dict payload -- both now raise plain ValueError/TypeError. Reclassified auth.py's except clauses so a bad token still logs "Token verification failed" and a malformed body logs "Could not parse ... response" (more accurate than before, since a non-dict payload is genuinely a parsing problem, not a credential one -- one test assertion updated to match).
  • follow_operation_events()'s reconnect loop no longer honors a server's Retry-After; it always backs off with a fixed internal delay. This lives entirely inside the library now, so the CLI test that asserted an exact sleep duration was retargeted to verify only that reconnection still happens.
  • ContreeTestClient.request() (test double in conftest.py) now falls back to the base class's mocked_response() instead of raising NotMockedError, since follow_operation_events issues a raw status-probe request internally that needs to route through the existing get_operation_status mock.

contree-client 0.4 renamed ContreeAPIError to APIStatusError, dropped
CliClient.retryable_errors/nonretryable_errors (transport failures now
normalize to APIConnectionError), changed error_for_response()'s
signature, removed SSEStreamError (mid-stream errors now surface as a
plain ConnectionError carrying last_event_id), and made parse_whoami()
raise plain ValueError/TypeError instead of the status-error hierarchy
for bad status / malformed payloads. Adjust the CLI and test double
accordingly; auth.py's error messages for whoami failures are
reclassified to match what each exception now actually means.
@mosquito
mosquito requested a review from insomnes September 3, 2026 15:09

@insomnes insomnes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@insomnes
insomnes merged commit 3fc9c2f into master Sep 3, 2026
20 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.

2 participants