Skip to content

docs: make published crate-root docs read for crates.io/docs.rs users - #2447

Merged
thiras merged 2 commits into
mainfrom
docs/2442-crate-root-docs
Oct 12, 2026
Merged

thiras merged 2 commits into
mainfrom
docs/2442-crate-root-docs

Conversation

@thiras

@thiras thiras commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Rewrites the published crate roots so they read well to someone who lands on docs.rs or crates.io, using decdn-client's root as the model.

  • protocol: ALPN table, module map, how frames and extensions work, and a compiled encode_message/decode_message round-trip doctest.
  • incentive: module map grouped by area, a compiled voucher sign/verify doctest, and a short section on who drives settlement. Adds [package.metadata.docs.rs] features = ["redb"] and #![cfg_attr(docsrs, feature(doc_cfg))], so buyer_pool_redb and buyer_pool_table show up on docs.rs with feature badges.
  • node: says it is the decdn-node daemon's library with no stability promise, adds a module map, and makes the links absolute.
  • reputation: replaces the dangling "ADR 008 §14a.3" reference (in lib.rs and local.rs) with the current fact: scores live in memory only.
  • bao-range, cache, config-types: entry-point or type tables. Drops the changelog voice and the compat-shim wording. Issue numbers come out of the item docs and comments in their lib.rs too.
  • Cargo description: node, bao-range, config-types, incentive, and e2e now say what the crate is, with no issue numbers.
  • READMEs keep the shared boilerplate. Their summary paragraph matches the crate-root purpose, with absolute ADR links. Each README stays separate from its lib.rs, with no include_str!, so the //! tables can keep intra-doc links.

Out of scope, as the issue says: decdn-client's item-level docs, which still cite issue numbers in lib.rs. So the issue's literal grep … crates/*/src/lib.rs still matches there. Also, used to <verb> is valid prose, so this PR doesn't treat it as changelog voice.

Test plan

  • CARGO_BUILD_WARNINGS=deny cargo doc --workspace --no-deps --document-private-items
  • CARGO_BUILD_WARNINGS=deny cargo doc -p <crate> --no-deps for each of the nine crates (public view)
  • RUSTC_BOOTSTRAP=1 RUSTDOCFLAGS="--cfg docsrs" cargo doc -p decdn-incentive --features redb --no-deps: the redb / buyer-store-core badges render
  • cargo test --doc -p decdn-protocol -p decdn-incentive
  • cargo clippy --workspace --all-targets --all-features -- -D warnings, cargo fmt -- --check
  • cargo publish --workspace --locked --dry-run
  • No #NNN / historically in the in-scope lib.rs files, no repo-relative //! links, no issue numbers in any description
  • No pub use changes, so the public-API snapshots are unchanged

Closes #2442

🤖 Generated with Claude Code

Rewrite the crate-root docs of decdn-protocol, -incentive, -node,
-reputation, -bao-range, -config-types and -cache for a reader who lands
on docs.rs. Each opens with a one-sentence purpose and a module or
entry-point table modelled on decdn-client's, links ADRs by absolute
URL, and drops issue numbers and history voice.

- protocol: ALPN table, module map, frames-and-extensions model, and a
  compiled frame round-trip example.
- incentive: module map by area, a compiled voucher sign/verify example,
  and who drives settlement. docs.rs builds the `redb` feature, and
  `doc_cfg` badges render under `cfg(docsrs)`.
- reputation: replace the dangling ADR 008 §14a.3 reference (here and in
  local.rs) with the present fact: scores live in memory only.
- bao-range, cache: entry-point tables, and the item docs and comments
  in their lib.rs lose their issue numbers.
- Package descriptions for node, bao-range, config-types, incentive and
  e2e say what the crate is, with no issue numbers.
- READMEs keep the shared boilerplate; their summary matches the new
  crate-root purpose, with absolute ADR links.

decdn-client's item-level docs still cite issue numbers; they are out of
scope here.

Closes #2442

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 12, 2026 18:07
@thiras thiras self-assigned this Oct 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The docs.rs configuration does not currently produce the promised feature badges, and the changelog overstates the table coverage.

2 open findings
What changed in this PR

Reworks published crate documentation for docs.rs and crates.io users.

Changes:

  • Adds crate-root API maps, absolute ADR links, and protocol/payment doctests.
  • Clarifies crate purposes in READMEs and package descriptions.
  • Configures docs.rs to include incentive buyer-store modules.
File Description
CHANGELOG.md Records the documentation overhaul.
crates/​bao-range/​Cargo.toml Improves package description.
crates/​bao-range/​README.md Clarifies verified-range functionality.
crates/​bao-range/​src/​lib.rs Adds entry-point documentation.
crates/​cache/​src/​lib.rs Adds cache API guidance.
crates/​common/​README.md Uses an absolute ADR link.
crates/​common/​src/​lib.rs Removes issue-history wording.
crates/​config-types/​Cargo.toml Improves package description.
crates/​config-types/​src/​lib.rs Adds a config-type map.
crates/​e2e/​Cargo.toml Removes issue-history wording.
crates/​e2e/​src/​lib.rs Simplifies fixture documentation.
crates/​incentive/​Cargo.toml Configures docs.rs features.
crates/​incentive/​README.md Clarifies payment-layer scope.
crates/​incentive/​src/​lib.rs Adds module guidance and a voucher doctest.
crates/​node/​Cargo.toml Corrects the daemon description.
crates/​node/​src/​lib.rs Documents daemon modules and stability.
crates/​protocol/​src/​lib.rs Adds protocol maps and a round-trip doctest.
crates/​reputation/​README.md Documents in-memory scoring.
crates/​reputation/​src/​lib.rs Replaces the dangling ADR reference.
crates/​reputation/​src/​local.rs Clarifies restart behavior.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread CHANGELOG.md Resolved
Comment thread crates/incentive/src/lib.rs Resolved
@github-code-quality

Copy link
Copy Markdown

Code Coverage Overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

The overall line coverage in commit ccc810d in the docs/2442-crate-root... branch remains at 75%, unchanged from commit 2bec66c in the main branch.

@thiras
thiras merged commit d898a53 into main Oct 12, 2026
33 checks passed
@thiras
thiras deleted the docs/2442-crate-root-docs branch October 12, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: make published crate-root docs read for crates.io/docs.rs users

2 participants