Skip to content

doc/lifetime_of_a_session.md cites buffer-pool code as evidence for the accept_queue.saturated_seconds ticker; stable, resolvable and wrong #1531

Closed

Description

@FlorentinDUBOIS

doc/lifetime_of_a_session.md cites a block of buffer-pool gauge code as the evidence for the accept_queue.saturated_seconds 1 Hz ticker. The real ticker is about 15 lines further down. The citation has been wrong since before #1528 re-anchored it, and every gate in the repository passes on it.

Found while hand-auditing #1528's citation re-anchors; #1528 carried the defect forward faithfully rather than introducing it.

What the prose claims

Two places, both in doc/lifetime_of_a_session.md:

a 1 Hz ticker also bumps accept_queue.saturated_seconds so dashboards can plot how long the worker spent backpressured (lib/src/server.rs:110-114, 1268-1274).

and, in the metric inventory:

accept_queue.backpressure, accept_queue.saturated_seconds — binary backpressure + time-integrated saturation (SessionManager::check_limits and SessionManager::decr in lib/src/server.rs, plus lib/src/server.rs:1268-1274).

What the cited lines actually are

lib/src/server.rs:1268-1274 at 00118f77:

            // Buffer pool gauges. `buffer.in_use` replaces the older
            // `buffer.number` (renamed in `lib/src/pool.rs` for naming
            // consistency with the surrounding `buffer.*` keys).
            // `buffer.usage_percent` is computed against the configured
            // `buffer.capacity` so dashboards can chart pool pressure.
            {
                let pool = self.pool.borrow();

That is the buffer pool block. It has nothing to do with accept-queue saturation.

The ticker the prose describes is at 1283-1293 in the same function:

            // 1Hz tick for `accept_queue.saturated_seconds`. Increments once
            // per `ACCEPT_SATURATION_TICK` while `SessionManager::can_accept`
            …
            if now.duration_since(self.last_saturation_tick) >= ACCEPT_SATURATION_TICK {
                …
                    incr!(names::accept_queue::SATURATED_SECONDS);

The companion citation on the same line, server.rs:110-114, is correct — it is ACCEPT_SATURATION_TICK's declaration and doc comment. So one target of the pair is right and the other is fifteen lines short.

Why nothing caught it, which is the part worth fixing

The defect predates #1528. Before it, the same claim cited server.rs:1199-1205, and git show <base>:lib/src/server.rs | sed -n '1199,1205p' is byte-for-byte the same buffer-pool block — md5 identical to the current 1268-1274. #1528 inserted 69 lines above it and re-anchored 1199-1205 → 1268-1274 correctly, preserving a citation that was already pointing at the wrong code.

Every gate passes, and each for a defensible reason:

  • Rule 1 (resolution) passes: the lines exist and are non-blank.
  • Rule 2 (drift) passes: the cited text did not change, so there is nothing to report. A faithful re-anchor of a wrong citation is indistinguishable from a faithful re-anchor of a right one.
  • --audit did not flag it. It reports 7 findings on this tree and this is not among them.

This is the same shape as #1447 seen from the other side: that issue was about a rule firing on a citation that was correct; this is a rule staying silent on one that is not. A citation can be stable, resolvable and wrong at the same time, and stability is what both rules measure.

Asked for

  1. Repoint both citations at the ticker — the if now.duration_since(self.last_saturation_tick) >= ACCEPT_SATURATION_TICK block — or better, cite it by symbol, since the prose already names accept_queue.saturated_seconds and ACCEPT_SATURATION_TICK. The repository's own convention is to cite a symbol wherever the prose names an item, and a citation that had to be re-anchored twice is exactly the case that convention exists for.
  2. Sweep doc/lifetime_of_a_session.md's metric inventory for the same class. This one was found by hand, not by a gate, so there is no reason to think it is alone. State what was checked and how.
  3. Consider whether --audit can be made to catch it. The prose names two identifiers, accept_queue.saturated_seconds and the 1 Hz ticker; the cited span mentions neither, and the correct span mentions both. An audit rule that asked "does the cited span contain any identifier the surrounding prose names?" would have flagged this and would not have flagged the correct companion citation at 110-114. That may produce noise on spans cited for structure rather than for a name — measure it before deciding, and if the noise is too high, say so and close this item rather than shipping a rule that gets muted.

Do not fix this by deleting the citation. The claim it supports is real and a reader needs to be able to check it.

Activity

  1. added a commit that references this issue on Sep 25, 2026
    8bf2532
  2. FlorentinDUBOIS commented on Sep 25, 2026

    @FlorentinDUBOIS
    CollaboratorAuthor

    Closed by #1533, merged as 8bf25328.

    Repointed by symbol, not renumbered. Both sites now cite the ACCEPT_SATURATION_TICK block of Server::run. The convention's own carve-out would have permitted a number here — the ticker is a branch inside a function, not an item — so the reason is the history: this number had already survived two faithful re-anchors while being wrong, which is precisely the case the symbol convention exists for.

    The sweep was widened past the metric inventory, and that is where the real finding was. The inventory turned out to be clean; all three further defects were outside it. The strongest instance in the document is not the one this issue was filed for: the write-only-shutdown pair in https.rs and its http.rs mirror both landed inside the failed-upgrade branch whose own comment says the front socket is unreachable — the inverse of the claim they support. A sweep held to the inventory would have reported "no others" truthfully and found none of them.

    Method: the document's citations were extracted with the check script's own citations()/resolve_path() rather than a hand-rolled parser — 13 groups, 18 spans, each span's source text printed beside its prose and read by hand. That choice was deliberate: the extractor already handles bare :NNN continuations, /- and ,-separated groups, the two ends of a range as separate spans, and path resolution that is document-relative before it is repo-relative. A hand-rolled parser gets some subset of those wrong and reports a confident, wrong total. (I can confirm that from the other side: my own ad-hoc audit script was wrong four different ways today, including keying on basenames and mis-pairing range endpoints.)

    Item 3 — measured, and closed without shipping a rule

    The candidate was not a new rule. --audit already carries "the prose names a symbol that is not there". It stayed silent because audit_fragment reads the citation's own line, which carries no symbol, so both spans were declined and never examined. The real question was therefore the prose window, not a new check.

    Measured over the whole tree against the shipped 7 findings / 81 examined:

    variant findings vs base genuine additions
    +1 line above, nearest symbol 13 +6 / −0 1 of 6
    any identifier the prose names 17 +13 / −3 2 of 13
    both, whole prose block 26 +23 / −4 2 of 23

    Every addition was dispositioned; the only genuine ones are this issue's two sites. The literal rule additionally silences three correct-citation findings the mode reports today. Against the 6-in-13 the mode already measures for itself and prints in its own banner, that is below its own bar.

    Two findings made the decision rather than the table alone:

    • audit_symbol returns None on a 4-character symbol (SessionManager::decr) instead of continuing to check_limits — a second, independent silencer behind the first, so even the minimal widening reaches only one of the two sites.
    • The variants that fire, fire by a one-line margin. AUDIT_WINDOW is 8 and the ticker's comment naming the metric sits 9 lines past the wrong span's end. At 9 every variant goes quiet while the citation stays exactly as wrong, and the correct companion is silent for the same reason in reverse. A rule whose verdict flips on where a comment happens to sit is not measuring what it claims to.

    No rule shipped. The check_doc_citations.py diff is comment-only — 0 non-comment lines — recording the measurement in the header the way every other constant there carries its own, so the next person to have this idea finds the numbers instead of repeating the work.

    Confirmation of the remedy: repointing the five spans dropped --audit's declined count from 95 to 90. Every one of them had been in the bucket the mode cannot read.

    The framing worth keeping

    A citation can be stable, resolvable and wrong at the same time, and stability is all the existing rules measure. Rule 1 passes because the line is non-blank; rule 2 passes because the cited text never changed; --audit declined to look. A faithful re-anchor of a wrong citation is indistinguishable from a faithful re-anchor of a right one — which is how this one survived a 1199-1205 → 1268-1274 shift intact.

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