T11 Deny missing_docs and document the public API
Question
The standard denies missing_docs, so every public item carries a doc comment,
and the doctest layer (T04) turns examples in those comments into tests. Cerebro
has ~261 pub items; unknown how many already carry docs. Per crate: add
doc comments, and where a public item is worth demonstrating, add a ///
example (which the doctest layer then runs).
Exit predicate
missing_docs denied in [workspace.lints.rust]; cargo doc --workspace clean;
just doctest (T04) runs examples and passes. Public items that genuinely have
no example stay prose-only.
Resolution
missing_docs = "deny" is live in [workspace.lints.rust]; the ticket’s
“~261 pub items” guess ran low: rustc reported 309 findings across
all targets (lib, bin, and test crate roots). Fixed at the declaration sites,
no suppressions:
- cerebro-core carried 105 (struct fields mostly, plus the four collectors
module heads and the crate header). cerebro-tui carried 137, dominated by
the 68-finding
Actionenum; each variant now documents what it does, verified against the app and view handlers. cerebro-mcp carried 33 (JSON-RPC wire semantics in protocol.rs, the handler dispatch surface). The cerebro binary needed crate headers formain.rsand its integration test root;missing_docsfires on every crate root, binary or test, not just libraries. - Module docs go on
pub moddeclarations only where the module file has no//!header. Where both existed, rustdoc concatenated the two into one block and resolved links in the parent scope, which is how[sync_text]and[slugify]came to report “no item in scope”: the declaration-site copy was dropped in favor of the header. - Pre-existing rustdoc debt surfaced by the now-clean
cargo doc --workspace: threeprivate_intra_doc_linksfindings (public docs linking the privateFALLBACK,VENDORED_DIRS,toast_layout) and oneredundant_explicit_links. All four de-linked or reworded, zero allows. - Examples: the exit predicate asks for
///examples where an item is worth demonstrating. Two added to cerebro-core’s pure functions (parse_manual_notes,Cache::new);slugifyalready had one. The doctest layer goes from 1 example to 3, all passing. TUI rendering is snapshot-tested, not doctested; its docs stay prose-only, as the ticket allows.
Evidence: cargo check --workspace --all-targets and
cargo clippy --workspace --all-targets -- -D warnings exit zero with the
deny active; cargo doc --workspace --no-deps builds with no warnings;
just test reports 415 run, 415 passed, 0 skipped; just doctest runs 3
examples, 3 pass; cargo fmt --all --check clean. During the work the
cucumber suite caught an attribute an editing session dropped mid-task
(View::Todos’s strum serialize), proving the red-green wiring works on
this ticket’s own changes.