Skip to content

kawa_h1: is the Http session state machine still reachable in any binary? #1346

Closed

Description

@FlorentinDUBOIS

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.rs HttpStateMachine has exactly Expect(ExpectProxyProtocol<TcpStream>),
    Mux(MuxClear), WebSocket(Pipe<..>). No kawa_h1::Http variant.
  • lib/src/https.rs HttpsStateMachine has Expect, Handshake, Mux, WebSocket. No
    kawa_h1::Http variant.
  • 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,
    :765 and :1144 — both inside impl 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

  1. 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.
  2. It misleads coverage reasoning. A unit test on kawa_h1::Http reads as protocol coverage and
    is not.
  3. mux and kawa_h1 carry parallel implementations of the same status/access-log concerns
    (mux/stream.rs:352-378 versus kawa_h1/mod.rs:2529), which can drift — and one of them cannot be
    exercised.

Questions for maintainers

  • Is kawa_h1::Http retained deliberately (a planned fallback, an in-progress migration, an
    out-of-tree consumer of the library), or is it genuinely residual after the mux migration?
  • 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 documents Http::new
    as though it is a live entry point.

Happy to prepare whichever the maintainers prefer. I have deliberately not touched it.

Activity

  1. added a commit that references this issue on Sep 20, 2026
    af6a2f5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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