Skip to content

check_doc_citations.py ignores .md:NNN targets, and all six in the tree are wrong #1444

Closed

Description

@FlorentinDUBOIS

check_doc_citations.py resolves .rs:NNN citations and silently ignores .md:NNN ones. Every markdown-target citation in the tree is wrong — measured, all six of them — and the gate has never looked at one.

Measurement

Against 95dee167, three citation sites target a markdown file (excluding CHANGELOG.md, which the checker's doc_files() does not cover at all). All three are in doc/configure_admin_ops.md, and they carry six line targets between them. Six of six point at unrelated prose.

Site Cites What the citing section is about What the cited line actually is Correct target
doc/configure_admin_ops.md:79 configure.md:560-567 CONTINUATION-flood (CVE-2024-27316) and server-emitted RST_STREAM (CVE-2025-8671) cap catalogue the sni_preread_timeout = 5 TOML block and its comment configure.md:1133 and :1234
doc/configure_admin_ops.md:157 configure.md:442, 458, 570 per-connection H2 stream-Vec shrink > FIPS build. / a secp384r1 cipher-table row / a clamping comment configure.md:1197
doc/configure_admin_ops.md:268 configure.md:979 https.alpn.rejected.unsupported counter servers. This is useful when your backends natively support HTTP/2 (e.g., gRPC configure.md:2860

The contrast in the same file is the useful part. doc/configure_admin_ops.md:267 cites lib/src/https.rs:483 as HttpsSession::upgrade_handshake. Line 483 is incr!(names::https::ALPN_REJECTED_UNSUPPORTED); — inside that function (which starts at :424) and precisely the line the surrounding prose describes. The class the gate checks is accurate; the class it ignores is 100% wrong.

Why the gate cannot see it

CITATION's regex requires a path prefix and the checker resolves the result only when the target is a source file. A .md target is parsed and then dropped. Two rules therefore never engage:

  • Rule 1 (existence) — would at least prove the cited line is non-blank. configure.md:979 is non-blank, so even this floor would have passed; but it never ran.
  • The drift rule — exempts any (path, spans) pair absent at the base revision, so a re-anchored citation is exempt by construction.

How :979 got there, which is the part worth fixing

#1437 changed this citation from configure.md:933 to configure.md:979 when it shifted lines in configure.md. That re-anchor is mechanically correct — at 7a223a8f, line 933 held the same http2 = true prose that line 979 holds at 95dee167. The re-anchor faithfully tracked a target that was already wrong, and moved the citation forward intact.

So this is not a stale citation that rotted. It was wrong when written, and the one tool that touched it since made it stay wrong more precisely. A re-anchor preserves the pointer, not the claim — and nothing in the pipeline compares the two.

Asked for

  1. Repair all six targets to the lines in the table above, verifying each against the text rather than by line arithmetic.
  2. Extend check_doc_citations.py to resolve .md:NNN targets under the same rules it applies to source targets, so the class cannot rot again silently. A citation naming a real but unrelated line still passes existence — that floor is stated in the script's own output and is not this issue's problem — but today there is not even a floor.
  3. Add the three repaired sites to the fixture self-test, including at least one a.md:N, M, K multi-target form and one bare-range a.md:N-M form, since both shapes appear here and neither is currently exercised.

A regression test for item 2 must be seen red. Corrected 2026-09-22: the recipe first written here asked for a citation onto "a wrong-but-non-blank line", which contradicts this issue's own paragraph two items above — rule 1 is an existence floor, and a citation onto a real, non-blank, semantically unrelated line passes by design, for .md exactly as for .rs. No extension under "the same rules it applies to source targets" can make that case red.

The two classes rule 1 genuinely owns, and which the red test must use:

  • a target line past the end of the cited file;
  • a target line that is blank.

Confirm the current script exits 0 on each, then confirm the extended script exits non-zero and names the citation.

Worth stating plainly, because it bounds what this issue buys: of the six wrong targets above, the extended existence rule catches exactly one — configure.md:560, and only because that line happens to be blank. The other five are wrong and resolvable. This closes the "names nothing at all" hole. It does not close "names the wrong thing", and nothing short of a semantic check would.

Activity

  1. added 4 commits that reference this issue on Sep 22, 2026
    826f4b6
    8f06bdf
    c5fc7ae
    f4b6ca0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions