You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(wire): tighten encoder/decoder against protocol drift and corruption
- ISSUE-59: FilesResponse.encode_body validates per-file content is
8-byte aligned. Upstream C (gateway.c::dumpFile) asserts
``len % 8 == 0`` because SQLite pages are always word-aligned and
per-file entries are written back-to-back without padding. Python-
produced mock frames with non-aligned content would decode under
our permissive decoder but fail under a real C peer. Raise
EncodeError at construction rather than silently producing
malformed bytes.
- ISSUE-60: encode_value for BOOLEAN rejects arbitrary ints. Previous
``1 if value else 0`` coercion silently mapped ``5`` or ``-1`` to
True, making the round-trip lossy (encode(5, BOOLEAN) → wire 1 →
decode → True). Now only ``bool`` or exact 0/1 ints are accepted.
- ISSUE-61: RowsResponse.__post_init__ defensively deep-copies
row_types and rows (outer + inner lists). Prior fix copied only
column_names and column_types. User-supplied row_types / rows
remained aliased: mutating the caller's list would silently mutate
the message's internals.
- ISSUE-63: decode_row_header validates the full 8-byte marker, not
just the first byte. Upstream C uses the full uint64 sentinel
(0xff..ff for DONE, 0xee..ee for PART); Go's permissive "first byte
wins" is tolerant but lets torn/corrupt frames silently truncate
results. We reject non-uniform markers.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments