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
Expand unit test coverage for src/protocols/http2/hpack.cpp (currently 673 lines, existing test hpack_test.cpp is 515 lines — test:source ratio 0.77, the lowest among remaining EPIC #953 candidate files). The existing test exercises happy-path encode/decode round-trips but does not exhaustively cover error paths, integer/string boundary conditions, and dynamic-table eviction pressure.
This is a Step 2 narrow-scoped test expansion under EPIC #953.
Why
HPACK is the binary header compression layer for HTTP/2; bugs here corrupt every request/response on a connection.
EPIC Expand unit test coverage from 40% to 80% #953 baseline (2026-04-13, pre-BUILD_WITH_*) reported 13.5% line coverage on this file. The file has nearly tripled in size since then (244 → 673 lines), so the real branch-coverage gap is larger.
Decoder error paths (Result<T> returns) need verification — a miscoded length prefix or invalid table index must produce a clean error, not undefined behavior.
Where
Source: src/protocols/http2/hpack.cpp
Header: src/internal/protocols/http2/hpack.h
New test: tests/unit/hpack_coverage_test.cpp
CMake registration: tests/CMakeLists.txt via add_network_test(...)
How
Test surface (per public API in hpack.h)
dynamic_table — insert, set_max_size (force eviction), evict_to_size, find (name-only and name+value), clear, entry_count after eviction
hpack_encoder — encode_integer with prefix_bits 1..8 and edge values (0, 2^N - 2, 2^N - 1 triggers continuation, large uint64_t); encode_string huffman vs literal toggle; encode_indexed; encode_literal_with/without_indexing (both string-name and indexed-name overloads); set_max_table_size mid-encode
hpack_decoder — decode_integer truncated input, decode_string truncated input + huffman/literal both, get_indexed_header zero index and out-of-range index, full decode on truncated frames and invalid index references; dynamic table size update inside header block
huffman — encode/decode round-trip across full byte range (0..255 sweep), encoded_size consistency vs encode().size(), decode of intentionally malformed bitstream
Acceptance Criteria
tests/unit/hpack_coverage_test.cpp added and registered in tests/CMakeLists.txt
network_hpack_coverage_test builds and all tests pass on local build
Tests do not require any network I/O or external HTTP/2 peer
Tests use only the public API of the hpack translation unit (no private/friend access)
All tests pass on Ubuntu/macOS/Windows CI when run via release pipeline
No regression in existing network_hpack_test cases
Out of scope
HPACK fuzzing (separate effort, would belong to a fuzz harness, not unit tests)
What
Expand unit test coverage for
src/protocols/http2/hpack.cpp(currently 673 lines, existing testhpack_test.cppis 515 lines — test:source ratio 0.77, the lowest among remaining EPIC #953 candidate files). The existing test exercises happy-path encode/decode round-trips but does not exhaustively cover error paths, integer/string boundary conditions, and dynamic-table eviction pressure.This is a Step 2 narrow-scoped test expansion under EPIC #953.
Why
BUILD_WITH_*) reported 13.5% line coverage on this file. The file has nearly tripled in size since then (244 → 673 lines), so the real branch-coverage gap is larger.Result<T>returns) need verification — a miscoded length prefix or invalid table index must produce a clean error, not undefined behavior.Where
src/protocols/http2/hpack.cppsrc/internal/protocols/http2/hpack.htests/unit/hpack_coverage_test.cpptests/CMakeLists.txtviaadd_network_test(...)How
Test surface (per public API in
hpack.h)dynamic_table—insert,set_max_size(force eviction),evict_to_size,find(name-only and name+value),clear,entry_countafter evictionhpack_encoder—encode_integerwith prefix_bits 1..8 and edge values (0,2^N - 2,2^N - 1triggers continuation, largeuint64_t);encode_stringhuffman vs literal toggle;encode_indexed;encode_literal_with/without_indexing(both string-name and indexed-name overloads);set_max_table_sizemid-encodehpack_decoder—decode_integertruncated input,decode_stringtruncated input + huffman/literal both,get_indexed_headerzero index and out-of-range index, fulldecodeon truncated frames and invalid index references; dynamic table size update inside header blockhuffman—encode/decoderound-trip across full byte range (0..255 sweep),encoded_sizeconsistency vsencode().size(), decode of intentionally malformed bitstreamAcceptance Criteria
tests/unit/hpack_coverage_test.cppadded and registered intests/CMakeLists.txtnetwork_hpack_coverage_testbuilds and all tests pass on local buildhpacktranslation unit (no private/friend access)network_hpack_testcasesOut of scope
Dependencies