Repository navigation
ci(doc): audit a citation that was already wrong when the gate first saw it - #1495
Merged
Merged
Conversation
…saw it Every rule in check_doc_citations.py either resolves a citation or forbids a form, and none of them can see a citation that was already wrong the first time it was seen. The drift rule cannot by construction: it compares a citation's text between two revisions, so "unchanged" is exactly the condition for being exempt, and a change detector cannot find a defect that predates its first observation. #1493 closed that hole for Rust comments by forbidding the form; doc/** and **/LIFECYCLE.md keep their line numbers, because there a number is sometimes the only way to name a span with no symbol. --audit reads every citation's prose against its cited line on two heuristics: the target is a comment while the prose names a statement, a call, an insert or a push, or the prose names a symbol that is neither within eight lines of the span nor an item enclosing it. Measured against #1466's own four citations at 5d5191e, the comment signal reports three and the symbol signal reports the fourth, which lands on ordinary code. It is advisory: it always exits 0, never edits a citation, and is deliberately absent from ci.yml, because a heuristic that fails a build is one people learn to silence. Its first run at 6172929 examined 108 of the surface's 221 cited spans and reported 13: six wrong citations and seven false positives, a ratio printed in its own output rather than engineered down. The six are repaired here, and every run prints what it declined to check -- 111 citations naming nothing either heuristic can test, more than half the surface. Refs #1466 Signed-off-by: Florentin Dubois <[email protected]>
FlorentinDUBOIS
requested review from
Wonshtrum and
llenotre
as code owners
September 24, 2026 05:53
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.
Refs #1466.
Rule 2 compares a citation's text between base and head, so a citation that was already wrong the first time the rule saw it is frozen in that state permanently — "unchanged" is exactly the condition for being exempt. The gate is a change detector, and a change detector cannot find a defect that predates its first observation.
#1493 closed the Rust-comment half by forbidding the form.
doc/**and**/LIFECYCLE.mddeliberately keep line numbers, because there a number is sometimes the only way to point at a span with no symbol. That surface needs an audit, which is #1466's option 1.It catches 4 of the 4 citations #1466 was filed about
Measured at
5d5191e8, the revision the issue names, with the final committed script:h2.rs:2567rst_sentinserth2.rs:2668h2.rs:2775completed_streams.pushpathh2.rs:710self.stream_table.rst_sent_contains(sid)The issue predicted the comment heuristic alone would catch three; the orthogonal symbol signal takes the fourth.
h2.rs:710'srst_sent_containsis over 1800 lines away.Every constant carries its ablation, measured on real trees — window 3/8/16/32 → 14/13/8/6 findings; minimum symbol segment 4/6/8/12 → 19/16/13/9; enclosing-item awareness 29 → 13; attached-vs-any symbol 24 → 13.
The first audit, triaged — 6 wrong, 7 false positives
--audit --root .at6172929ereported 13 of 108 examined. Every finding was triaged rather than counted:Genuinely wrong and fixed in this changeset:
testing.md→redirect_rewrite_auth_tests.rs:264:266-267testing.md→h2_security_tests.rs:24400x20byte is at:2444kawa_h1/LIFECYCLE.md→tcp.rs:2426}; converted to a symbol citation, since the prose already nameshandle_connection_resultmux/LIFECYCLE.md×3 →mod.rs:2376,:2382-2383,:2383Be precise about those three: they point at exactly the code the prose describes, but inside
shutting_down_inner, whileMux::shutting_downis the four-lineSessionStatewrapper elsewhere. A reader following them finds the right code. Renamed toMux::shutting_down_inner; the document already distinguishes wrappers from*_innerbodies elsewhere.One was found by hand, not by the mode, and is fixed with them:
Mux::timeout(mod.rs:2001) has the identical defect and sat one bullet above one of the findings. The audit misses it becausetimeoutappears in atrace!and a comment inside the window — proximity cannot distinguish "the name is nearby" from "the item is here". That limitation is written into the mode's header,doc/README.mdand the CHANGELOG rather than left implicit.False-positive ratio: 7 of 13, 54% — printed in the mode's own output rather than tuned away. Two FP classes were tightened because the heuristic was wrong about a shape; the other five are left reporting with their reason documented, because narrowing further starts costing real findings. After the six repairs,
--audit --root .still reports 7 of 107 — all seven the documented false positives. Nothing was tuned toward silence.Advisory, not a gate
--auditis not wired intoci.ymland exits 0 even when it reports. A heuristic that fails the build teaches people to silence it. The self-test asserts this in the inverse direction from every other rule: the same broken fixture tree that exits 1 for rules 1–5 must exit 0 under--audit, with the banner and both findings present.It also counts what it declines to check, in rule 5's style:
111 prose naming nothing this heuristic can test— more than half the surface — plus 2 prose-to-prose citations and the bare/unresolvable spans. Silence about skipped work is the defect that produced #1457 and #1447.Seen red
Four mutations, each producing the FAIL line, each restored: range guard removed → the comment-started range is reported;
enclosing_namesremoved → the line-14-below-its-fncase is reported; symbol signal disabled → that finding disappears andexamineddrops 11 → 10;--auditmade to exit 1 → the advisory assertion fires.New fixtures
audit.rs+doc/audit.mdcarry four citations: one the comment signal must flag, one only the symbol signal can, and two that must stay silent.doc/audit.mdis deliberately not inBROKEN_FIXTURES— all four resolve, so rules 1–5 stay silent and the clean-tree exit-0 assertion holds.Verification
Zero workspace Rust changed —
git diff --name-only | grep '\.rs$' | grep -v testdatais empty — so the 1106 count ismain's. The three exempt spans are exactly the three lines the repairs re-anchored, named by--show; no unintended re-anchor.ci.ymluntouched.This does not close #1466
Marked
Refs. Option 1 is delivered, measured, run and triaged, but the structural gap is narrowed rather than closed:Mux::timeoutcarried the same defect as three findings and was invisible to proximity.doc/**for the reason the issue itself gives.