Skip to content

test(http2/hpack): expand coverage for hpack.cpp#1044

Merged
kcenon merged 2 commits into
developfrom
test/issue-1031-expand-hpack-coverage
Apr 25, 2026
Merged

test(http2/hpack): expand coverage for hpack.cpp#1044
kcenon merged 2 commits into
developfrom
test/issue-1031-expand-hpack-coverage

Conversation

@kcenon

@kcenon kcenon commented Apr 25, 2026

Copy link
Copy Markdown
Owner

Closes #1031

What

Adds tests/unit/hpack_extra_coverage_test.cpp and registers it as
network_hpack_extra_coverage_test to push line coverage of
src/protocols/http2/hpack.cpp past the 70% / branch coverage past the
60% bar required by Issue #1031 acceptance criteria.

The new suite complements the prior two:

Why

src/protocols/http2/hpack.cpp was identified by the #953 audit as one
of the lowest-coverage files in the network_system source tree. Closing
the remaining gaps directly contributes to the #953 ecosystem-wide
80% line / 70% branch goal.

Where

  • tests/unit/hpack_extra_coverage_test.cpp — new test file
  • tests/CMakeLists.txt — register network_hpack_extra_coverage_test
  • CHANGELOG.md, docs/CHANGELOG.md — Tests / Added entries

How

The new tests close the following residual gaps:

Area Test
Static-table boundary index 61 (www-authenticate), large-index nullopt, name-only ordering for duplicate-name rows, mismatched-value fall-through
http_header invariants reflexive equality, name-mismatch and value-mismatch break equality
Dynamic table get past entry_count returns nullopt, growing max_size does not evict, shrinking max_size below one entry evicts all, full-match preferred over name-only
Encoder static-table-name + non-static-value forces literal-with-indexing-named (:method PATCH, :authority with value), empty-value brand-new header takes new-name path
Decoder happy paths literal-without-indexing (0x00) new-name and indexed-name forms, never-indexed (0x10) new-name, multi-header blocks
Decoder integers multi-byte length encoding (length 130) staying under the 64-bit overflow threshold
Huffman stub encoded_size matches input size, encode/decode byte-for-byte round-trip
Encoder/decoder pair static-only emissions leave decoder dynamic table empty; mixed static/dynamic round-trips converge
Decoder edge empty payload returns ok with empty headers

Each decoder test builds wire bytes by hand against RFC 7541 §6 so the
unit under test is the decoder itself, not an encoder upstream of it.

Test Plan

  • CI runs the new network_hpack_extra_coverage_test target along with
    the other unit tests.
  • After merge, the next coverage workflow run on develop (under
    BUILD_WITH_* flags + lcov --rc lcov_branch_coverage=1) will
    re-measure src/protocols/http2/hpack.cpp against the 70% line /
    60% branch targets.
  • No source changes; behavior is unchanged.

Notes

  • Local build was skipped because cmake/ninja/make are unavailable in
    this sandbox; the project policy is that CI does not run on develop-
    target PRs (workflow/branching-strategy.md), so the coverage
    measurement runs on develop after merge.
  • No hpack.cpp source modifications — purely additive test work.

kcenon added 2 commits April 26, 2026 08:03
Adds tests/unit/hpack_extra_coverage_test.cpp closing remaining gaps after
hpack_test.cpp and hpack_coverage_test.cpp:

- Static table boundary entries (index 61, name-only lookup ordering,
  mismatched-value fall-through)
- Dynamic table get() past entry_count, growing max_size without eviction,
  full-match preference over name-only match
- Encoder static-name-mismatched-value path forcing literal-with-indexing
  via static name reference
- Decoder happy paths for literal-without-indexing (0x00) new-name and
  indexed-name forms, never-indexed (0x10) prefix, and multi-header blocks
- Multi-byte integer decoding under the 64-bit overflow threshold
- Huffman stub encoded_size and byte-for-byte round-trip contract lock
- Encoder/decoder pair convergence for static-only emissions and mixed
  static/dynamic flows

Each decoder-path test builds wire bytes by hand against RFC 7541 §6 so
the decoder is the unit under test, not the encoder upstream of it.
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Metric Value
Line Coverage 66.4%
Branch Coverage 32.8%
Target 80% lines / 70% branches
Coverage Details

Full HTML report is available as a build artifact.

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