gabriel / musehub public
feat patch task/wire-frame-server #1 / 1
AI Agent gabriel · 154 days ago · Apr 22, 2026 · Diff

feat: server-side wire frame parsing and ASGI streaming fix

- Add iter_wire_frames async generator to musehub_wire.py for parsing explicit binary-enveloped frames (magic b'muse', version 0x01) - Add _Asgi24Wrapper in conftest.py to inject spec_version='2.4' into ASGI scope, fixing Starlette StreamingResponse deadlock with httpx (Wall 7: listen_for_disconnect race with _AsyncExactReader) - Update T9 tests to wrap MPackStreamWriter output with MuseWireFrameWriter and fix hash computation bug (raw_bytes must match OID input) - Add test_wire_framing.py with 16 wire frame codec tests (roundtrip, hash mismatch, size mismatch, envelope/logical type mismatch, Wall-5 regression)

sha256:e9f581dc32e6d316501ffe47768343449c378f24747fa18aad289e660e2b111e sha
+49 ~13 symbols
sha256:e867ad2a0e0267eedd0e8197852d5147239c42abac44c140ed5c3bd71c32ed00 snapshot
+49
symbols added
~13
symbols modified
0
dead code introduced
Semantic Changes 62 symbols
~ tests/test_wire_framing.py .py 32 symbols added
+ TestEmptyStream class class TestEmptyStream L141–156
+ test_empty_body_yields_nothing method async_method test_empty_body_yields_nothing L145–149
+ test_empty_chunk_yields_nothing method async_method test_empty_chunk_yields_nothing L152–156
+ TestHashMismatch class class TestHashMismatch L258–272
+ test_tampered_payload_raises method async_method test_tampered_payload_raises L262–272
+ TestRoundtrip class class TestRoundtrip L57–134
+ test_frames_split_across_chunks method async_method test_frames_split_across_chunks L98–111
+ test_header_id_verified method async_method test_header_id_verified L126–134
+ test_import method async_method test_import L61–62
+ test_multiple_frames_in_sequence method async_method test_multiple_frames_in_sequence L78–95
+ test_payload_parses_as_msgpack method async_method test_payload_parses_as_msgpack L114–123
+ test_single_header_frame method async_method test_single_header_frame L65–75
+ TestSizeMismatch class class TestSizeMismatch L279–302
+ test_size_mismatch_raises method async_method test_size_mismatch_raises L283–302
+ TestTruncatedHeader class class TestTruncatedHeader L163–215
+ test_invalid_magic_raises method async_method test_invalid_magic_raises L192–202
+ test_truncated_at_version_byte method async_method test_truncated_at_version_byte L167–176
+ test_truncated_mid_header_bytes method async_method test_truncated_mid_header_bytes L179–189
+ test_wrong_version_raises method async_method test_wrong_version_raises L205–215
+ TestTruncatedPayload class class TestTruncatedPayload L222–251
+ test_truncated_payload_raises method async_method test_truncated_payload_raises L226–236
+ test_truncation_raises_wire_error_not_msgpack_error method async_method test_truncation_raises_wire_error_not_msgpack_error L239–251
+ _body function async_function _body L41–43
+ _collect function async_function _collect L46–50
+ _make_frame function function _make_frame L35–38
+ _pack function function _pack L31–32
+ _sha256_oid function function _sha256_oid L27–28
+ annotations import import annotations L14–14
+ hashlib import import hashlib L16–16
+ msgpack import import msgpack L19–19
+ pytest import import pytest L20–20
+ struct import import struct L17–17
~ musehub/services/musehub_wire.py .py 7 symbols added, 1 symbol modified
+ _AsyncExactReader class class _AsyncExactReader L2000–2036
+ __init__ method method __init__ L2003–2005
+ _fill method async_method _fill L2007–2014
+ read_exact method async_method read_exact L2029–2036
+ read_exact_or_eof method async_method read_exact_or_eof L2016–2027
+ _struct import import _struct L1997–1997
+ iter_wire_frames function async_function iter_wire_frames L2039–2107
~ tests/conftest.py .py 4 symbols added, 1 symbol modified
+ _Asgi24Wrapper class class _Asgi24Wrapper L271–290
+ __call__ method async_method __call__ L287–290
+ __init__ method method __init__ L284–285
+ typing import import typing L8–8
~ client
~ tests/test_wire_push_stream.py .py 3 symbols added, 8 symbols modified
+ _fw variable variable _fw L49–49
+ _wrap function function _wrap L61–63
+ MuseWireFrameWriter import import MuseWireFrameWriter L46–46
~ _pack
~ tests/test_wire_streaming_push.py .py 3 symbols added, 3 symbols modified
+ _fw variable variable _fw L38–38
+ _wrap function function _wrap L49–50
+ MuseWireFrameWriter import import MuseWireFrameWriter L35–35
← Older Oldest on task/wire-frame-server
All commits
Newer → Latest on task/wire-frame-server

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:e9f581dc32e6d316501ffe47768343449c378f24747fa18aad289e660e2b111e --body "your comment"