fix: migrate aiosendspin adapters to Noise identity/pairing SDK API - #110
Closed
chrisuthe wants to merge 2 commits into
Closed
fix: migrate aiosendspin adapters to Noise identity/pairing SDK API#110chrisuthe wants to merge 2 commits into
chrisuthe wants to merge 2 commits into
Conversation
Introduce a protocol-evidence-based verification mode for conformance scenarios so we can assert on Sendspin protocol compliance (hello negotiation, role capability advertisement, stream setup handshake, etc.) rather than only on rendered audio/media correctness. - src/conformance/protocol.py: defines protocol assertion IDs and protocol_evidence_failure() to check adapter summaries against them. - src/conformance/models.py: ScenarioSpec gains verification_mode support for 'protocol' and a protocol_assertions field. - src/conformance/scenarios.py: registers the new baseline protocol scenario. - src/conformance/runner.py: wires the 'protocol' verification_mode into _compare_summaries(). - README.md / adapters/README.md: document the protocol-evidence contract adapters must uphold. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The aiosendspin SDK now requires a static X25519 Identity plus a pairing store of pre-established long-term PSK records instead of the old server_id=/client_id= constructor kwargs. Since conformance cases launch server and client as independent OS processes with no out-of-band pairing channel, add a shared helper that derives a deterministic (not cryptographically meaningful) Identity/PSK pair from the CLI-shared server_id/client_id so both sides agree on a pre-paired credential. - src/conformance/adapters/_aiosendspin_pairing.py (new): shared identity/pairing_store derivation for both adapter roles. - aiosendspin_server.py: build identity/pairing_store via the new helper, add --client-id CLI arg, fix negotiated_role_ids rename, bound server.close() with a timeout since aiohttp's AppRunner cleanup can block up to its 60s keep-alive shutdown_timeout in client-initiated scenarios even though the case summary was already written successfully. - aiosendspin_client.py: build identity/pairing_store via the new helper, replace the removed add_server_hello_listener callback with reading client.server_info directly for the peer_hello summary field. - runner.py: pass client_id to the server role's CLI args so it can build the expected client's pairing record. Verified server-initiated-flac/pcm/metadata/controller/artwork and client-initiated-pcm all pass end-to-end via run_case(). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
Author
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.
Depends on #109
This PR is stacked on #109 (protocol-evidence verification foundation) and includes its commit in the diff until that one merges. Please review/merge #109 first; the diff here will shrink to just this PR'"'"'s changes once it does.
Why
The
aiosendspinSDK dependency introduced a breaking change: it now requires a static X25519Identityplus a pairing store of pre-established long-term PSK records, instead of the oldserver_id=/client_id=constructor kwargs. Without this fix, every aiosendspin-involving conformance case fails at connection time.What
src/conformance/adapters/_aiosendspin_pairing.py(new): since conformance cases launch server and client as independent OS processes with no out-of-band pairing channel, this shared helper derives a deterministic (not cryptographically meaningful — documented in the module)Identity/PSK pair from the CLI-sharedserver_id/client_idso both sides agree on a pre-paired credential without a real pairing exchange.aiosendspin_server.py:identity/pairing_storevia the new helper; adds--client-idCLI arg.negotiated_roles→negotiated_role_idsSDK rename.server.close()with a 5s timeout. Root cause: aiohttp'"'"'sAppRunner.cleanup()can block up to its 60s keep-aliveshutdown_timeoutfor inbound (server-hosted) WebSocket connections — this only manifests in client-initiated scenarios, where the server holds the inbound socket. The case'"'"'s summary JSON has already been written successfully by that point, so a slow/timed-out close no longer fails the case.aiosendspin_client.py: buildsidentity/pairing_storevia the same helper; replaces the removedadd_server_hello_listenercallback with readingclient.server_infodirectly for thepeer_hellosummary field.runner.py: passesclient_idto the server role'"'"'s CLI args so it can build the expected client'"'"'s pairing record.Testing
python -m compileall src scriptsrun_case()smoke tests (default 40s timeout):server-initiated-flac,server-initiated-pcm,server-initiated-metadata,server-initiated-controller,server-initiated-artwork, andclient-initiated-pcm(previously hanging until the harness timeout due to theAppRunner.cleanup()issue above) all pass end-to-end, withclient-initiated-pcmnow completing in ~13s.