Skip to content

Capture real protocol evidence for aiosendspin's server-initiated-protocol-baseline-v1 - #113

Merged
chrisuthe merged 1 commit into
mainfrom
pr4-aiosendspin-protocol-evidence-tracing
Sep 4, 2026
Merged

Capture real protocol evidence for aiosendspin's server-initiated-protocol-baseline-v1#113
chrisuthe merged 1 commit into
mainfrom
pr4-aiosendspin-protocol-evidence-tracing

Conversation

@chrisuthe

Copy link
Copy Markdown
Member

What

Implements real wire/state evidence capture (CORE-001..004, PLAYER-001) for the \server-initiated-protocol-baseline-v1\ scenario in both aiosendspin adapters, replacing the placeholder scaffolding merged in #109.

Approach (interim, tracked in aiosendspin#111)

aiosendspin has no first-class tracing hook yet, so this uses a fragile-but-honest introspection approach, decided on explicitly with the user:

  • Server side: runs the harness's \SendspinServer\ with \�llow_noncompliant_clients=False\ only for this scenario (all other scenarios keep the permissive default). The server SDK already enforces early-message rejection, role-object gating, and the initial \client/state\ gate internally via \ lag_noncompliance()/\ClientComplianceError\ — a successful connection under strict mode is itself proof CORE-002/003/004 passed, without reimplementing spec validation in the harness. \client.send_message/\send_role_message/\send_binary\ are wrapped (same pattern as the existing PCM scenario code) to observe the negotiated \stream/start\ format and audio chunk timestamps for PLAYER-001. Handshake start/end timestamps are captured bracketing the adapter's own await calls for coarse CORE-001 evidence, plus post-hoc \handshake_hash/\psk_category\ read from the connection.
  • Client side: since \�ttach_websocket()\ blocks until disconnect, the live \SendspinConnection\ is captured while it's still running (not after) so CORE-001 evidence isn't lost. Reuses the client's existing stream/audio-chunk listeners to independently record CORE-002/003/004/PLAYER-001 evidence from the client's own vantage point — required because \protocol_evidence_failure()\ checks both roles' summaries independently.

Verification

  • \python -m compileall src scripts\ passes.
  • Local matrix smoke test (aiosendspin -> aiosendspin): \server-initiated-protocol-baseline-v1\ now passes all 5 protocol assertions; the rest of the existing scenario matrix is unaffected (same pass/fail pattern as baseline, aside from one pre-existing timing-flaky metadata case unrelated to this change).

Follow-ups

  • Replace this introspection approach once aiosendspin exposes first-class tracing hooks (aiosendspin#111).
  • Extend other implementations' adapters to support this scenario in follow-up PRs.

…tocol-baseline-v1

Implement wire-level evidence capture for CORE-001..004 and PLAYER-001
in the aiosendspin server and client adapters, using an interim
monkey-patch/introspection approach since aiosendspin has no
first-class tracing hook yet (tracked upstream in aiosendspin#111).

- New _aiosendspin_protocol_evidence.py holds the shared
  AssertionRecorder/ProtocolEvidenceCollector plus per-assertion
  recording helpers reused by both adapters.
- Server adapter: runs the harness's SendspinServer with
  allow_noncompliant_clients=False only for this scenario, so a
  successful connection is itself proof of CORE-002/003/004's
  early-message/role-gating/client-state-ordering requirements;
  wraps client.send_message/send_role_message/send_binary to observe
  the negotiated stream/start format and audio chunk timestamps for
  PLAYER-001; brackets the client-wait calls to produce coarse
  CORE-001 handshake timestamps.
- Client adapter: captures the live SendspinConnection while
  attach_websocket() is still running (it blocks until disconnect) to
  read post-hoc handshake_hash/psk_category for CORE-001, and reuses
  its existing stream/audio-chunk listeners to independently record
  CORE-002/003/004/PLAYER-001 evidence from the client's own vantage
  point, since protocol_evidence_failure() requires every assertion
  from both roles' summaries.

Smoke-tested locally against aiosendspin -> aiosendspin: the new
scenario now passes all 5 protocol assertions, and the rest of the
existing scenario matrix is unaffected.

Co-authored-by: Copilot <[email protected]>
@chrisuthe
chrisuthe merged commit a8646e7 into main Sep 4, 2026
2 checks passed
@chrisuthe
chrisuthe deleted the pr4-aiosendspin-protocol-evidence-tracing branch September 4, 2026 21:55
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