Repository navigation
fix(docs): link ADRs from doc comments by absolute URL - #2392
Conversation
Rustdoc resolves a relative Markdown link against the rendered page, so `../../../adr/038-….md` became `docs.rs/adr/038-….md` on docs.rs. Point all 20 doc-comment ADR links at github.com/decdn/decdn/blob/main/adr/. Add check-doc-links.sh (pre-commit hook + packaging CI step) that fails on any relative file link in a crate doc comment, since rustdoc's broken-link lint checks intra-doc links only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Code Coverage OverviewLanguages: Rust, Solidity Rust / code-coverage/cargo-llvm-covThe overall line coverage in commit 665d63d in the Solidity / code-coverage/forgeThe overall line coverage in commit 665d63d in the Updated |
Gas snapshotNo gas changes vs base. |
There was a problem hiding this comment.
🟡 Changes recommended
The change is correct and verified, but the new guard's regex only catches .//../-prefixed relative links, narrower than its documented scope, which is worth the author's consideration before approval.
1 open finding
What changed in this PR
This PR fixes broken documentation links on docs.rs. Doc comments previously linked ADRs by relative path (e.g. ../../../adr/038-….md); rustdoc copies the target verbatim, so the browser resolves it against the rendered page and 404s on docs.rs. The fix rewrites all such links to absolute https://github.com/decdn/decdn/blob/main/adr/… URLs and adds a guard so the regression cannot recur. It is a docs/tooling hygiene change with no runtime behavior impact.
Changes:
- Converts 20 relative ADR links across 13 crate source files to absolute GitHub URLs.
- Adds
.github/scripts/check-doc-links.sh, which fails on any](./or](../link incrates/**/*.rs(rustdoc's broken-link lint only covers intra-doc links). - Wires the script as a
doc-linkspre-commit hook and a step in thepackagingCI job.
| File | Description |
|---|---|
.github/scripts/check-doc-links.sh |
New guard: git-greps crate .rs files for relative markdown links and fails. |
.github/workflows/ci.yml |
Adds the guard as a step in the packaging job. |
.pre-commit-config.yaml |
Adds the doc-links pre-commit hook. |
crates/reputation/src/local.rs |
ADR 030 link → absolute URL. |
crates/node/src/dht/mod.rs |
ADR 022 link → absolute URL. |
crates/incentive/src/store.rs |
ADR 003 link → absolute URL. |
crates/incentive/src/lane.rs |
ADR 003 link → absolute URL. |
crates/e2e/src/chain.rs |
ADR 014 link → absolute URL. |
crates/common/src/cli/bundle.rs |
appendix-bundles link → absolute URL. |
crates/cli/src/commands/manifest.rs |
appendix-bundles link → absolute URL. |
crates/cache/src/range_pull.rs |
ADR 038 link → absolute URL. |
crates/cache/src/origin/mod.rs |
ADR 037 links (×2) → absolute URLs. |
crates/cache/src/origin/fs.rs |
ADR 037 links (×2) → absolute URLs. |
crates/cache/src/engine.rs |
ADR 011 / 038 links (×3) → absolute URLs. |
crates/bao-range/src/origin_seed.rs |
ADR 037 links (×2) → absolute URLs. |
crates/bao-range/src/lib.rs |
ADR 037 / 038 links (×3) → absolute URLs. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-Authored-By: Claude Opus 5.5 <[email protected]>

Problem
Doc comments linked ADRs by relative path, e.g.
../../../adr/038-bao-verified-range-streaming.md. Rustdoc emits the target unchanged and the browser resolves it against the rendered page, so on docs.rs the link becomeshttps://docs.rs/adr/038-bao-verified-range-streaming.md(404). Seen on https://docs.rs/decdn-bao-range/0.0.1/decdn_bao_range/.Fix
https://github.com/decdn/decdn/blob/main/adr/…..github/scripts/check-doc-links.shfails on any](./or](../link incrates/**/*.rs. Rustdoc's broken-link lint only checks intra-doc links, so nothing else catches these. Wired as thedoc-linkspre-commit hook and a step in thepackagingCI job.Verification
CARGO_BUILD_WARNINGS=deny cargo doc --workspace --no-deps --document-private-itemspasses; rendereddecdn_bao_range/index.htmlcarries the GitHub hrefs.origin/main.docs.rs pages for 0.0.1 are immutable; the fix lands there with the next published version.
🤖 Generated with Claude Code