Skip to content

docs(mux-h2): sweep stale code quotes, pin them to their source, and fix the fence pairing that hid a pin - #1432

Merged
FlorentinDUBOIS merged 2 commits into
mainfrom
docs/h2-mux-internals-snippet-sweep
Sep 22, 2026
Merged

FlorentinDUBOIS merged 2 commits into
mainfrom
docs/h2-mux-internals-snippet-sweep

Conversation

@FlorentinDUBOIS

Copy link
Copy Markdown
Collaborator

doc/h2_mux_internals.md quoted field-access syntax that no longer compiles.
The H2 sans-io extraction series moved decoder, encoder, converter_buf
and lowercase_buf off ConnectionH2 and into hpack_state.rs, where they
are private, and this document was never swept: each snippet would fail with
E0609 while its surrounding citations kept resolving.

Repaired every block that drifted, not only the ones the issue named: the
ConnectionH2 field tree, the HPACK table-size sync and converter-buffer
shrink, distribute_overhead's seventh parameter, compute_stream_byte_totals
generics, the sort_by_cached_key + apply_incremental_rotation priority pass
(so the claim that the incremental flag was "stored but not yet used" is gone),
the access-log path through try_recycle_server_stream and the associated
snapshot_rtts, the typed RejectReason write_all pattern, check_flood's
clock parameter and H2FloodViolation return over ten thresholds, the real
readable/writable signatures, and Stream::generate_access_log's move to
stream.rs. The protobuf excerpt no longer claims its field numbers hold for
HttpsListenerConfig, which numbers the same names differently, and the e2e
census that claimed 185 tests across 7 files is replaced by the command that
counts the current one.

check_doc_citations.py gains a fourth rule so this class stops being
invisible: a fenced block may name the lines it quotes, in the fence's info
string, and is then compared to them literally. Eighteen of the file's twenty
Rust blocks now carry that pin; the two that do not are a synthetic list of
call shapes and a bare #[cfg].

The rule is opt-in by measurement, not by timidity. Of the 27 Rust blocks on
the guarded surface only 7 are verbatim quotes — the rest are deliberately
abbreviated, composite or simplified — so a rule comparing all of them would
fire on 20 of 27 and be silenced within a release. rustdoc doctests cannot
substitute either: a doctest compiles as a separate crate against the public
API, and every snippet at issue reads a private field of a private type inside
impl ConnectionH2. The annotation is an ordinary citation, so a pinned block
is range-checked by rule 1 immediately and drift-checked by rule 2 from the
next commit onward.

Fixes #1424

Signed-off-by: Florentin Dubois [email protected]


The pinned-snippet scanner closed a fenced block on any ``` line. CommonMark
closes one only on a fence at least as long as the opener carrying nothing
after it, and that difference is load-bearing: it is the only way a document
can SHOW an annotated fence without pinning it, which doc/README.md does in
order to document the annotation at all. On a document whose inner example is
not a balanced pair, the scanner took that inner opener for the enclosing
block's closing fence and ran one block out of phase for the rest of the file.

The consequence is a silent miss, not a noisy one: measured on the new
doc/pinned_nested.md fixture, the pinned count went to 2 instead of 3, a
deliberately stale pin went unreported, and the run exited 0. A count that
shrinks reads exactly like a pass, which is why FIXTURE_PINNED is an exact
total and why the fixture carries an unmatched inner fence on purpose.

The fence shape now lives in one place (FENCE), and PINNED_FENCE/RUST_FENCE
match the info string rather than the whole line.

Also states two limits the rule has, rather than leaving them to be found.

A pinned block is NOT drift-checked on the commit that introduces it: rule 2
exempts a citation absent from the base revision of its own document, so when
the pins in doc/h2_mux_internals.md landed the cited-line total went 219 to
238 while the compared count stayed at exactly 325 — every one exempt that
day. Renumbering a pin's spans re-exempts it the same way.

And a pin guards the QUOTE, not the claim beside it. The review of the
changeset that introduced this rule found five wrong explanations sitting
immediately next to blocks the checker was certifying byte-exact and exiting 0
over. Pinning makes a page look more trustworthy while leaving that class
untouched, so doc/README.md now says so where a reader will meet it.

Signed-off-by: Florentin Dubois [email protected]

@FlorentinDUBOIS
FlorentinDUBOIS force-pushed the docs/h2-mux-internals-snippet-sweep branch 3 times, most recently from c872705 to c453448 Compare September 22, 2026 13:50
`doc/h2_mux_internals.md` quoted field-access syntax that no longer compiles.
The H2 sans-io extraction series moved `decoder`, `encoder`, `converter_buf`
and `lowercase_buf` off `ConnectionH2` and into `hpack_state.rs`, where they
are private, and this document was never swept: each snippet would fail with
E0609 while its surrounding citations kept resolving.

Repaired every block that drifted, not only the ones the issue named: the
`ConnectionH2` field tree, the HPACK table-size sync and converter-buffer
shrink, `distribute_overhead`'s seventh parameter, `compute_stream_byte_totals`
generics, the `sort_by_cached_key` + `apply_incremental_rotation` priority pass
(so the claim that the incremental flag was "stored but not yet used" is gone),
the access-log path through `try_recycle_server_stream` and the associated
`snapshot_rtts`, the typed `RejectReason` write_all pattern, `check_flood`'s
clock parameter and `H2FloodViolation` return over ten thresholds, the real
`readable`/`writable` signatures, and `Stream::generate_access_log`'s move to
`stream.rs`. The protobuf excerpt no longer claims its field numbers hold for
`HttpsListenerConfig`, which numbers the same names differently, and the e2e
census that claimed 185 tests across 7 files is replaced by the command that
counts the current one.

`check_doc_citations.py` gains a fourth rule so this class stops being
invisible: a fenced block may name the lines it quotes, in the fence's info
string, and is then compared to them literally. Eighteen of the file's twenty
Rust blocks now carry that pin; the two that do not are a synthetic list of
call shapes and a bare `#[cfg]`.

The rule is opt-in by measurement, not by timidity. Of the 27 Rust blocks on
the guarded surface only 7 are verbatim quotes — the rest are deliberately
abbreviated, composite or simplified — so a rule comparing all of them would
fire on 20 of 27 and be silenced within a release. `rustdoc` doctests cannot
substitute either: a doctest compiles as a separate crate against the public
API, and every snippet at issue reads a private field of a private type inside
`impl ConnectionH2`. The annotation is an ordinary citation, so a pinned block
is range-checked by rule 1 immediately and drift-checked by rule 2 from the
next commit onward.

Fixes #1424

Signed-off-by: Florentin Dubois <[email protected]>
The pinned-snippet scanner closed a fenced block on any ``` line. CommonMark
closes one only on a fence at least as long as the opener carrying nothing
after it, and that difference is load-bearing: it is the only way a document
can SHOW an annotated fence without pinning it, which `doc/README.md` does in
order to document the annotation at all. On a document whose inner example is
not a balanced pair, the scanner took that inner opener for the enclosing
block's closing fence and ran one block out of phase for the rest of the file.

The consequence is a silent miss, not a noisy one: measured on the new
`doc/pinned_nested.md` fixture, the pinned count went to 2 instead of 3, a
deliberately stale pin went unreported, and the run exited 0. A count that
shrinks reads exactly like a pass, which is why FIXTURE_PINNED is an exact
total and why the fixture carries an unmatched inner fence on purpose.

The fence shape now lives in one place (`FENCE`), and PINNED_FENCE/RUST_FENCE
match the info string rather than the whole line.

Also states two limits the rule has, rather than leaving them to be found.

A pinned block is NOT drift-checked on the commit that introduces it: rule 2
exempts a citation absent from the base revision of its own document, so when
the pins in `doc/h2_mux_internals.md` landed the cited-line total went 219 to
238 while the compared count stayed at exactly 325 — every one exempt that
day. Renumbering a pin's spans re-exempts it the same way.

And a pin guards the QUOTE, not the claim beside it. The review of the
changeset that introduced this rule found five wrong explanations sitting
immediately next to blocks the checker was certifying byte-exact and exiting 0
over. Pinning makes a page look more trustworthy while leaving that class
untouched, so `doc/README.md` now says so where a reader will meet it.

Signed-off-by: Florentin Dubois <[email protected]>
@FlorentinDUBOIS
FlorentinDUBOIS force-pushed the docs/h2-mux-internals-snippet-sweep branch from c453448 to 92c9ea7 Compare September 22, 2026 13:56
FlorentinDUBOIS added a commit that referenced this pull request Sep 22, 2026
…he rules

The `Group C″` box documented three rules after a fourth shipped. #1432 added
the pinned-snippet rule and updated both the script header and `doc/README.md`;
nothing made it update this box, so this box is the copy that rotted.

That is the answer to whether the restatement earns its place. There are three
statements of these rules — the script header, `doc/README.md`, and this box —
and the one that went stale is the one furthest from the code, with no
mechanical link to a change. Refreshing it in place would leave the same
arrangement standing and the same drift available.

It cannot defer to `--help`: the header is `#` comments, so `__doc__` is None
and `ArgumentParser(description=__doc__)` prints no rule text at all. Making
`--help` authoritative would mean turning ~200 lines of header into a docstring
and dumping them into every invocation's usage output, which is a worse trade
than a pointer.

So the box keeps only what nothing else can say and names the authority. Out:
every measurement and issue number, all of which the script header carries, and
all four wiring facts, each of which is already documented at the step it
constrains — `fetch-depth: 0` on the checkout's own `with:` block, the base sha
on its step, the broken-fixture rationale above that step. Restating those here
would have made a fourth copy while removing a third. In: one clause per rule
so an added rule is visibly missing, the pointer, and the merge-result rationale
that belongs to the job rather than to any step.

The clauses are accurate to this HEAD, including rule 1's `.md` extension and
the fact that rule 3 reads a wider surface than the other three — every `*.rs`
and `CHANGELOG.md` besides `doc/**` and `**/LIFECYCLE.md`, measured at 230 files
against 33.

Comment-only. Every changed line begins with `#`, and the parsed YAML is
identical to the parent's: 12 jobs, 5 steps in this one, same names. 29 lines
to 24.

Signed-off-by: Florentin Dubois <[email protected]>
@FlorentinDUBOIS
FlorentinDUBOIS merged commit c335057 into main Sep 22, 2026
24 checks passed
FlorentinDUBOIS added a commit that referenced this pull request Sep 22, 2026
…he rules

The `Group C″` box documented three rules after a fourth shipped. #1432 added
the pinned-snippet rule and updated both the script header and `doc/README.md`;
nothing made it update this box, so this box is the copy that rotted.

That is the answer to whether the restatement earns its place. There are three
statements of these rules — the script header, `doc/README.md`, and this box —
and the one that went stale is the one furthest from the code, with no
mechanical link to a change. Refreshing it in place would leave the same
arrangement standing and the same drift available.

It cannot defer to `--help`: the header is `#` comments, so `__doc__` is None
and `ArgumentParser(description=__doc__)` prints no rule text at all. Making
`--help` authoritative would mean turning ~200 lines of header into a docstring
and dumping them into every invocation's usage output, which is a worse trade
than a pointer.

So the box keeps only what nothing else can say and names the authority. Out:
every measurement and issue number, all of which the script header carries, and
all four wiring facts, each of which is already documented at the step it
constrains — `fetch-depth: 0` on the checkout's own `with:` block, the base sha
on its step, the broken-fixture rationale above that step. Restating those here
would have made a fourth copy while removing a third. In: one clause per rule
so an added rule is visibly missing, the pointer, and the merge-result rationale
that belongs to the job rather than to any step.

The clauses are accurate to this HEAD, including rule 1's `.md` extension and
the fact that rule 3 reads a wider surface than the other three — every `*.rs`
and `CHANGELOG.md` besides `doc/**` and `**/LIFECYCLE.md`, measured at 230 files
against 33.

Comment-only. Every changed line begins with `#`, and the parsed YAML is
identical to the parent's: 12 jobs, 5 steps in this one, same names. 29 lines
to 24.

Signed-off-by: Florentin Dubois <[email protected]>
FlorentinDUBOIS added a commit that referenced this pull request Sep 22, 2026
#1425 moved the RFC 9113 §6.8 GOAWAY/drain state machine into
h2_drain.rs and made all five H2DrainState fields private. Five
sentences outside that module still described them as reachable from
h2.rs; two were false rather than merely loose.

mux/LIFECYCLE.md §8.3 attributed `drain.started_at = Some(now)` to
ConnectionH2::graceful_goaway, which reads and writes none of the five
and delegates to H2DrainState::begin_graceful_drain. The passage now
names that method and PINS the debug_assert guarding the assignment as
a fenced quote of h2_drain.rs:234-237, so the invariant it encodes —
the budget arms exactly once, on the first call — is carried verbatim
by the source instead of paraphrased beside it. #1432 added that
mechanism for exactly this case; quoted unpinned, the sentence drifts
silently the moment the message is reworded. Seen red: rewording the
message to "on the very first call" exits 1 naming the block, and
restoring it exits 0.

The same attribution sat in production source: the RFC 9113 §6.8
comment guarding new peer-initiated streams said graceful_goaway sets
`drain.draining = true`. Only that mechanism clause changed; the
argument around it is correct and is kept. The comment keeps its exact
line count so the 88 h2.rs citations below it and the pinned code
blocks do not drift.

doc/h2_mux_internals.md's priority-cleanup list cited close_all_streams,
which has never existed under lib/ at any revision. ConnectionH2::goaway
is the nearest-sounding real function and is the wrong target: it
touches neither the prioriser nor the stream map. GOAWAY-time removal is
handle_goaway_frame plus prune_inactive_streams_while_closing, both
reaching remove_dead_stream once per retired stream, and neither clears
the map wholesale.

Two further hits from the same sweep: doc/lifetime_of_a_session.md
placed H2DrainState::draining in h2.rs, and doc/architecture.md credited
H2DrainState with "pending RST streams", which are H2StreamTable's
pending_rst_streams. That bullet names the struct's role and its module
and enumerates nothing: replacing a wrong five-field list with a right
one keeps the restated copy that drifted in the first place.

Sweep, read against c359eaf:

  git grep -En 'drain\.|draining|started_at|graceful_shutdown_deadline|peer_last_stream_id|initial_goaway_pending' \
      c359eaf -- lib/ doc/ | grep -v h2_drain.rs

338 hits across 36 files read. 3 of those hit lines changed, across 2
files: LIFECYCLE.md twice and h2.rs once. A 4th hit had the module path
beside it corrected (lifetime_of_a_session.md), and 2 further sites
carry no pattern token and so sit outside the hit set altogether —
h2_mux_internals.md's close_all_streams and architecture.md's
sub-struct bullet. Five sites in all.

The trailing `.` above is escaped and means a literal field access; as
an unescaped regex any-char the same sweep returns 933 hits across 52
files. doc/h2_mux_internals.md:617 and :621 are among the hits read and
deliberately left: they narrate module-internal state in the register
h2_drain.rs's own doc comments use and claim nothing about
reachability.

No rule in check_doc_citations.py reached any of these when written:
the drift rule compares a cited line at two revisions and these
documents do not modify h2.rs; the dead-name rule resolves test names
only; a code comment is in no rule. The pinned debug_assert is the one
that need not stay that way.

Refs: #1446
Signed-off-by: Florentin Dubois <[email protected]>
FlorentinDUBOIS added a commit that referenced this pull request Sep 22, 2026
… ones (#1458)

* fix(doc): repair the six wrong configure.md targets, and resolve markdown citations

`.github/scripts/check_doc_citations.py` matched `.rs` alone, so its `CITATION`
pattern walked straight past a `file.md:NNN` citation: it was never extracted,
and neither the existence rule nor the drift rule was ever handed one.

The class that left unguarded was not a corner. At `95dee167` the tree carried
three markdown-target citation sites, all in `doc/configure_admin_ops.md`, all
pointing into `doc/configure.md`, and holding six line targets between them —
and six of six landed on unrelated prose. The CONTINUATION-flood
(CVE-2024-27316) and server-emitted-RST_STREAM (CVE-2025-8671) catalogue
pointed at an `sni_preread_timeout` TOML block; the `h2_stream_shrink_ratio`
reference pointed at `> FIPS build.`, a `secp384r1` cipher-suite row and a
clamping comment; the `https.alpn.rejected.unsupported` counter pointed at a
sentence about gRPC backends. In the same file the `.rs` citations were
accurate: `lib/src/https.rs:483` is the `incr!` the surrounding prose
describes, inside the function it names.

The three sites now cite the rows that carry the claim: `doc/configure.md:1133,
1234` for the two flood caps, `doc/configure.md:1197` for
`h2_stream_shrink_ratio`, and `doc/configure.md:2860` for the metrics-table row
that defines the counter. The prose asks for "the catalogue", and a catalogue
is the table; the row carries the mechanism description the word "cap" leans
on; and two rows drawn from two tables is internally consistent where a row
plus a TOML example line would not be. Not because the examples lack the CVE —
`doc/configure.md:1149` carries both the default and CVE-2024-27316, and only
the emitted-lifetime example is bare. All three sites are written
repo-root-relative, which is what the convention this changeset documents asks
for.

The resolver now treats `.md` and `.rs` identically under all four rules:
`PATH` accepts either extension and the suffix index behind `resolve_path`
carries both, so a markdown citation resolves through the same
document-directory-first, repo-root-relative, unique-suffix order. `PATH` also
feeds `PINNED_FENCE`, so `check_pinned_snippets` takes the same wider index; it
sweeps no existing fence into rule 4, which stays at 18 pinned and 13 unpinned.

Six fixture citations pin the new class, covering the multi-target
`a.md:N, M, K` and bare-range `a.md:N-M` shapes that appear in the tree and
neither of which was exercised before. One of them, the bare `LIFECYCLE.md:8`,
exists only to reach `resolve_path`'s third branch: every other markdown
fixture is answered by the two `isfile` branches ahead of it, so without it
`TARGET_SUFFIXES` was asserted by nothing — reverting that tuple alone left the
self-test green at exit 0, while the three assertions that appeared to guard it
all belonged to `PATH`. Each half now fails the self-test on its own.

Rule 1 alone remains a floor, and the bound is measured rather than implied:
against the unrepaired tree it reports one of the six, the `560-567` range,
because line 560 happens to be blank. The other five resolved to real,
non-blank, unrelated lines and passed. The durable win is rule 2, which a
markdown target can now enter at all — though these four repaired line ends
contribute zero comparisons to this changeset's own `--base` run, since rule 2
exempts a citation whose line numbers changed, which is what repairing one
does. From the next changeset onward they are compared: on a scratch revision
based on this branch, editing the `h2_stream_shrink_ratio` row's text in place
raises the compared count from 370 to 374 and reports the drift, exit 1. That
same edit was silent before.

What nothing mechanical closes is the re-anchor. sozu#1437 moved the counter
citation from line 933 to line 979 while shifting lines in `doc/configure.md`,
mechanically correctly, carrying a target that was wrong the day it was written
forward intact and more precisely. A re-anchor preserves the pointer, not the
claim.

Closes #1444

Signed-off-by: Florentin Dubois <[email protected]>

* docs(ci): make the citation job's box an index, not a third copy of the rules

The `Group C″` box documented three rules after a fourth shipped. #1432 added
the pinned-snippet rule and updated both the script header and `doc/README.md`;
nothing made it update this box, so this box is the copy that rotted.

That is the answer to whether the restatement earns its place. There are three
statements of these rules — the script header, `doc/README.md`, and this box —
and the one that went stale is the one furthest from the code, with no
mechanical link to a change. Refreshing it in place would leave the same
arrangement standing and the same drift available.

It cannot defer to `--help`: the header is `#` comments, so `__doc__` is None
and `ArgumentParser(description=__doc__)` prints no rule text at all. Making
`--help` authoritative would mean turning ~200 lines of header into a docstring
and dumping them into every invocation's usage output, which is a worse trade
than a pointer.

So the box keeps only what nothing else can say and names the authority. Out:
every measurement and issue number, all of which the script header carries, and
all four wiring facts, each of which is already documented at the step it
constrains — `fetch-depth: 0` on the checkout's own `with:` block, the base sha
on its step, the broken-fixture rationale above that step. Restating those here
would have made a fourth copy while removing a third. In: one clause per rule
so an added rule is visibly missing, the pointer, and the merge-result rationale
that belongs to the job rather than to any step.

The clauses are accurate to this HEAD, including rule 1's `.md` extension and
the fact that rule 3 reads a wider surface than the other three — every `*.rs`
and `CHANGELOG.md` besides `doc/**` and `**/LIFECYCLE.md`, measured at 230 files
against 33.

Comment-only. Every changed line begins with `#`, and the parsed YAML is
identical to the parent's: 12 jobs, 5 steps in this one, same names. 29 lines
to 24.

Signed-off-by: Florentin Dubois <[email protected]>

* fix(doc): re-derive the repaired configure.md targets and drop the restated rule ordinals

The four repaired targets were computed against `95dee167`. `main` has since
added 22 lines at `doc/configure.md:1118` and one at `:2260`, so every one of
them moved: `:1133` now lands on a link paragraph, `:1197` on a table rule,
`:1234` on an `h2_initial_connection_window` line and `:2860` on a sentence
about window updates. This changeset's own gate reports none of it — rule 1
passes because all four are non-blank, and the drift rule exempts a citation
whose own line numbers this changeset changed. It is the failure the issue
diagnoses in sozu#1437, arriving by the same route: a pointer survives a shift
that the claim does not.

Re-derived by content against the rebased tree rather than by arithmetic:
`h2_stream_shrink_ratio` at `doc/configure.md:1219` and
`https.alpn.rejected.unsupported` at `:2883`.

The CVE catalogue site takes an anchor instead of a pair of rows.
`doc/README.md`, added by this same changeset, says to prefer an anchor
wherever a whole section is meant, and `#h2-flood-detection-thresholds` is a
real heading; the prose there asks for "the catalogue", which is the section.
That site is now immune to this class, at the cost of leaving the resolver's
reach. The row-choice defence in `doc/README.md` contradicted its own
"prefer an anchor" advice one sentence earlier and is replaced.

The CI box renumbered the rules against the script: `check_doc_citations.py`
numbers test names 3 and pinned blocks 4, while the box listed pinned third
and called test names "a fourth". Both ordinals are removed rather than
renumbered — the box's stated contract is that the script is the authority, so
a second copy of the numbering is the defect, not its value.

Refs #1444

Signed-off-by: Florentin Dubois <[email protected]>

---------

Signed-off-by: Florentin Dubois <[email protected]>
FlorentinDUBOIS added a commit that referenced this pull request Sep 23, 2026
h2_drain.rs and made all five H2DrainState fields private. Five
sentences outside that module still described them as reachable from
h2.rs; two were false rather than merely loose.

mux/LIFECYCLE.md §8.3 attributed `drain.started_at = Some(now)` to
ConnectionH2::graceful_goaway, which reads and writes none of the five
and delegates to H2DrainState::begin_graceful_drain. The passage now
names that method and PINS the debug_assert guarding the assignment as
a fenced quote of h2_drain.rs:234-237, so the invariant it encodes —
the budget arms exactly once, on the first call — is carried verbatim
by the source instead of paraphrased beside it. #1432 added that
mechanism for exactly this case; quoted unpinned, the sentence drifts
silently the moment the message is reworded. Seen red: rewording the
message to "on the very first call" exits 1 naming the block, and
restoring it exits 0.

The same attribution sat in production source: the RFC 9113 §6.8
comment guarding new peer-initiated streams said graceful_goaway sets
`drain.draining = true`. Only that mechanism clause changed; the
argument around it is correct and is kept. The comment keeps its exact
line count so the 88 h2.rs citations below it and the pinned code
blocks do not drift.

doc/h2_mux_internals.md's priority-cleanup list cited close_all_streams,
which has never existed under lib/ at any revision. ConnectionH2::goaway
is the nearest-sounding real function and is the wrong target: it
touches neither the prioriser nor the stream map. GOAWAY-time removal is
handle_goaway_frame plus prune_inactive_streams_while_closing, both
reaching remove_dead_stream once per retired stream, and neither clears
the map wholesale.

Two further hits from the same sweep: doc/lifetime_of_a_session.md
placed H2DrainState::draining in h2.rs, and doc/architecture.md credited
H2DrainState with "pending RST streams", which are H2StreamTable's
pending_rst_streams. That bullet names the struct's role and its module
and enumerates nothing: replacing a wrong five-field list with a right
one keeps the restated copy that drifted in the first place.

Sweep, read against c359eaf:

  git grep -En 'drain\.|draining|started_at|graceful_shutdown_deadline|peer_last_stream_id|initial_goaway_pending' \
      c359eaf -- lib/ doc/ | grep -v h2_drain.rs

338 hits across 36 files read. 3 of those hit lines changed, across 2
files: LIFECYCLE.md twice and h2.rs once. A 4th hit had the module path
beside it corrected (lifetime_of_a_session.md), and 2 further sites
carry no pattern token and so sit outside the hit set altogether —
h2_mux_internals.md's close_all_streams and architecture.md's
sub-struct bullet. Five sites in all.

The trailing `.` above is escaped and means a literal field access; as
an unescaped regex any-char the same sweep returns 933 hits across 52
files. doc/h2_mux_internals.md:617 and :621 are among the hits read and
deliberately left: they narrate module-internal state in the register
h2_drain.rs's own doc comments use and claim nothing about
reachability.

No rule in check_doc_citations.py reached any of these when written:
the drift rule compares a cited line at two revisions and these
documents do not modify h2.rs; the dead-name rule resolves test names
only; a code comment is in no rule. The pinned debug_assert is the one
that need not stay that way.

Refs: #1446
Signed-off-by: Florentin Dubois <[email protected]>
FlorentinDUBOIS added a commit that referenced this pull request Sep 23, 2026
#1425 moved the RFC 9113 §6.8 GOAWAY/drain state machine into
h2_drain.rs and made all five H2DrainState fields private. Five
sentences outside that module still described them as reachable from
h2.rs; two were false rather than merely loose.

mux/LIFECYCLE.md §8.3 attributed `drain.started_at = Some(now)` to
ConnectionH2::graceful_goaway, which reads and writes none of the five
and delegates to H2DrainState::begin_graceful_drain. The passage now
names that method and PINS the debug_assert guarding the assignment as
a fenced quote of h2_drain.rs:234-237, so the invariant it encodes —
the budget arms exactly once, on the first call — is carried verbatim
by the source instead of paraphrased beside it. #1432 added that
mechanism for exactly this case; quoted unpinned, the sentence drifts
silently the moment the message is reworded. Seen red: rewording the
message to "on the very first call" exits 1 naming the block, and
restoring it exits 0.

The same attribution sat in production source: the RFC 9113 §6.8
comment guarding new peer-initiated streams said graceful_goaway sets
`drain.draining = true`. Only that mechanism clause changed; the
argument around it is correct and is kept. The comment keeps its exact
line count so the 88 h2.rs citations below it and the pinned code
blocks do not drift.

doc/h2_mux_internals.md's priority-cleanup list cited close_all_streams,
which has never existed under lib/ at any revision. ConnectionH2::goaway
is the nearest-sounding real function and is the wrong target: it
touches neither the prioriser nor the stream map. GOAWAY-time removal is
handle_goaway_frame plus prune_inactive_streams_while_closing, both
reaching remove_dead_stream once per retired stream, and neither clears
the map wholesale.

Two further hits from the same sweep: doc/lifetime_of_a_session.md
placed H2DrainState::draining in h2.rs, and doc/architecture.md credited
H2DrainState with "pending RST streams", which are H2StreamTable's
pending_rst_streams. That bullet names the struct's role and its module
and enumerates nothing: replacing a wrong five-field list with a right
one keeps the restated copy that drifted in the first place.

Sweep, read against c359eaf:

  git grep -En 'drain\.|draining|started_at|graceful_shutdown_deadline|peer_last_stream_id|initial_goaway_pending' \
      c359eaf -- lib/ doc/ | grep -v h2_drain.rs

338 hits across 36 files read. 3 of those hit lines changed, across 2
files: LIFECYCLE.md twice and h2.rs once. A 4th hit had the module path
beside it corrected (lifetime_of_a_session.md), and 2 further sites
carry no pattern token and so sit outside the hit set altogether —
h2_mux_internals.md's close_all_streams and architecture.md's
sub-struct bullet. Five sites in all.

The trailing `.` above is escaped and means a literal field access; as
an unescaped regex any-char the same sweep returns 933 hits across 52
files. doc/h2_mux_internals.md:617 and :621 are among the hits read and
deliberately left: they narrate module-internal state in the register
h2_drain.rs's own doc comments use and claim nothing about
reachability.

No rule in check_doc_citations.py reached any of these when written:
the drift rule compares a cited line at two revisions and these
documents do not modify h2.rs; the dead-name rule resolves test names
only; a code comment is in no rule. The pinned debug_assert is the one
that need not stay that way.

Refs: #1446
Signed-off-by: Florentin Dubois <[email protected]>
FlorentinDUBOIS added a commit that referenced this pull request Sep 23, 2026
)

#1425 moved the RFC 9113 §6.8 GOAWAY/drain state machine into
h2_drain.rs and made all five H2DrainState fields private. Five
sentences outside that module still described them as reachable from
h2.rs; two were false rather than merely loose.

mux/LIFECYCLE.md §8.3 attributed `drain.started_at = Some(now)` to
ConnectionH2::graceful_goaway, which reads and writes none of the five
and delegates to H2DrainState::begin_graceful_drain. The passage now
names that method and PINS the debug_assert guarding the assignment as
a fenced quote of h2_drain.rs:234-237, so the invariant it encodes —
the budget arms exactly once, on the first call — is carried verbatim
by the source instead of paraphrased beside it. #1432 added that
mechanism for exactly this case; quoted unpinned, the sentence drifts
silently the moment the message is reworded. Seen red: rewording the
message to "on the very first call" exits 1 naming the block, and
restoring it exits 0.

The same attribution sat in production source: the RFC 9113 §6.8
comment guarding new peer-initiated streams said graceful_goaway sets
`drain.draining = true`. Only that mechanism clause changed; the
argument around it is correct and is kept. The comment keeps its exact
line count so the 88 h2.rs citations below it and the pinned code
blocks do not drift.

doc/h2_mux_internals.md's priority-cleanup list cited close_all_streams,
which has never existed under lib/ at any revision. ConnectionH2::goaway
is the nearest-sounding real function and is the wrong target: it
touches neither the prioriser nor the stream map. GOAWAY-time removal is
handle_goaway_frame plus prune_inactive_streams_while_closing, both
reaching remove_dead_stream once per retired stream, and neither clears
the map wholesale.

Two further hits from the same sweep: doc/lifetime_of_a_session.md
placed H2DrainState::draining in h2.rs, and doc/architecture.md credited
H2DrainState with "pending RST streams", which are H2StreamTable's
pending_rst_streams. That bullet names the struct's role and its module
and enumerates nothing: replacing a wrong five-field list with a right
one keeps the restated copy that drifted in the first place.

Sweep, read against c359eaf:

  git grep -En 'drain\.|draining|started_at|graceful_shutdown_deadline|peer_last_stream_id|initial_goaway_pending' \
      c359eaf -- lib/ doc/ | grep -v h2_drain.rs

338 hits across 36 files read. 3 of those hit lines changed, across 2
files: LIFECYCLE.md twice and h2.rs once. A 4th hit had the module path
beside it corrected (lifetime_of_a_session.md), and 2 further sites
carry no pattern token and so sit outside the hit set altogether —
h2_mux_internals.md's close_all_streams and architecture.md's
sub-struct bullet. Five sites in all.

The trailing `.` above is escaped and means a literal field access; as
an unescaped regex any-char the same sweep returns 933 hits across 52
files. doc/h2_mux_internals.md:617 and :621 are among the hits read and
deliberately left: they narrate module-internal state in the register
h2_drain.rs's own doc comments use and claim nothing about
reachability.

No rule in check_doc_citations.py reached any of these when written:
the drift rule compares a cited line at two revisions and these
documents do not modify h2.rs; the dead-name rule resolves test names
only; a code comment is in no rule. The pinned debug_assert is the one
that need not stay that way.

Refs: #1446

Signed-off-by: Florentin Dubois <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: h2_mux_internals quotes field syntax that no longer compiles, and no citation rule can catch stale code inside prose

1 participant