Repository navigation
Type every Proxmox response, check the tree with ty, release 3.0.0 - #17
Merged
MorningLightMountain713 merged 1 commit intoOct 23, 2026
Merged
Conversation
ApiResponse[T] is ApiSuccess[T] | ApiFailure. A success always carries its payload, validated with Pydantic against the endpoint's shape; a failure carries status, error and timed_out, and `if not res:` narrows to it. An answer missing a field arcane-mage relies on is a failure naming that field, so no caller reads a null or partial payload as data. Fields the shapes do not name are kept, which the Ansible status module returns as Proxmox sent them. Reading the payloads typed exposed four faults, fixed here: the TUI accepted a hypervisor whose connection timed out, `ping` could never report a rejected token, discovery counted a node whose VMs could not be listed as running none, and download_iso sent a Python bool for verify-certificates. ty checks src, tests and the Ansible collection, which needs ansible-core (its own dependency group) and pyrage-stubs. aioresponses is dropped: it cannot build a response under the current aiohttp, and the response tests run against aiohttp's own test server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Stacked on #16, which sets up the tooling and contributing guide this builds on.
Summary
ApiResponse[T]isApiSuccess[T] | ApiFailure.ApiSuccessalways carries itspayload, typed per endpoint. For example,get_vmsreturnsApiResponse[list[VmSummary]].ApiFailurecarriesstatus,errorandtimed_out.if not res:narrows toApiFailure, so past that checkres.payloadhas the endpoint's type with no further checks:Every answer is validated at the boundary.
datais validated with Pydantic against aTypedDictshape:VmSummary,NetworkIface,NodeStorage,StorageVolume,NodeVersion,TaskStatus,HypervisorNodeandStorageConfig, all exported.data: nullwhere a value is due, becomes anApiFailurenaming the field (Unexpected response at 0.iface: Field required).statusmodule still returns the full VM records.Faults the typing exposed, fixed here:
arcane-mage pingcould never report "Authentication failed"; the check was unreachable.download_isosent a Python bool forverify-certificates. It now sends0/1, and the Ansibleiso_infomodule uses it instead of posting to a private method.ty is clean across
src,testsand the Ansible collection.ansible-coreis in its ownansibledependency group, synced by default; the collection only needs it for type checking.pyrage-stubsis added.aioresponsesis removed: it can't build a response under the current aiohttp, and nothing used it. The new response tests run against aiohttp's own test server.CONTRIBUTING.mdnow requiresuv run ty check.Breaking
Released as 3.0.0. Code that only reads responses (
if not res, then.payload,.status,.error) keeps working. Code that constructsApiResponse(...)now constructsApiSuccess(payload=...)orApiFailure(...). Open PRs #12 and #15 touchproxmox.pyandprovisioner.py, so they will need a rebase.Checks
uv run ruff check/ruff format --check: cleanuv run ty check: cleanuv run pytest: 229 passeduv build: 3.0.0 wheel built;arcane-mage --helpruns🤖 Generated with Claude Code