Repository navigation
fix(doc): resolve markdown citation targets, and repair the six wrong ones - #1458
Merged
Merged
Conversation
…down 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]>
…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]>
…stated 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]>
FlorentinDUBOIS
requested review from
Wonshtrum and
llenotre
as code owners
September 22, 2026 21:13
FlorentinDUBOIS
added a commit
that referenced
this pull request
Sep 23, 2026
#1467) `check_doc_citations.py` rendered every quoted line through one left-anchored window — `line[:71]` plus an ellipsis, always from column 0 — and both halves of a before/after pair went through it independently. A markdown table row is wide by construction and carries its meaning in the last column, so a row whose text changed past character 71 was reported with the same 72 characters printed twice: the rule fired correctly and the report named nothing that had moved. `doc/configure_admin_ops.md:158` cites exactly such a row, `doc/configure.md:1219` — 610 characters wide, its description column beginning at character 70. Pre-existing, and low-impact while the guarded surface was source files only; #1458 made the class reachable by teaching the resolver to read `.md` targets, because the citations that point at prose disproportionately point at table rows. Move the window instead of widening it. `quote_pair` finds the first offset at which the two stripped lines diverge and, when that offset falls outside the anchored window, clips BOTH from `offset - QUOTE_WIDTH // 2` with an ellipsis on whichever side is truncated. `QUOTE_WIDTH` stays 72 and stays a hard ceiling on every rendered quote, ellipses included: raising it would fix the table row by making every long Rust line wrap a CI log, which is what the constant was chosen against. No rule learns about file types — a Rust line whose only edit sits far to the right is served by the same window. Both quote sites take a pair and neither ever quotes a line alone, so rule 2's drifted line and rule 4's stale pinned-block line both go through it. `doc/wide.md` is the fixture: a 151-character catalogue row whose only edit sits at character 147, cited as `wide.md:11` from the drift fixture at both revisions so the rule compares rather than exempts it. The assertion is a property and not a string — the two reported halves must differ from each other, and neither may exceed `QUOTE_WIDTH` — so it survives a later change of window strategy, and its second half makes "do not fix this by removing the clip" mechanical. Seen red: with this commit's production change reverted and the fixture kept, `--self-test` exits 1 printing the two identical clipped strings. `FIXTURE_TOTAL` 29 -> 30 for the citation the drift fixture gains, and `FIXTURE_DRIFT_COMPARED` 30 -> 31 for the one compared line end behind it. Every other fixture constant is unchanged; `FIXTURE_TEST_EXAMINED` deliberately stays at 6, because the new document carries no backticked identifier long enough to be a rule 3 candidate. `doc/README.md` is unaffected: its citation section describes the rule and its command line, never the width or the anchoring of a quoted line. Closes #1448. Signed-off-by: Florentin Dubois <[email protected]>
This was referenced Sep 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1444.
check_doc_citations.pyonly ever resolved*.rs:NNNtargets. Every*.md:NNNcitation in the tree was invisible to it, and all six of them were wrong.
What changed
The resolver reads
.mdtargets.rust_filesbecomestarget_files, so acitation naming a markdown file is resolved and range-checked the same way a Rust
one is.
resolve_path's search order is unchanged — the citing document's owndirectory, then repo root, then a tree-wide unique-suffix index — and so is
doc_files()'s surface (doc/**plus**/LIFECYCLE.md).CHANGELOG.mdstaysoutside that surface, so its ~108
*.rs:NNNcitations are neither pulled in norpushed out.
QUOTE_WIDTHandRENAMED_TESTSare untouched.The six wrong targets are repaired, five by re-derivation and one by anchor.
The CI job's rule box becomes an index rather than a third copy of the rules.
Two things worth a reviewer's attention
The repairs rotted once before this branch opened, and this branch's own gate
could not see it. The four
doc/configure.mdtargets were computed against95dee167;mainthen added 22 lines atconfigure.md:1118and one at:2260,moving every one of them —
:1133onto a link paragraph,:1197onto a tablerule,
:1234onto anh2_initial_connection_windowline,:2860onto a sentenceabout window updates. Rule 1 passed anyway, because all four were non-blank, and
the drift rule exempted them precisely because this changeset had changed their
numbers. That is the sozu#1437 failure arriving by its own route: the pointer
survives a shift the claim does not.
They have been re-derived by content against the rebased tree, not by
arithmetic:
h2_stream_shrink_ratioatdoc/configure.md:1219andhttps.alpn.rejected.unsupportedat:2883.One site left the resolver's reach on purpose. The CVE catalogue reference in
doc/configure_admin_ops.mdnow points atdoc/configure.md#h2-flood-detection-thresholdsinstead of a line range. Theprose asks for "the catalogue", which is a section, and
doc/README.md— added bythis same changeset — says to prefer an anchor wherever a whole section is meant.
The row-choice defence previously in
doc/README.mdcontradicted that advice onesentence earlier and is gone. The trade is explicit: that site is now immune to
this entire class, and in exchange the gate no longer range-checks it.
Rule numbering
The CI box listed pinned blocks third and called test names "a fourth", while the
script numbers test names 3 and pinned blocks 4. Both ordinals are removed
rather than renumbered. The box's own stated contract is that the script is the
authority, so a second copy of the numbering was the defect, not its value — the
box had already gone stale once, when #1432 shipped a fourth rule and updated the
script header and
doc/README.mdbut nothing made it update this box.It cannot defer to
--help: the header is#comments, so__doc__isNoneand
ArgumentParser(description=__doc__)prints no rule text at all.Verification
check_doc_citations.py --root .on the merged tree againstmain: exit 0 —242 citations resolve, 368 cited test names resolve, 18 pinned blocks verbatim
--self-test: exit 0git merge-tree --write-tree origin/main <head>: exit 0🐛 Fixed, no duplicates, no heading driftThe regression was seen red: the pre-change script extracts neither
reference.md:99nordoc/reference.md:10from the new fixtures at all(23 citations, 7 failures), while the post-change script reports both
(29 citations, 9 failures) as
past end of doc/reference.md (12 lines)anddoc/reference.md:10 is blank— the two classes the issue mandates.