Skip to content

Strengthen integer decoding properties - #297

Open
ryanduguid wants to merge 1 commit into
python-hyper:masterfrom
ryanduguid:test-integer-decoding-properties
Open

ryanduguid wants to merge 1 commit into
python-hyper:masterfrom
ryanduguid:test-integer-decoding-properties

Conversation

@ryanduguid

Copy link
Copy Markdown

Summary

Strengthen the integer codec properties to check exact byte consumption, prefix flags and arbitrary trailing data for both bytes and memoryview. Add a property requiring every incomplete prefix of a multibyte representation to raise HPACKDecodingError.

decode_integer(encoded_with_flags + suffix, prefix_bits)
    == (integer, len(encoded))

Evidence

  • The unchanged Python 3.14 baseline passes 502 tests on Linux and Windows. The revised suite passes 504 tests with 100% branch coverage on Linux Python 3.11.17, 3.12.14, 3.13.16 and 3.14.8, and Windows 3.14.8.
  • tox -e py311,py312,py313,py314,lint,docs,packaging exits successfully, including Ruff, mypy, manifest checks, wheel/source builds and Twine checks. Sphinx reports the same existing undefined our github page target at docs/source/installation.rst:10 in both baseline and candidate builds. The test runs retain existing Hypothesis initialisation warnings.
  • Three controlled decoder faults each pass all 15 original integer tests and fail a new property: retaining prefix flags, counting trailing bytes as consumed, and accepting an incomplete continuation. The controls run on Linux and Windows. All 17 revised integer tests also pass Linux seeds 17, 466 and 20261008.

Merge danger

Door: two-way. Blast radius: tests. The change uses the existing Hypothesis strategies in one test file, with no runtime or dependency changes.

Unverified

Hosted CI and Codecov uploads, macOS, and Windows Python 3.11 through 3.13 have not been verified.

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