Repository navigation
Description
What happens
The drift rule treats a citation's identity as the whole span tuple, so moving one number in a multi-span citation exempts every sibling in that citation from the drift comparison.
.github/scripts/check_doc_citations.py:532-535 builds the base set:
untouched = {
(m.group("path"), tuple(parse_spans(m.group("spans"))))
for m in CITATION.finditer(base_body)
}and :546-547 skips anything not found in it:
if (cited, tuple(spans)) not in untouched:
continue # re-anchored by this changeset, which is not driftFor a citation like h2.rs:5676/5860/5885/5903, correcting only the first number yields the tuple (5701, 5860, 5885, 5903). That tuple is absent from untouched, so the whole citation is classified "re-anchored, not drift" and continues — and 5860, 5885 and 5903 are never compared, however stale they are.
Why it matters
This is precisely the half-applied renumbering signature, which the script's own header already names as a thing it means to catch. Today it is caught only via the duplicate-number heuristic, which misses this shape entirely: the author who fixes one number in a group silently buys an exemption for the rest, and the more careful the partial fix looks, the more numbers it hides.
The failure is worse than leaving the group untouched. An all-stale group still reads as uniformly suspect; a group where element 1 is freshly correct reads as maintained, and a reader following element 2 lands on unrelated code with no signal that anything is wrong.
Observed instance
Commit 06fc2708 ("refactor(mux): hand the Endpoint trait an RTT value, not a peer socket") moved element 1 of three groups in lib/src/protocol/mux/LIFECYCLE.md by the correct shift and left seven sibling numbers pointing at unrelated code. The checker passed.
Relaxing the drift identity from the whole tuple to a single span surfaces them:
LIFECYCLE.md:308 h2.rs:5860 was `where` now `{`
LIFECYCLE.md:308 h2.rs:5885 was `return false;` now `trace!(`
LIFECYCLE.md:308 h2.rs:5903 was a comment now a different comment
LIFECYCLE.md:328 mod.rs:2068 was `} else {` now `set_default_answer(...)`
LIFECYCLE.md:328 mod.rs:2163 was `log_module_context!()` now `);`
LIFECYCLE.md:329 h2.rs:5756 was `let buf = kawa.storage.space();` now `buf[..frame.len()].copy_from_slice(&frame);`
mod.rs:2152 is a seventh stale number that escapes even that relaxed check, because the text at that line happens to be identical to the text at the line it used to name.
Suggested direction
Key the drift identity per span, not per tuple: a span that is byte-identical between base and head is still subject to rule 2 even when a sibling in the same citation moved. Element-wise, (path, span) rather than (path, tuple(spans)).
Note the existing comment at :530-532 gives a genuine reason for parsing spans rather than comparing their text — it makes 3/6 and 3, 6 the same citation, which they are. A per-span key preserves that property; it only stops one moved element from covering for the others.
Relationship to #1447
Distinct. #1447 is about a span number being reused across bullets, producing a false positive with no correct fix. This is the opposite failure: a false negative, where a partial correction suppresses true drift. A fix for one does not address the other, though both live in the same identity computation.
Activity
FlorentinDUBOIS commentedon Sep 23, 2026
Measured case: a clean merge producing 14 silently wrong citations
Rebasing #1460 onto
mainproduced a concrete instance of this gap, worth recording because thecitations involved carried no conflict marker — so nothing prompted a human to look at them.
Both sides had independently inserted a line into
lib/src/protocol/mux/mod.rs:maininsertedmod h2_scheduler;at line 146, shifting every citation below it by +1.A citation below both anchors —
mod.rs:1341at the merge base — was therefore rewritten tomod.rs:1342on both sides. Git saw identical text and merged it cleanly. The correct value in themerged tree is
mod.rs:1343: both shifts apply.14 citations landed wrong this way — 13 in
lib/src/protocol/mux/LIFECYCLE.md, 1 indoc/testing.md, every one off by exactly 1. They were found only by manually re-aligning 123citations across 5 docs against their merge-base counterparts.
Why the gate passed
Rule 1 passes:
mod.rs:1342resolves to a real, non-blank line. It is simply the wrong one.Rule 2 never runs on it. The drift identity is the whole
(path, spans)tuple:Because the changeset did change
1341→1342, the tuple differs from the base tuple and thecitation is exempted as "re-anchored". The gate never asks whether
1342is correct.The general shape: a change detector cannot detect a wrong value that was changed. A clean merge
is the worst case for it, because the clean merge is caused by both sides making the same partial
correction.
Verified after repair, at
4d87d9c8mod.rs:1343isif self.frontend.readiness().event.is_hup(), andLIFECYCLE.md:270now citesmod.rs:1343.mod.rs:673isstream.metrics.reset();, andLIFECYCLE.md:350now citesmod.rs:673.check_doc_citations.py --root .and--base 3e9c271cboth exit 0 on the merged tree (222citations, 16/16 pins verbatim) — before and after the repair, which is the point.
Note for whoever fixes this
A uniform-offset repair is not available: on this rebase,
difflib.SequenceMatcher(autojunk=False)line alignment between base and merged tree gave
h2.rs35 blocks / 20 distinct shifts,mod.rs7/6,
h1.rs10/8,router.rs5/4,stream.rs10/9,shared.rs4/3. There is no single+N.FlorentinDUBOIS commentedon Sep 23, 2026
Correction to the example in my previous comment — the mechanism stands, but I picked the one
citation in the set that rule 1 does catch.
At
4d87d9c8,lib/src/protocol/mux/mod.rs:1342is an empty line:So for that citation rule 1 fires on the blank line, and in fact that is how the class was noticed
at all. My claim that rule 1 passed on it was wrong.
The correct example for "every rule passes" is a sibling from the same batch, one line group earlier:
Base cited
671, both sides shifted it to672, the truth is673.mod.rs:672isstream.forget_upstream_replay();— real, non-blank, and wrong. Rule 1 passes. Rule 2 exempts itbecause the changeset changed the
(path, spans)tuple. Nothing reports it.It is a sharper example than the one I gave, because
forget_upstream_replayis a method the branchitself introduced — 0 occurrences in
mod.rsatmain@3e9c271c, 3 at4d87d9c8— so the wrong lineis code that did not exist on either side of the comparison the gate performs.
The counts and the rest of the analysis are unchanged: 14 citations landed wrong, and the blank-line
coincidence is the only reason any of them surfaced. A repair for this issue should not assume rule 1
provides a backstop — it caught roughly one in fourteen here, by luck of alignment.
fix(ci): bind and check a citation's bare `:NNN` continuation
fix(ci): bind and check a citation's bare `:NNN` continuation
fix(ci): bind and check a citation's bare `:NNN` continuation (#1468)
fix(ci): key the drifted-citation exemption per span, and count the s…
fix(ci): key the drifted-citation exemption per span, and count the s…
fix(ci): key the drifted-citation exemption on the cited line, not it…