docs: real output for the latency example, and a count check that bites - #947
Merged
Conversation
Follow-up to #946, which landed with three documentation problems. Two are its own and one is ours. The example README's output block was not real. Its header line was copied verbatim from `showcase/latency/README.md`, but `format_latency_report` sizes the label column to the widest label — 27 characters there, 32 here — so every numeric column sat five characters off, and the elided `...` cells moved them further. Replaced with a captured run, plus the caveat that says which columns are a reading of one machine. That also retires the paragraph hedging about a `same-cycle` reconciliation the reader will never see: `stamp_precise` re-reads the clock per stage, so all five observations are measured on any normal clock, and the pasted run shows `count 5` on every row. The snippet named two functions, `normalize` and `decide`, that do not exist — `main.rs` uses inline closures, and those closures are the interesting half of the example, since `Traced::with_latency` is what carries the stamps across a `map` while the payload changes type. Pasted the real ones and said so. Then ours. #945 added a sentence to README.md claiming a count "asserted in CI by scripts/check-example-docs.sh, so it cannot drift" — but that script only ever *printed* the count; it compared it to nothing (#939). #946 duly added a 48th target under a README still saying 47, in a different hunk, so it merged green. So make the claim true, and then stop making it. The script now parses the numbers back out of the README sentence and fails when they disagree with the manifest, while the sentence itself says only what a reader wants — how many examples there are. Keeping the count honest is the script's business, not something to explain in the README's opening lines. The sentence stays the single source of truth, so there is no second constant to keep in sync, and deleting it to dodge the check is itself a failure with its own message. Asserting it immediately found the other half of the drift: the parenthetical said 38 directories when the manifest declares 43, because #945's count included `[[bench]]` paths. Closes #939. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016E4AhS4mKjvR8HmS6cDx7k
0-jake-0
force-pushed
the
claude/review-mergeable-prs-b72ga6
branch
from
August 30, 2026 11:11
d7217fc to
d81de45
Compare
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.
What this changes
Follow-up to #946, merged as 6bdd82d. Three documentation fixes — two of them that PR's, one of them ours.
The example's output block was not real. Its header line was copied verbatim from
showcase/latency/README.md, butformat_latency_reportsizes the label column to the widest label — 27 characters there,received -> decided (end to end)is 32 here — so every numeric column sat five characters off, and the elided...cells moved them further again. Replaced with a captured run, plus the caveat naming which columns are a reading of one machine. That retires the paragraph hedging about asame-cyclereconciliation the reader will never see:stamp_precisere-reads the clock per stage, so all five observations get measured on any normal clock, and the pasted run showscount 5on every row.The snippet named two functions that do not exist.
main.rsuses inline closures, and those closures are the interesting half of the example —Traced::with_latencyis what carries the stamps across amapwhile the payload changes type fromu64tobool. Pasted the real ones and added a sentence saying what they demonstrate. Also cross-linkedshowcase/latencyfrom thestampvsstamp_preciseparagraph, since that example is the cross-process case the paragraph describes.And ours: the example count check did not check anything. #945 added a sentence to
README.mdclaiming a count "asserted in CI byscripts/check-example-docs.sh, so it cannot drift" — but that script only ever printed the count. It compared it to nothing, which is #939, still open. #946 duly added a 48th target under a README still saying 47, in a different hunk, and merged green.So the script now parses the numbers back out of the README sentence and fails when they disagree with the manifest — and the sentence goes back to saying only what a reader wants, which is how many examples there are. How the number is kept honest is the script's business and does not belong in the README's opening lines; the sed pattern is the contract between the two, and it is documented as such where it lives. The sentence remains the single source of truth, so there is no second constant to keep in sync, and deleting it to dodge the check is itself a failure with its own message.
Turning it on immediately found the other half of the drift: the parenthetical claimed 38 directories where the manifest declares 43. #945's figure had counted
[[bench]]paths alongside the[[example]]ones.Why
#946 is a good example and the code needed nothing, but
CLAUDE.mdis explicit that sample output must be real — "Several adapter READMEs were written from invented output and had to be corrected against the actualprintln!s; do not repeat that." Merging it and fixing the docs here was the cheaper path than a round trip with the contributor, especially for the half that was our churn landing under their branch.Closes #939.
How it was verified
scripts/check-example-docs.sh— passes:OK — 48 example targets in 43 directories, all documented and indexedbash -n scripts/check-example-docs.shcargo run -p wingfoil --example latency— the block in the README is that run's stdout, pastedcargo fmt --all+cargo clippy --workspace --lib --binsvia the pre-commit hookgit diff --checkwc -loutput is piped throughtr -dbefore it is compared, because BSDwcpads with spaces and these are string comparisons now rather than justechoarguments.Notes for the reviewer
cargo test -p wingfoilfails on this machine attests/trybuild/must_use_combinators.rswith a snapshot mismatch under rustc 1.94.1. It fails identically on a cleanorigin/mainworktree — I checked before pushing — so it is the local-toolchain gapCLAUDE.mddescribes rather than anything in this diff, and the snapshot is correct for the rustc CI pins. This PR touches no Rust. The contributor on #924 hit the same wall and reported it the same way, which suggests it is worth an issue of its own.🤖 Generated with Claude Code
https://claude.ai/code/session_016E4AhS4mKjvR8HmS6cDx7k