Skip to content

fix(docs): link ADRs from doc comments by absolute URL - #2392

Merged
alpergundogdu merged 2 commits into
mainfrom
fix/absolute-adr-doc-links
Oct 9, 2026
Merged

alpergundogdu merged 2 commits into
mainfrom
fix/absolute-adr-doc-links

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

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 becomes https://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

  • All 20 relative ADR links across 13 files now point at https://github.com/decdn/decdn/blob/main/adr/….
  • New .github/scripts/check-doc-links.sh fails on any ](./ or ](../ link in crates/**/*.rs. Rustdoc's broken-link lint only checks intra-doc links, so nothing else catches these. Wired as the doc-links pre-commit hook and a step in the packaging CI job.

Verification

  • CARGO_BUILD_WARNINGS=deny cargo doc --workspace --no-deps --document-private-items passes; rendered decdn_bao_range/index.html carries the GitHub hrefs.
  • The check passes on this branch and flags all 13 files on origin/main.

docs.rs pages for 0.0.1 are immutable; the fix lands there with the next published version.

🤖 Generated with Claude Code

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]>
Copilot AI balanced review requested due to automatic review settings October 9, 2026 12:10
@github-code-quality

github-code-quality Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Code Coverage Overview

Languages: Rust, Solidity

Rust / code-coverage/cargo-llvm-cov

The overall line coverage in commit 665d63d in the fix/absolute-adr-doc... branch remains at 75%, unchanged from commit e7eee84 in the main branch.

Solidity / code-coverage/forge

The overall line coverage in commit 665d63d in the fix/absolute-adr-doc... branch remains at 92%, unchanged from commit e7eee84 in the main branch.


Updated October 09, 2026 12:25 UTC

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

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 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 in crates/**/*.rs (rustdoc's broken-link lint only covers intra-doc links).
  • Wires the script as a doc-links pre-commit hook and a step in the packaging CI 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.

Comment thread .github/scripts/check-doc-links.sh Resolved
@alpergundogdu
alpergundogdu merged commit b468cad into main Oct 9, 2026
30 checks passed
@alpergundogdu
alpergundogdu deleted the fix/absolute-adr-doc-links branch October 9, 2026 12:36
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.

2 participants