Skip to content

ci(citations): scan the 42% of citations the drift gate could not see, non-blocking - #7623

Merged
oferchen merged 2 commits into
masterfrom
ci/citation-drift-widen-scan
Sep 2, 2026
Merged

oferchen merged 2 commits into
masterfrom
ci/citation-drift-widen-scan

Conversation

@oferchen

@oferchen oferchen commented Sep 2, 2026

Copy link
Copy Markdown
Owner

The hole

tools/ci/citation_drift_audit.py filtered candidate lines with:

if "upstream" not in ln.lower():
    continue

Citations written as bullets under a /// # Upstream Reference heading carry
that word on the heading line and never on the citation lines. The entire
documentation style was therefore invisible to the gate.

Measured counts (this branch's base, dcb8d6f0, over crates/*/src/**/*.rs)

citations files
total file.c:NNN 12,596 2,570 scanned
visible to the gate 7,356
invisible 5,240 (42%) 748

Running the gate's own anchor machinery over each half:

population string-anchored suspected-drift unresolved
blocking (word upstream on the line) 587 11 (2%) 330
non-blocking (newly reached) 482 373 (77%) 392

Discrepancy to flag. The scoping figures I was handed for the invisible half
were 535 anchored / 386 drift. I measure 482 / 373. The 12,596 / 7,356 /
5,240 / 748 figures reproduce exactly, so the divergence is in the anchor pass,
not the census. I reproduced my number two independent ways - the widened script,
and the unmodified pre-change script with its filter predicate inverted
(if "upstream" in ln.lower(): continue) - and both give 482 / 373 on this base.
I have not adopted the 535 / 386 figures; they most likely predate some commit on
current master.

What this changes

The filter is now .c:, which is exactly the substring both CITE and RANGE
already require, so it provably cannot skip a line either regex could have
matched. The old predicate survives verbatim as the split between two tallies
rather than as a skip.

Stays blocking, unchanged: the upstream-bearing population. Only that
tally reaches counts, and only counts reaches --ratchet and
--write-baseline. A backwards range is still a hard failure there and still
not ratcheted.

Proof the widening perturbed nothing: the per-crate blocking output is
byte-for-byte identical before and after on this tree (587 anchored, 11 drift,
ratchet OK). diff of the two runs reports exactly one line moved - the
ratchet OK verdict now prints after the new report instead of before it.

Newly reported, non-blocking: the 5,240 citations the gate could not see,
as a $GITHUB_STEP_SUMMARY table plus a ::warning carrying the number:

::warning title=Citation drift (non-blocking)::373 suspected-drift finding(s)
among 482 string-anchored citations that the blocking gate cannot see, out of
5240 such citations in 2570 file(s). The blocking population is separate and
unaffected: 11 of 587 anchored, ratcheted. Not baselined and not gating.

The step summary renders the two populations as two separately headed tables
(### 1. BLOCKING, ### 2. NON-BLOCKING), each stating its own citation count,
anchored count, and drift count, so one can never be read as the other. An
inverted range reached only by the widened scan is reported rather than failed,
because widening a filter must not redden a tree that was green a commit ago.

Why no baseline

Deliberate, and the point of the design. A suppression file holding ~373
findings nobody has reviewed reads as "accepted" without anyone having accepted
them, and the one new drift that matters would land inside a number that large
and never be seen again. A ratchet is only honest when its contents have been
adjudicated; these have not. A counted warning keeps the population visible and
keeps the reader's eye on the delta.

Not readable as clean when it did not run

Two guards, because a success conclusion conflates PASSED with DID-NOT-RUN:

  • the report always prints the size of both populations and the file count,
    so "no drift found" is distinguishable from "nothing examined";
  • a whole-tree run whose widened scan reaches zero citations now refuses
    outright
    . Thousands exist today, so it cannot fire on a healthy tree; if the
    filter ever narrows back, the section would otherwise print an empty table.

The report is emitted before any exit path decides the status, so a run that
hard-fails on the blocking population still publishes it.

Non-vacuity proof

tools/tests/test_citation_drift_audit.py (10 tests, runs in the blocking
tools unit tests job) builds its own workspace and its own upstream C source,
so it needs no pinned tarball.

Each assertion was run against the pre-change script (restored from HEAD)
and then against the post-change script:

pre-change post-change
all 10 4 FAIL, 5 ERROR, 1 pass 10 pass

The nine that fail pre-change include the load-bearing one: a fixture whose only
citation is a /// # Upstream Reference bullet reports string-anchored=0 under
the old filter and string-anchored=1 suspected-drift=1 under the new one. The
end-to-end subprocess tests fail pre-change too - no ::warning is emitted, and
the narrow-filter refusal does not exist.

The tenth, test_the_bullet_is_not_counted_in_the_gating_population, passes both
ways by design and says so in a comment: it is the regression pin on the half
that must not move, and a pin that only begins to hold after the change would not
have caught the change doing damage.

YAML was validated by yaml.safe_load-ing the committed
.github/workflows/citation-drift.yml, extracting the audit step's run block
back out of the parsed document, and executing that exact string - not a
retyped copy. It exits 0 and emits the warning. Confirmed the job and the step
carry no if: guard.

Second commit

fix(protocol): retargets four stale citations in
crates/protocol/src/xattr/wire/encode.rs, each re-read against
target/interop/upstream-src/rsync-3.5.0/. Three are 3.4.4->3.5.0 shifts
(compat.c:824->835, compat.c:824-825->835-836, xattrs.c:275-281->287-293).
checksum.c:588-597 is not a shift: in 3.4.4 that range starts inside the
CSUM_XXH3_64 case and ends on the case CSUM_MD5: label, so an ordinal
retarget would have carried a wrong start forward; the bullet describes the
CSUM_MD5 arm of sum_init(), which is checksum.c:615-617. All four were in
the newly visible population - the gate had never looked at them. protocol
audits 65 anchored / 0 blocking drift before and after; its non-blocking drift
falls 56 -> 54.

The audit filtered candidate lines with `if "upstream" not in ln.lower()`.
Citations written as bullets under a `/// # Upstream Reference` heading carry
that word on the heading line and never on the bullets, so the entire
documentation style was invisible to the tool. Measured over `crates/*/src`:
12,596 `file.c:NNN` citations, 7,356 visible to the gate, 5,240 (42%) invisible,
across 748 files. Running the gate's own anchor machinery over the invisible
half alone finds 482 string-anchored citations and 373 suspected drift (77%),
against 587 anchored and 11 suspected drift in the half it does see.

The filter is now `.c:`, exactly the substring both `CITE` and `RANGE` already
require, so it cannot skip a line either regex could have matched. The old
predicate survives verbatim as the SPLIT between two tallies rather than as a
skip: every line that used to be scanned still lands in the blocking tally, and
only lines that used to be dropped land in the new one.

What still gates is unchanged. Only the blocking tally reaches `counts`, and
only `counts` reaches `--ratchet` and `--write-baseline`; a backwards range is
still a hard failure in that population and still not ratcheted. The per-crate
blocking output is byte-identical before and after the widening on the current
tree - 587 anchored, 11 suspected drift, ratchet OK - and the only change to the
run's output ordering is that the report is emitted before the ratchet prints
its verdict.

What is new is a report, not a gate: a `$GITHUB_STEP_SUMMARY` table for each
population and a `::warning` carrying the newly visible count. An inverted range
reached only by the widened scan is reported rather than failed, because
widening a filter must not redden a tree that was green a commit ago.

No baseline is written for the new half and none should be. Several hundred
unreviewed findings frozen into a suppression file read as "accepted" without
anyone having accepted them, and the one new drift that matters would land
inside a number that large and never be seen again. A count to work down is the
right shape here; a ratchet is not.

The report states the size of BOTH populations, and a whole-tree run whose
widened scan reaches zero citations now refuses outright, because an empty
non-blocking section is otherwise indistinguishable from a clean one - the
failure mode this audit already had once, when it collapsed every crate name to
the literal `crates` and printed a clean 0/0 for months.

tools/tests/test_citation_drift_audit.py builds its own workspace and its own
upstream C source, so it needs no pinned tarball. Nine of its ten tests fail
against the pre-widening script; the tenth pins the blocking half and passes
both ways by design, which is what a regression pin is for.
All four sit under a `/// # Upstream Reference` heading or in prose that never
repeats the word "upstream", so the drift gate had never looked at them. Each
was re-read against the pinned tree at
target/interop/upstream-src/rsync-3.5.0/:

  compat.c:824    -> 835      `xattr_sum_nni = parse_csum_name(NULL, 0);`
  compat.c:824-825 -> 835-836 the nni/len pair, +11 lines since 3.4.4
  xattrs.c:275-281 -> 287-293 the `MAX_FULL_DATUM` abbreviation block,
                              `sum_init(xattr_sum_nni, checksum_seed)` now at
                              xattrs.c:289, +12 lines since 3.4.4

`checksum.c:588-597` is not a shift. In 3.4.4 that range starts inside the
`CSUM_XXH3_64` case and ends on the `case CSUM_MD5:` label, so an ordinal
retarget would have carried a wrong start forward. The bullet describes the
`CSUM_MD5` arm of `sum_init()`, which in 3.5.0 is checksum.c:615-617
(`md5_begin(&ctx_md); break;`) - the three lines that actually show the seed
being ignored.

Comment text only. The blocking population is untouched: protocol audits
65 string-anchored / 0 suspected drift before and after.
@github-actions github-actions Bot added the ci label Sep 2, 2026
@oferchen
oferchen merged commit 3d657ea into master Sep 2, 2026
73 checks passed
@oferchen
oferchen deleted the ci/citation-drift-widen-scan branch September 2, 2026 14:53
oferchen added a commit that referenced this pull request Sep 2, 2026
… merged PRs (#7634)

* docs(rustdoc): reach the public items rustdoc could not see, and gate the class

Two halves of the same question - is what a public item says actually reachable
from `cargo doc`?

Half 1: seven `//` comment blocks documented a `pub` item, so their text never
reached the generated docs. Found positionally, not by content: a `//` run whose
next non-attribute line declares a `pub` item. A census keyed on comment CONTENT
is false-positive dominated; this one is mechanical.

Nine sites matched; two are DELIBERATELY left as `//`, because they document the
`#[cfg_attr]` / `#[allow]` attribute directly beneath them rather than the item -
`local_copy/overrides.rs` and `local_copy/plan/report.rs`. Promoting those would
attach a lint rationale to a public surface as if it described the surface.

Text is preserved verbatim, upstream citations included (`generator.c:2149` on
the obstacle module). The only rewrite is `socket_options/consts.rs`, where one
group note covered two constants: split per item, matching the file's own house
style where every other const already carries `///`.

Half 2: five intra-doc links could not resolve in a DEFAULT build, and the
existing gate is structurally unable to see them.

  crates/fast_io/src/lib.rs, ewma.rs (x4)  -> `adaptive_dispatch`, gated by the
                                              off-by-default
                                              `adaptive-basis-dispatch` feature
  crates/rsync_io/.../sync_bridge.rs       -> `crate::channel_adapter`, gated by
                                              the off-by-default `async-ssh`
                                              feature
  crates/fast_io/src/confinement.rs        -> `PinnedRoot`, a PRIVATE struct

plus one already on the branch in `module_list/types.rs`, where the link was
`Transport::Quic` (the `quic` feature) and its surrounding prose still described
the variant as unbuilt.

Every crate denies `rustdoc::broken_intra_doc_links`, so each of these is a hard
`cargo doc` failure, not a warning. MEASURED on the pristine base:

    cargo doc --no-deps --workspace   ->  7 errors, `fast_io` and `rsync_io`
                                          could not be documented
    cargo doc --no-deps --workspace --all-features  ->  clean

That gap is the whole point. Under `--all-features` the gated items EXIST, so
the link resolves and the gate is green; in a default build the item is not
compiled at all. `ci.yml`'s `rustdoc-links` job runs only `--all-features`,
deliberately mirroring `pages.yml` - which is right for the question Pages asks
and cannot ask this one. So the fix is paired with a SECOND step on default
features, and neither subsumes the other: `crates/fast_io/src/io_uring` is
`cfg(all(target_os = "linux", feature = "io_uring"))` and only the all-features
run compiles it.

The names stay in backticks with the reason stated at each site, rather than
being deleted or the links made conditional - the prose still says what it said,
and the next reader learns why it is not a link.

After: both invocations document all 25 crates cleanly, 0 errors. fmt clean;
clippy on the five touched crates reports no new diagnostics.

* docs(changelog): record the ten pull requests merged since the last sweep

#7624 brought the Unreleased section up to #7620 and then stopped being true:
#7621-#7632 landed after it, of which #7624 is itself that changelog pass and
#7628 was never merged. Ten entries were missing.

Each is placed in the subsection its change belongs to rather than appended in
number order, and #7625 is SPLIT across two, because it is two changes: wiring
`--force` is a receiver fix, and the synthetic-transfer-root guard that wiring
made necessary is a peer-supplied input bound. Filing it once under either
heading would have hidden whichever half the reader was looking for.

  Security / peer-supplied input bounds   #7625 (guard half), #7630
  Fixed / transfer and receiver           #7622, #7625 (--force half), #7627
  Fixed / daemon                          #7629
  Testing and CI                          #7621, #7623, #7632
  Documentation                           #7626, #7631

Wording is taken from each merge commit's own body, not from its title - the
titles compress away the part a reader needs. #7629's title says "keep a dead
name converter apart from an unknown name"; what makes it worth an entry is that
five outcomes collapsed into one `None` and the merge failed OPEN on exactly the
mechanism an operator installs to take ownership decisions away from the peer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant