Repository navigation
Description
#1425 extracted the GOAWAY/drain state machine from lib/src/protocol/mux/h2.rs into lib/src/protocol/mux/h2_drain.rs and made H2DrainState's five fields private. h2.rs now reaches them only through methods. Three places outside the file that #1432 swept still describe the old shape, and one of them is wrong rather than merely loose.
All three verified against 95dee167.
1. LIFECYCLE.md:1004-1006 attributes an assignment to the wrong site
The forced-close deadline is armed the first time `graceful_goaway`
(`h2.rs`) transitions `drain.draining` to `true`: that site sets
`drain.started_at = Some(now)` from the caller's snapshot
That site cannot set it. graceful_goaway is at h2.rs:4219 and its body delegates:
let reassembly_in_progress = self.header_block_reassembly_in_progress();
match self.drain.begin_graceful_drain(now, reassembly_in_progress) {self.started_at = Some(now) is at h2_drain.rs:239, behind a debug_assert!(self.started_at.is_none(), "begin_graceful_drain must arm started_at exactly once, on the first call").
The effect the sentence describes is real; the attribution is false. In a document whose whole purpose is saying which site does what, that is the part that matters. The debug_assert is also a fact worth having in the narrative — "exactly once, on the first call" is the invariant the prose is groping at.
LIFECYCLE.md:777 and :992 narrate drain.started_at and drain.started_at + drain.graceful_shutdown_deadline directly. Those are looser rather than false — they describe internal state without claiming a reachable access path — so repoint them only if it reads better; they are not the reason for this issue.
2. lib/src/protocol/mux/h2.rs:1625 — a stale comment in production source
// RFC 9113 §6.8: after sending a GOAWAY, the proxy
// MUST NOT accept new streams.
// `graceful_goaway` sets `drain.draining = true`
// and sends an initial GOAWAY with last_stream_id =
// STREAM_ID_MAX (so in-flight requests are still
// accepted), but the contract for *new* peer-
// initiated streams is that they must be refused.graceful_goaway no longer sets that field; drain.draining is private and the transition happens inside begin_graceful_drain. The RFC reasoning around it is correct and should survive — only the mechanism sentence is stale.
3. doc/h2_mux_internals.md:202 cites a function that has never existed
The GOAWAY-processing step cites close_all_streams. git grep close_all_streams 95dee167 -- lib/ returns nothing, and it was equally absent at 595920e9, so this predates #1425 and is not extraction fallout. The nearest real thing is ConnectionH2::goaway (h2.rs:4145), but confirm that against the surrounding prose before substituting it — the step may describe something else and deserve a different target, or no citation at all.
check_doc_citations.py's rule 3 validates test names only, so a cited non-test function that does not exist passes every gate in the repository.
Why these three together
Each is a sentence beside correct code that the citation gate cannot see:
- The drift rule compares a cited line at two revisions. A document that does not modify
h2.rshas identical cited text at base and head, so the rule passes trivially — this is how five sentences indoc/h2_mux_internals.mdsurvived refactor(mux-h2): extract the GOAWAY/drain state machine, and write the invariant its bug class never had #1425 while false, caught only by a manual sweep. - Rule 3 resolves test names, never production function names.
- A code comment is inside no rule at all.
So none of these will be caught by anything; they have to be read. That argues for fixing them now rather than filing them and moving on.
Asked for
Fix all three. For item 1, state the invariant the debug_assert encodes rather than only repointing the sentence. For item 2, keep the RFC 9113 §6.8 reasoning and replace only the mechanism clause. For item 3, read the surrounding step before choosing a target, and drop the citation rather than guess if the step does not correspond to a single function.
Then sweep for the same class rather than fixing only these three: grep lib/ and doc/ for drain., draining, started_at, graceful_shutdown_deadline, peer_last_stream_id and initial_goaway_pending outside h2_drain.rs itself, and report how many hits you examined alongside how many you changed. A count of hits read is a result; a count of fixes is not.
Deliberately out of scope: doc/h2_mux_internals.md:617 and :621 name initial_goaway_pending while explaining why a deferred advisory cannot be lost. That is narration of module-internal state in the same register h2_drain.rs's own doc comments use, and it claims nothing about reachability. Leave them.
Activity
docs(mux-h2): repoint H2DrainState field narration at h2_drain.rs
docs(mux-h2): repoint H2DrainState field narration at h2_drain.rs
docs(mux-h2): repoint H2DrainState field narration at h2_drain.rs
docs(mux-h2): repoint H2DrainState field narration at h2_drain.rs (#1461