Skip to content

doc/architecture.md hardcodes mux line counts that nothing checks: 12 of 13 wrong, 13 modules missing, total off by 24k lines #1520

Closed

Description

@FlorentinDUBOIS

doc/architecture.md's "Module layout" block hardcodes a line count per module and a total. Every one of those numbers is now wrong, the module list is missing half the tree, and nothing anywhere fails when that happens.

Measured on origin/main at 5355cec0, with git show origin/main:<path> | wc -l:

module stated actual
mod.rs 1818 3986
h1.rs 823 1212
h2.rs 7562 15360
parser.rs 2246 2481
serializer.rs 557 615
converter.rs 1410 1798
pkawa.rs 2229 2917
connection.rs 578 732
router.rs 678 2192
stream.rs 290 1274
answers.rs 302 443
shared.rs 93 646
debug.rs 80 80 the only one still true, and only by coincidence

Thirteen numbers, twelve wrong. The stated total is 18 666 lines across 13 modules; the tree is 43 092 lines across 26 modules.

The thirteen modules missing from the block entirely: auth.rs, buffer_source.rs, h2_close.rs, h2_control_tx.rs, h2_drain.rs, h2_flood_detector.rs, h2_flow_control.rs, h2_header_reassembly.rs, h2_scheduler.rs, h2_stream_table.rs, h2_transmit.rs, h2_write_pass.rs, hpack_state.rs.

Two of the prose descriptions are stale in the same way the numbers are. mod.rs is described as holding "Mux session, Stream, Router, ready() loop, stream lifecycle" — Router has lived in router.rs and Stream in stream.rs since they were split out. h2.rs is described as holding "flood detection" and "shutdown handling", which are now h2_flood_detector.rs and h2_close.rs/h2_drain.rs.

The actual defect is not the numbers

The block already ends with:

Total: 18 666 lines of Rust across 13 modules. Run wc -l lib/src/protocol/mux/*.rs to re-derive at any HEAD.

So the document knows the value is derivable, tells the reader how to derive it, and hardcodes a snapshot anyway. Re-deriving the thirteen numbers today fixes nothing structural: the next change to any file in that directory makes the block wrong again, and no gate in this repository notices. check_doc_citations.py polices line citations into code; a line count stated in prose is invisible to it, so this is a drift obligation with no enforcement behind it.

That is the same class of defect as #1447 — a number in a document whose correctness nothing checks — arrived at from the other direction.

Asked for

Decide between the two honest options and take one:

  1. Stop stating the counts. Keep the module list and the one-line descriptions, which carry real information a reader cannot cheaply re-derive, and delete every parenthesised count and the total. The wc -l sentence stays and becomes the whole answer rather than a footnote to a stale snapshot. The module list still has to be completed and the two stale descriptions corrected, and that list changes far less often than the counts.

  2. Make them checkable. If the counts are worth keeping, something has to fail when they drift — a check alongside the citation gates that re-derives them and compares. Note this buys a gate whose only job is to guard an ornament, and that whoever adds a module still has to remember to add its row, which is the part that actually rotted here.

I lean strongly to (1): twelve of thirteen numbers wrong, half the modules absent, and a total off by 24 426 lines is a good measurement of how much the snapshot was worth.

Whichever is chosen, fix in the same changeset: the missing thirteen modules, mod.rs's description naming Router and Stream, and h2.rs's description naming flood detection and shutdown handling.

Do not fix this by deleting the module layout block. It is the only place in doc/ that tells a newcomer what each file in a 26-module directory is for, and that is the part worth keeping.

Activity

  1. FlorentinDUBOIS commented on Sep 25, 2026

    @FlorentinDUBOIS
    CollaboratorAuthor

    Closed by #1522, merged as 36a6244e. Option 1: every parenthesised count and the stated total are gone, the module list is complete at 26 entries, and the wc -l lib/src/protocol/mux/*.rs sentence already in the block is now the whole answer.

    Two measurements from the implementation are worth keeping here, because they are the argument rather than a summary of it.

    The largest stated count was measuring something other than what a reader takes it for. h2.rs was stated at 7562 and is 15360 — but its #[cfg(test)] mod tests opens at line 7784, so 7577 lines, just under half the file, are its own test suite. The number a reader reads as "how much implementation is here" was, for the biggest module, mostly tests.

    Against building a gate to keep the counts honest: 40 of the last 40 commits on main touch lib/src/protocol/mux/, so such a gate would fire on nearly every mux changeset with the fix always "re-run wc -l and paste" — and it would not have caught the failure that produced this issue, since a module with no row has no number to compare. The check that would pay is a membership comparison, firing only on add/remove/rename; left to its own changeset because it is a CI change.

    Beyond the two stale descriptions named above, four further rows were wrong or incomplete, and h2.rs's row had four stale clauses rather than two: flow control, RFC 9218 priorities, flood detection and shutdown handling had all moved to their own modules.

    Not fixed, for whoever picks it up: lib/src/protocol/mux/LIFECYCLE.md §1.1 carries the same defect — 11 of 26 modules across 9 rows — but it holds 108 resolved citations, so completing it is a citation-remap changeset rather than a doc edit, and it was deliberately left out of scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions