Repository navigation
Description
Summary
lib/src/protocol/kawa_h1's Http session state machine appears to be unreachable in every shipped
binary. If that is right, a substantial module — including its metrics, access-log and status-handling
paths — is dead code, and any hardening done there has no effect on production behaviour.
Raising this as a question rather than a removal proposal, because deleting a protocol implementation
deserves a maintainer decision and there may be a plan for it I cannot see.
Evidence
lib/src/http.rsHttpStateMachinehas exactlyExpect(ExpectProxyProtocol<TcpStream>),
Mux(MuxClear),WebSocket(Pipe<..>). Nokawa_h1::Httpvariant.lib/src/https.rsHttpsStateMachinehasExpect,Handshake,Mux,WebSocket. No
kawa_h1::Httpvariant.grep -rn "Http::new" lib/ bin/ e2e/ command/returns exactly one hit, and it is prose:
lib/src/protocol/kawa_h1/LIFECYCLE.md:62. There is no code caller.- The only remaining mentions of the type in the two session modules are inside
assert_size!lines
(lib/src/http.rs:1892,lib/src/https.rs:3084). save_http_status_metric(lib/src/protocol/kawa_h1/mod.rs:2529) has two production call sites,
:765and:1144— both insideimpl Http, which nothing constructs. Its only other caller is a
unit test at:2653.- The live H1 status-metric path is inline in
lib/src/protocol/mux/stream.rs:352-378
(generate_access_log), which buckets with_ => names::http::STATUS_OTHER.
How it was found
A panic!("PROBEALWAYS ...") was planted at the top of both save_http_status_metric and
kawa_h1::Http::new, then four real proxied HTTP/HTTPS e2e sessions were run against real backends:
0 hits, 4 passed. The same planted binary running the function's own unit test panicked
immediately — a positive control proving the probe fires when the function is entered. So the negative
result is meaningful, not a probe that never armed.
Why it matters
- Hardening there is inert. Work done on
kawa_h1's status assertions, metrics or access-log
paths changes nothing an operator can observe, while looking in review exactly like work that does. - It misleads coverage reasoning. A unit test on
kawa_h1::Httpreads as protocol coverage and
is not. muxandkawa_h1carry parallel implementations of the same status/access-log concerns
(mux/stream.rs:352-378versuskawa_h1/mod.rs:2529), which can drift — and one of them cannot be
exercised.
Questions for maintainers
- Is
kawa_h1::Httpretained deliberately (a planned fallback, an in-progress migration, an
out-of-tree consumer of the library), or is it genuinely residual after themuxmigration? - If residual: should it be removed, or marked
#[deprecated]/ feature-gated so its unreachability
is visible at the call site rather than derivable only by grep? - If retained: it would help to say so in
kawa_h1/LIFECYCLE.md, which currently documentsHttp::new
as though it is a live entry point.
Happy to prepare whichever the maintainers prefer. I have deliberately not touched it.
Activity
refactor(kawa_h1): drop the unreachable Http session state machine