docs: gate rustdoc, and document the public API it was hiding - #65
Merged
Conversation
The issue said "about 42 undocumented public items". It is **237**, across eight library crates: bench 74 · report 50 · prune 40 · space 29 · build 22 · model 15 metal 4 · search 3 I undercounted by 5.6x, and the reason is instructive: I counted items and missed *fields*. 144 of the 237 are public struct fields -- and those are the ones that matter most here, because they are the wire formats. Every field of `Report`, `Results`, `BenchPlan`, `Summary` and `FindingsDoc` is something a consumer reads out of JSON and has to interpret correctly. Documenting `Summary::median_ms` is not ceremony; it is the difference between a reader knowing that ranking uses the median rather than the mean, and guessing. The gate itself cost nothing: `cargo doc --workspace --no-deps` was already at zero warnings, so this is `#![warn(missing_docs)]` in the eight library crates plus a `docs` recipe in `just ci`. It earned its keep immediately by failing on two broken intra-doc links in this very commit -- one pointing at `read_findings`, a function whose real name is `read_stream`, and one at a private variant. A doc comment that names a function which does not exist is worse than none, and nothing before this would have said so. Notes worth keeping rather than burying: - `launchbound-prune` exports `FindingsDoc` but not `read_stream` or `ReadError`, so the entry point for reading analyzer output is unreachable from outside the crate. Documented as internal rather than quietly exported: adding public API is a deliberate act now that the semver gate exists, and it does not belong in a docs commit. - `device()` gains a runnable example, per the issue's ask for one on the public entry points. Verified the gate catches a regression: appending an undocumented `pub fn` produces "error: missing documentation for a function" and fails the build. Closes #57 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
1 task
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.
Milestone 2.2.0, issue #57 — the last one.
The count was wrong by 5.6×
The issue said "about 42 undocumented public items". It is 237:
launchbound-benchlaunchbound-reportlaunchbound-prunelaunchbound-spacelaunchbound-buildlaunchbound-modellaunchbound-metallaunchbound-searchThe reason I undercounted is instructive: I counted items and missed fields. 144 of the 237 are public struct fields — and those are the ones that matter most, because they are the wire formats. Every field of
Report,Results,BenchPlan,SummaryandFindingsDocis something a consumer reads out of JSON and has to interpret. DocumentingSummary::median_msis not ceremony; it is the difference between a reader knowing that ranking uses the median rather than the mean, and guessing.By kind: 144 struct fields, 29 structs, 25 variants, 15 methods, 10 associated functions, 9 enums, 4 functions, 1 type alias.
The gate found bugs in the commit that added it
cargo doc --workspace --no-depswas already at zero warnings, so the gate cost nothing to turn on —#![warn(missing_docs)]in the eight library crates plus adocsrecipe injust ci.It failed immediately on two broken intra-doc links I had just written: one to
read_findings, a function whose real name isread_stream, and one to a private enum variant. A doc comment naming a function that does not exist is worse than no comment, and nothing before this would have said so.Two things found while writing it
launchbound-pruneexportsFindingsDocbut notread_streamorReadError. The entry point for reading analyzer output is unreachable from outside the crate, so a consumer holding aFindingsDoccannot use the function that produces one from a real run. I documented it as internal rather than quietly exporting it — adding public API is a deliberate act now that ci: gate the public API against the published release, and stop the pins drifting #63's semver gate exists, and it does not belong in a docs commit. Worth its own issue if you want it exported.device()gains a runnable example, per the issue's ask for one on the public entry points.Verified
Appending an undocumented
pub fnproduceserror: missing documentation for a functionand fails the build.just cigreen (now withdocsbetweentestanddeny).Closes #57
Signed-off-by: Vyncint Ng 115854244+vyncint@users.noreply.github.com