feat: asyncio client proof of concept (at_client.aio)#531
Draft
cconstab wants to merge 2 commits into
Draft
Conversation
RFC/proof-of-concept for an asyncio-native client, as a parallel package so the synchronous client is untouched: AsyncAtClient with PKAM auth, encrypted notify, and a monitor exposed as an async iterator with a cancellable heartbeat task, bounded reads, automatic reconnect and a seedable resume position. Only the connection layer is new (~330 lines); crypto, key handling and verb builders are reused from the existing package (they do no I/O). The structure makes the thread-lifecycle and wedged-read failure modes of the sync monitor unrepresentable: the heartbeat is a cancellable Task, reads are bounded by asyncio.wait_for, and cancelling the consumer tears everything down. Network-free tests in test/aio_client_test.py (monitor line parsing, decrypt round-trip with ivNonce and legacy zero IV, response framing). Verified live against the ephemeral environment interoperating with the released 0.2.70 sync client: sync->async decrypt, async->sync notify with first-contact shared-key creation, resume-from-epoch with no backlog replay, and clean cancellation. Runnable example in examples/aio_demo.py.
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.
Draft / RFC — a working artifact for the "redo notifications/monitor with asyncio and streams" discussion, not a merge request as-is.
What this is
A parallel
at_client.aiopackage (the httpx/redis-py pattern — the synchronous client is untouched, zero risk to existing consumers):Only the connection layer is new (~330 lines:
connection.py+atclient.py); crypto, key handling and verb builders are reused from the existing package — they do no I/O.Why asyncio pays here
The sync monitor's recent bug classes become unrepresentable by construction:
asyncio.wait_for, so a silently dead socket cannot wedge the streamepochMillisVerified
test/aio_client_test.py, network-free, in CI): monitor line parsing (incl. prompt remnants), decrypt round-trip withivNonceand legacy zero-IV, response framing parity with the sync rules.Runnable example:
examples/aio_demo.py.Deliberately NOT in the PoC
get/put/delete/scanasync twins, reconnect backoff ladder (Dart-styleconnectDelays), first-contact decrypt retry on the receive side, persisted resume position, docs. All straightforward follow-ups once the shape is agreed.Open design questions for maintainers
at_client.aiovsat_client.asynciovs a separate distribution?AtNotificationdataclass as the public stream type — happy with the field set?lastreceivednotificationin the local keystore) or leave persistence to callers, as here?