Skip to content

ci(doc): the citation guard only fails a BLANK landing — 24 citations moved and it reported 2 #1389

Closed

Description

@FlorentinDUBOIS

check_doc_citations.py (landed in #1371) fails a file.rs:NNN citation only when the cited
line is blank. A citation that drifts onto a different non-blank line passes silently.
The script says so in its own output — "This is a floor, not a proof" — but the gap turns out
to be much larger than the floor language suggests, and it has now been measured three times.

Measurement 1 — 24 moved, the guard saw 2

While landing the #1379 fix, its changeset added +21 lines to lib/src/protocol/kawa_h1/editor.rs
and +14 to lib/src/protocol/mux/router.rs. The guard reported 2 failures. Resolving every
citation in doc/** and **/LIFECYCLE.md with the checker's own resolve_path/CITATION,
then comparing the text at each cited line against the merge base, showed 24 citations had
moved
. The 22 the guard could not see all landed on non-blank code — kawa_h1/LIFECYCLE.md
alone cites editor.rs 21 times.

Measurement 2 — a citation wrong before any of this work

editor.rs:1131, cited three times for the Sozu-Id stamping site
(e2e/COVERAGE.md, e2e/src/tests/h2_security_sni.rs, e2e/src/tests/h2_utils.rs), tracked
across three trees:

7f7ae47e (main)   let blocks_before_sozu_id = response.blocks.len();   <- correct
f7d77836 (#1379)  debug_assert!(                                       <- already wrong
later             } else {                                            <- wrong again

Non-blank at every step, so the guard was green throughout. This one is invisible twice
over
: none of the three sites is even in the scanned surface — e2e/COVERAGE.md is not
doc/** and not a LIFECYCLE.md, and the other two are .rs files.

Measurement 3 — two pre-existing off-by-ones

doc/benchmark.md cited mux/router.rs:129 for Router::connect (declared at 128, so the
citation landed on &mut self,) and mux/router.rs:427 for a call site at 426. Both predate
this work and both passed the guard.

Why this matters more than ordinary staleness

The guard's presence is itself the hazard: a green Doc citations job reads as "the citations
are right", and it only ever meant "no citation landed on a blank line". #1335 exists because
29 of 35 citations in one audited file were wrong; the guard was the answer to that, and in its
current form it would not have caught most of them.

Proposed fix — needs no new data, only the base revision

In the Doc citations job, resolve every citation at the merge base and at HEAD and
compare the text of the cited line. A citation whose line text changed is reported, whether
or not the new line is blank. That is exactly the sweep used to find the 24 above, so it is
known to work and known to be affordable. It is a strict superset of today's blank-line rule.

Two follow-ons worth deciding at the same time:

  1. Widen the surface. The Sozu-Id case shows citations living in e2e/COVERAGE.md and in
    .rs comments, neither of which is scanned. The line-citation rule currently covers doc/**
    and **/LIFECYCLE.md; the cited-test-name rule added in the same family already scans every
    *.rs comment plus CHANGELOG.md and doc/**. Aligning the two surfaces would close it.
  2. Prefer symbols in review. Every repair in this batch replaced a number with the symbol the
    prose already named. A rule that reports a new file.rs:NNN citation introduced by a
    changeset — rather than a symbol — would stop the population growing.

Not a regression in #1371

#1371 was a large net improvement and its floor is honestly documented. This issue is about
closing the floor, not reverting it.

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