Skip to content

mux-h2: the TLS close-notify path has no coverage at all — mutating it to a no-op leaves 1107 lib and 447 e2e tests green #1498

Closed

Description

@FlorentinDUBOIS

Mutating ConnectionH2's TLS close-notify seam to a no-op leaves the entire suite green — 1107 sozu-lib and 447 sozu-e2e, zero failures. Nothing exercises the path.

Measured

While extracting the socket boundary (#1339), each of three new TLS seams was mutated to prove the extraction was covered:

mutation sozu-lib
tls_wants_write() -> false 1097 passed; 10 failed
flush_tls_records() no-op 1103 passed; 4 failed
begin_tls_close() -> {} 1107 passed; 0 failed

The third was then run against e2e as well: 447 passed; 0 failed. So this is not a unit-test hole with e2e cover behind it — it is a total gap.

The path is live in production

ConnectionH2::initiate_close_notify is reached from Mux::shutting_down (mod.rs, via self.frontend.initiate_close_notify()), and Connection::initiate_close_notify forwards to it. The H1 side has its own at h1.rs, reached from its own shutdown path and guarded by two debug_assert!s. The H2 side has neither a driver in any test nor those assertions running.

What it does matters: a TLS close_notify is the difference between an orderly shutdown and a truncated stream from the peer's point of view. A regression here is invisible locally and shows up as a peer-side protocol error.

Independently corroborated

#1484's coverage audit listed the same site as uncovered, from the other direction — it enumerated initiate_close_notify among the socket_wants_write branches its six new ConnectionH2<FrontRustls> tests could not reach, with the reason "needs a driven TLS close_notify; not on the write path".

Two independent measurements, one by mutation and one by probe, agree.

What a test needs

A driven close_notify: a real FrontRustls frontend, a shutdown reaching Mux::shutting_down, and an assertion on the bytes the peer receives — a TLS close-notify alert, not merely a FIN. The existing BackpressuredTlsSocket harness from #1484 and #1491 is the closest starting point; it already scripts writes and can observe what reaches the socket.

The H1 side's two debug_assert!s (initiate_close_notify past the guard must be server-side, close_notify_sent must be set once initiate_close_notify has run) are the invariants worth mirroring — they exist on H1 and fire in every debug build there, while the H2 path has no equivalent and no test to run one.

Not fixed in #1339

#1339's step one deliberately does not close this. It extracted the seam and recorded the gap; closing it needs a driven close_notify and its own test, which is a different piece of work from the boundary extraction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions