Skip to content

multi-member gzip, stored fallback, zlib on the shared engine#279

Merged
kacy merged 1 commit into
mainfrom
gzip-95
Jul 8, 2026
Merged

multi-member gzip, stored fallback, zlib on the shared engine#279
kacy merged 1 commit into
mainfrom
gzip-95

Conversation

@kacy

@kacy kacy commented Jul 8, 2026

Copy link
Copy Markdown
Owner

summary

the push from ~85% to ~95% gzip completeness, one PR:

  1. multi-member readscat a.gz b.gz decompresses to concatenated payloads, per-member crc32/length verified (inflate now reports stream end positions; trailer length compares mod 2³² for >4gb correctness).
  2. stored-block fallback — fixed huffman gives half the alphabet 9-bit codes, so incompressible data used to expand; deflate now keeps the smaller encoding — 8k of /dev/urandom costs 23 framing bytes instead of ~5% growth.
  3. zlib on the shared engine — real compression + adler32 verification; python's zlib reads pith's output directly.

the bug it exposed

ByteBuffer.write(empty) reported failure — the builtin returns bytes-written and the result convention reads 0 as error. now a no-op in the wrapper.

what was tested

committed two-member fixture; extended interop regression (multi-member, zlib round-trip, shrink assertions); full-range-random fallback verified; full suite green including std in-module tests, all interop checks, fixed point, seed refresh.

three gaps between "works" and "complete", closed together.

multi-member: concatenated gzip streams (cat a.gz b.gz) decompress to
their concatenated payloads with each member's crc32 and length
trailer verified, as gunzip does. inflate now reports where a stream
ends so the reader knows where the next member's header starts, and
the trailer length compares mod 2^32, matching the format's isize
field for payloads past 4gb.

stored fallback: fixed huffman gives half the byte alphabet 9-bit
codes, so truly incompressible data used to expand. deflate now
encodes both ways and keeps the smaller — 8k of /dev/urandom costs
23 bytes of framing instead of ~5% growth.

zlib: routed through the same inflate and deflate engine with the
adler32 trailer verified — real compression instead of stored blocks,
and python's zlib module reads the output directly.

the multi-member work exposed a std bug: ByteBuffer.write of empty
bytes reported failure, because the builtin returns bytes written and
the result convention reads zero as an error. an empty write is now a
no-op in the wrapper. a committed two-member fixture and extended
interop regression pin all of it.
@kacy kacy merged commit 6690b34 into main Jul 8, 2026
2 checks passed
@kacy kacy deleted the gzip-95 branch July 8, 2026 13:46
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