Skip to content

fix(docs): resolve broken doc links and add automated markdown link checker CI - #8437

Open
rushikeshgarad2024-dev wants to merge 2 commits into
Scottcjn:mainfrom
rushikeshgarad2024-dev:fix/broken-docs-links-ci-16248
Open

rushikeshgarad2024-dev wants to merge 2 commits into
Scottcjn:mainfrom
rushikeshgarad2024-dev:fix/broken-docs-links-ci-16248

Conversation

@rushikeshgarad2024-dev

Copy link
Copy Markdown

Summary of Changes

This pull request addresses broken links across documentation and introduces an automated Markdown link integrity check workflow to prevent future link regressions.

Resolved Issues & Fixes:

  1. GHOST_IN_THE_MACHINE.md: Removed dead relative link placeholders to non-existent ./evidence/ paths in the template format.
  2. .github/actions/bcos-scan/README.md: Updated dead https://rustchain.org/bcos/ documentation URL to official https://rustchain.org.
  3. CPU_ANTIQUITY_SYSTEM.md: Updated obsolete Intel processor spec link to active official documentation.
  4. Automated Link Checker: Added tools/check_markdown_links.py to scan all repository Markdown files for invalid relative link targets and anchors.
  5. CI Automation: Added .github/workflows/link-checker.yml to ensure continuous link validation on all pull requests and pushes.

Closes #7910, #7908, #7886, #7885, #7792
Bounty: Scottcjn/rustchain-bounties#16248
Wallet Registration: Scottcjn/rustchain-bounties#16973 (GC5U46IS25KYFKNHDXEHR3KTQB3DVIBM4NW5BH4MVUE2G77STCJP4IHF)

…hecker CI

- Fix broken relative links in GHOST_IN_THE_MACHINE.md template
- Update broken bcos documentation URL in .github/actions/bcos-scan/README.md
- Update Intel processor specs link in CPU_ANTIQUITY_SYSTEM.md
- Add automated markdown link checker script tools/check_markdown_links.py
- Add GitHub Actions CI workflow .github/workflows/link-checker.yml

Resolves Scottcjn/rustchain-bounties#16248
Closes Scottcjn#7910, Scottcjn#7908, Scottcjn#7886, Scottcjn#7885, Scottcjn#7792
@github-actions

Copy link
Copy Markdown
Contributor

Welcome to RustChain! Thanks for your first pull request.

Before we review, please make sure:

  • Non-doc PRs have a BCOS-L1 or BCOS-L2 label
  • Doc-only PRs are exempt from BCOS tier labels when they only touch docs/**, *.md, or common image/PDF files
  • New code files include an SPDX license header
  • You've tested your changes against the live node

Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150)

A maintainer will review your PR soon. Thanks for contributing!

@github-actions github-actions Bot added size/M PR: 51-200 lines documentation Improvements or additions to documentation BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) ci and removed size/M PR: 51-200 lines labels Sep 16, 2026

@Cid-oe Cid-oe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Peer Code Review (Bounty #2782)

• Observation 1 (Shebang Placement): In tools/check_markdown_links.py, lines 1-3 configure stdout encoding before the shebang #!/usr/bin/env python3 on line 4. On POSIX environments when executed directly as a script (e.g. ./tools/check_markdown_links.py), the kernel requires the shebang to strictly occupy line 1; otherwise, it executes using the default shell (/bin/sh) and triggers syntax errors. Recommend moving #!/usr/bin/env python3 to line 1.
• Observation 2 (Directory Globbing & Performance): In check_markdown_links(), using list(ROOT.glob("*.md")) + list(ROOT.glob(".github/**/*.md")) + list(ROOT.glob("docs/**/*.md")) misses nested markdown files in subdirectories such as node/ or benches/. Consider using ROOT.rglob("*.md") while filtering out target/, .git/, and node_modules/.
• Observation 3 (CI Integration): Clean GitHub Actions integration in .github/workflows/link-checker.yml properly hooks into PRs and push events on main branches with zero external pip dependencies.

@Scottcjn Scottcjn left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Solid work, @rushikeshgarad2024-dev. The 3 dead links are fixed (rustchain.org/bcos/ really is 404). The checker is stdlib-only, passes on your branch (1,338 links / 239 files), and exits 1 when I injected a broken link. Three small fixes before merge:

  1. Add permissions: contents: read to .github/workflows/link-checker.yml, so the workflow's token is least-privilege.
  2. Move the shebang to line 1 of tools/check_markdown_links.py (it's currently after code on line 4).
  3. Ideally widen the scan from root/.github/docs (239 of 598 .md files) to **/*.md, excluding vendored paths.

Note: the CI test job is red on every Rustchain PR right now for an unrelated reason (fixed in #8467), so that red check isn't on you. Once these are in: 5 RTC per #16248.

@Scottcjn

Scottcjn commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Review (2026-11-06): the three doc-link fixes are good. The new workflow and tools/check_markdown_links.py duplicate the existing lychee workflow with a smaller regex-based checker (no fragment checks, no reference-style links, only root/.github/docs). For #16248 the maintainer will likely take one of the lychee-based PRs (#8423 or #8505). Suggestion: drop the script+workflow from this PR and keep just the three link fixes, which would make it a docs-only merge. — Sophia Elya (reviewing for Scott)

Move the shebang to line 1, grant contents: read, and scan every tracked markdown file with vendored trees excluded. Placeholder and template link targets are skipped.
@github-actions github-actions Bot added the size/M PR: 51-200 lines label Nov 7, 2026
@rushikeshgarad2024-dev

Copy link
Copy Markdown
Author

All three review points are addressed in b9292af:

  1. permissions: contents: read added to .github/workflows/link-checker.yml.
  2. Shebang moved to line 1 of ools/check_markdown_links.py.
  3. Scan widened to every tracked *.md via
    glob, excluding vendored/generated trees ( arget,
    ode_modules, �endor, .venv, .git). Placeholder/template targets like url and {{BASE_URL}} are skipped.

Local run: 1,793 links across 598 markdown files, all relative links resolve.

@github-actions

Copy link
Copy Markdown
Contributor

This PR has been inactive for 21 days. It will be closed in 14 days unless updated.
Need help finishing? Ask in the PR comments — we're happy to assist!

@github-actions github-actions Bot added the stale Inactive — will close soon label Nov 30, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) ci documentation Improvements or additions to documentation size/M PR: 51-200 lines stale Inactive — will close soon

Projects

None yet

3 participants