Repository navigation
refactor(kawa_h1): remove the unreachable Http session state machine - #1370
Merged
Merged
Conversation
FlorentinDUBOIS
requested review from
Wonshtrum and
llenotre
as code owners
September 20, 2026 11:43
`kawa_h1::Http<Front, L>` was constructible by nothing. `HttpStateMachine`
(`lib/src/http.rs`) is `Expect | Mux | WebSocket` and `HttpsStateMachine`
(`lib/src/https.rs`) is `Expect | Handshake | Mux | WebSocket`; neither holds
one, and `Http::new` had zero code callers under either module spelling —
`lib/src/protocol/mod.rs` re-exports `kawa_h1 as http`, so a grep on one
spelling undercounts. Measured, not inferred: a planted
`panic!("PROBEALWAYS ...")` at the top of `Http::new` and
`save_http_status_metric` fired 0 times across four real proxied e2e sessions
while the same binary panicked immediately under the function's own unit test.
H1 has run through `protocol/mux` in H1 mode since the mux migration.
Removed with it, because nothing else reached them: the `SessionState` impl,
`TimeoutStatus`, `ResponseStream`, `save_http_status_metric`, this module's
`handle_connection_result` (`tcp.rs` keeps its own), the module-local
`log_context!` macro and with it the `KAWA-H1` log tag, and the whole
`kawa_h1::diagnostics` module — the mux fills the parse-detail answer fields
with neutral placeholders, so its hex-dump renderer had no live consumer. The
two commented-out `size_test` blocks in `http.rs` / `https.rs` that
`assert_size!`d `Http<..>` go too.
BREAKING for `sozu-lib` consumers, not for operators: nothing on the wire, no
metric, log line, configuration key or CLI flag changes, but
`sozu_lib::protocol::Http`, `::protocol::http::Http`,
`::protocol::kawa_h1::{Http, TimeoutStatus, ResponseStream}` and
`::protocol::kawa_h1::diagnostics::*` no longer exist. There is no migration
target; the type implemented a session state machine no binary instantiated.
Closes #1346. Closes #1347 by obsolescence: the frontend timeout consumed
without re-arming lived inside this `impl`, so there is no code left to redden
and it gets no regression test. The mux already re-arms explicitly on the live
path.
Exactly one test was orphaned and it was ported, not deleted:
`kawa_h1::tests::a_backend_status_line_below_100_is_bucketed_not_asserted`
becomes
`mux::stream::tests::a_backend_status_line_below_100_is_bucketed_not_asserted`,
guarding the live `Stream::generate_access_log` bucketer, which had no such
assertion. Seen red by planting the forbidden
`debug_assert!((100..=999).contains(&status))` in its bucket arm.
`answers.rs` was assessed item by item: nothing in it became dead.
`HttpAnswers`, `DefaultAnswerStream`, `merge_legacy_into_map`, `HttpContext`,
`HeaderEditMode`, `HeaderEditSnapshot`, `Method`, `hostname_and_port`, the
`DefaultAnswer` enum and the crate's only `impl kawa::AsBuffer for Checkout`
all stay.
`lib/src/protocol/kawa_h1/LIFECYCLE.md` is rewritten from "H1 session
lifecycle" to "the H1 vocabulary the mux builds on", with its citations
refreshed. `doc/lifetime_of_a_session.md`, `doc/testing.md`,
`doc/observability.md`, `doc/configure.md`, `doc/benchmark.md`,
`e2e/COVERAGE.md`, `lib/README.md`,
`lib/src/protocol/proxy_protocol/LIFECYCLE.md`, `CLAUDE.md` and `CHANGELOG.md`
are updated in the same changeset.
lib/src: 87 973 -> 85 415 lines of Rust (2 712 removed, 154 added).
Signed-off-by: Florentin Dubois <[email protected]>
FlorentinDUBOIS
force-pushed
the
refactor/drop-kawa-h1-http
branch
from
September 20, 2026 12:13
c64bceb to
af6a2f5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1346 and closes #1347.
The
muxmigration replacedkawa_h1'sHttpsession state machine, and it has been unreachable since.This removes it: −2,564 lines of
lib/srcRust (87,973 → 85,409),kawa_h1/mod.rs2,655 → 129.Reachability — the proof, since a deletion cannot be regression-tested
protocol/mod.rsre-exportskawa_h1ashttp, so consumers appear under both spellings and a grepon one undercounts. Swept both, repo-wide, no file-type filter, including
fuzz/,sim/,lib/benches/:Http::new, whose sole struct literal wasOk(Http { … }). Repo-widecall sites in code: zero. Three hits, all prose.
HttpStateMachine=Expect | Mux(MuxClear) | WebSocket;HttpsStateMachine=Expect | Handshake | Mux(MuxTls) | WebSocket;TcpStateMachineis TCP-only.kawa_h1/, the only compiled references were thepub use … http::Httpand twocommented-out
assert_size!lines. kawa_h1: is the Http session state machine still reachable in any binary? #1346 cites those as live references; they are inside/* */and were never compiled. They are removed too.
This is a breaking change for library consumers
lib/src/lib.rspub mod protocol;pluspub struct Httpplus the re-export madesozu_lib::protocol::Http,::protocol::http::Httpand::protocol::kawa_h1::Httpall reachable, withHttp::newpublic.sozu-lib2.2.1 is published. So a downstream crate could construct it even thoughno binary did.
Recorded under a new
### ➖ Removedwith aBREAKING (library API)marker naming every removed path andstating there is no migration target.
RELEASE.mdcontains no semver policy (zero hits forsemver/major/breaking); the only precedent is the
1.1.x → 2.0.0section and inlineBREAKING —markers. The version-number call is left to a maintainer.
What went, and what stayed
Removed as transitively dead: both inherent
impls andSessionState for Http,TimeoutStatus,ResponseStream,save_http_status_metric, kawa_h1'shandle_connection_result(tcp.rskeeps its owncopy), the module-local
log_context!macro — and with it theKAWA-H1log tag, now emitted by nothing —and the whole
diagnosticsmodule (mux fills parse-detail answer fields with neutral placeholders, so thehex-dump renderer had no live consumer).
Kept:
type GenericHttpStream,impl kawa::AsBuffer for Checkout(orphan rule — mux'skawa::Kawa<Checkout>depends on this single impl),DefaultAnswerand itsu16mapping, and all ofeditor.rs/parser.rs/answers.rs.answers.rs(1,963 lines) lost nothing. Assessed item by item:HttpAnswers::gethas two callers andmux keeps it;
DefaultAnswerStream/SharedBufferlive viamux/answers.rs;legacy_to_maplives viamerge_legacy_into_map. (render_inline_301has zero callers but was already dead before this change —a deliberate back-compat wrapper — and is left alone as unrelated.)
The one orphaned test was ported, not deleted
a_backend_status_line_below_100_is_bucketed_not_assertedguarded sozu#1279: a backend status lineoutside
100..=999, reaching the bucketer through the real kawa parser, must land inhttp.status.otherand never trip a range
debug_assert!that would panic the worker on network input in everydebug/test/e2e/fuzz build.
The live
mux::stream::generate_access_loghas the identical_ => STATUS_OTHERcatch-all but had noassertion on it. Deleting the test would have silently removed the only coverage of a live NO-PANIC
guarantee. It now lives at
protocol::mux::stream::tests, with an in-file note on where it came from.Proven red by planting the very assertion it exists to prevent:
#[test]count inlib/src899 → 897 (−1 real, −2 inside/* */, +1 ported);cargo test -p sozu-lib --lib863 → 863.#1347 closes by obsolescence, not by a fix
#1347 — a frontend timeout consumed without re-arming, leaving a session to the 30-minute
zombie_check—lives at
kawa_h1/mod.rs:2388, insideimpl Http. After this change there is no code to redden, so itgets no regression test. The compiling, green removal is the stronger proof.
One non-obvious break
editor.rsresolvedMethodthroughcrate::protocol::http::Method, a privateusebinding inkawa_h1/mod.rsvisible to the child module. Deleting the imports broke it (E0432, cascading to E0282 inmux/router.rs). Repointed toparser::{Method, compare_no_case}.Docs
kawa_h1/LIFECYCLE.mdis rewritten wholesale — its old §1, §2 and §5 described only deleted code.doc/lifetime_of_a_session.md§6.1 rewritten to the mux path;doc/observability.mddrops theKAWA-H1row;
doc/benchmark.md's pre-mux profiler paste is kept verbatim with a note, because it is recordedoutput rather than prose. Also
doc/testing.md,doc/configure.md,e2e/COVERAGE.md,lib/README.md,proxy_protocol/LIFECYCLE.md,CLAUDE.md,CHANGELOG.md.Validation
BUILD=0 CLIPPY=0 TEST=0 FMT=0;-p sozu-lib --lib863 passed,-p sozu-command-lib153,-p sozu97,plus
log_layoutandmetric_names.