Skip to content

Document compressed payload boundaries and separate length fields - #1193

Open
ac1982 wants to merge 1 commit into
construct:masterfrom
ac1982:docs/compressed-length-fields
Open

ac1982 wants to merge 1 commit into
construct:masterfrom
ac1982:docs/compressed-length-fields

Conversation

@ac1982

@ac1982 ac1982 commented Oct 13, 2026

Copy link
Copy Markdown

The compression documentation does not explain how a separately stored encoded length bounds parsing or how to derive that length when building. In particular, Compressed(Bytes(10), "zlib") consumes the remaining compressed input and then reads ten decompressed bytes; it does not delimit ten bytes on the wire.

This expands the API description and tunneling guide with an executable, symmetric example: parse through FixedSized, build the compressed payload once, measure its stream positions, then use Pointer/Rebuild to fill the earlier length. The example preserves a trailer, supports a nonzero starting offset, and explains the seekable-stream requirement and when to prefer Prefixed. It uses existing constructs without changing their runtime behavior.

Addresses #1123.

Validation: the example's 9 doctests and additional round-trip checks pass on Python 3.8 and 3.12, including changed payloads, empty and incompressible data, nonzero offsets, trailer boundaries, and one compression call per build. The full test suite passes (471 passed, 14 expected failures). Sphinx HTML renders the guide and API cross-reference; strict builds have the same 54 pre-existing warnings on the base and this branch.

AI-assisted documentation and validation.

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