Skip to content

test: expand coverage for src/protocols/quic/transport_params.cpp #1021

Description

@kcenon

Part of #953

What

Raise line coverage of src/protocols/quic/transport_params.cpp from 4.2% to >= 70%, and branch coverage to >= 60%.

Current state (pre-Step-1 snapshot, 2026-04-13 measurement from parent epic #953):

  • Lines hit: 12 / 289 (4.2%)
  • File size: 289 LOC

Note: These numbers predate the BUILD_WITH_* workflow fix (#987, #989). A re-measurement on the current develop baseline will be captured in the PR description before merging.

Why

  • QUIC transport parameters implement the wire-level negotiation required by RFC 9000 §18; malformed parameter encoding causes handshake failures that are hard to debug post-deploy.
  • 4.2% line coverage means parameter encode/decode is almost entirely exercised along a single happy path — varint edge cases, unknown parameter IDs, malformed length prefixes, and boundary values (0, max uint62) are unverified.
  • Parameter negotiation bugs are classic interop failures; the test suite is the first defense.

Where

  • Source: src/protocols/quic/transport_params.cpp
  • Headers: include/kcenon/network/protocols/quic/transport_params.hpp (verify exact path)
  • Existing tests to extend: tests/unit/ — check for existing transport_params_test.cpp before adding
  • Companion coverage: pair with existing quic_crypto_test.cpp (test: expand coverage for src/protocols/quic/crypto.cpp #993) for handshake-stage test locality

How

Approach

  1. Identify every kQUIC_* transport parameter ID and value range (RFC 9000 §18.2).
  2. Write parameterized tests covering:
    • Varint encoding: boundary values (0, 63, 64, 16383, 16384, 2^30-1, 2^62-1)
    • Parameter-ID dispatch including unknown-ID handling
    • Length-prefix validation (length mismatches, zero-length, oversized)
    • Round-trip encode→decode symmetry for each parameter
    • Error paths: truncated buffers, trailing garbage, duplicate parameter IDs
  3. Consider fuzz-style randomized round-trip tests if the existing test harness supports them.

Acceptance Criteria

  • src/protocols/quic/transport_params.cpp line coverage >= 70%
  • src/protocols/quic/transport_params.cpp branch coverage >= 60%
  • New or extended tests in tests/unit/
  • All tests pass on Ubuntu/macOS/Windows CI
  • ASAN/TSAN/UBSAN all green on the new tests
  • Current develop baseline re-measured in PR description

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions