Skip to content

feat: add local link check reports and baseline workflow#761

Open
RetricSu wants to merge 7 commits intodevelopfrom
fix-link-checker
Open

feat: add local link check reports and baseline workflow#761
RetricSu wants to merge 7 commits intodevelopfrom
fix-link-checker

Conversation

@RetricSu
Copy link
Copy Markdown
Collaborator

@RetricSu RetricSu commented Mar 23, 2026

Summary

This PR introduces a local broken-link workflow, removes deprecated script-course content, and applies a full round of link cleanup based on the branch diff against develop.

Scope (based on PR diff)

1) Link-check workflow and reports

  • Added local link-check processing scripts:
    • scripts/process-link-results.js
    • scripts/compare-link-report.js
  • Improved existing checker scripts:
    • scripts/check-urls.sh (token output redaction)
    • scripts/convert-github-urls.js (false-positive reduction)
  • Added report artifacts under website/reports/link-check/:
    • dead-links*.json, summary.json, report.md, history.jsonl, known-failures.json, etc.
  • Updated usage/workflow docs in README.md.

2) Content cleanup/removal

  • Removed script-course tutorial series from docs:
    • website/docs/script-course/intro-to-script-1..10.md
  • Removed intro-to-script blog series:
    • website/blog/intro-to-script-1..10.md
  • Updated navigation/config to match removals:
    • website/sidebars.js
    • website/docusaurus.config.js
    • website/package.json
    • website/.prettierignore

3) Link fixes in docs

Targeted link fixes were applied in:

  • website/docs/assets-token-standards/spore-protocol.md
  • website/docs/history-and-hard-forks/rethinking-fork.mdx
  • website/docs/script/rust/rust-api-error.mdx
  • website/docs/script/fuzzing-ckb-scripts.mdx
  • website/docs/script/vm-version.mdx
  • website/docs/mining/guide.mdx
  • website/docs/node/run-a-node-over-tor.mdx
  • website/docs/node/run-light-client-node.mdx

Review Guide (most important: manually verify link replacements)

Please prioritize this section first.

  1. Reviewers should manually compare edited links in the 8 docs above.
  2. For each edited link, verify all of the following:
    • The new URL is reachable.
    • The destination content matches the sentence context (not just HTTP 200).
    • The new target is stable and canonical (prefer official docs/repo targets, avoid short redirects).
    • The replacement does not change intended meaning.
  3. Suggested review method:
    • Open the file diff for each of the 8 docs.
    • Click old vs new URLs and compare destination pages.
    • Confirm text around the link still accurately describes the target.

Direct Review Links (PR diff pages)

Use these links to jump directly to each changed file in the PR review page:

  1. After link-level review is complete, do secondary review on tooling changes:
    • scripts/convert-github-urls.js
    • scripts/check-urls.sh
  2. Finally verify report sync:
    • website/reports/link-check/summary.json
    • website/reports/link-check/report.md

Validation

  • Rebuilt docs and reran link-check generation flow.
  • Synced report files to latest run.
  • Current report status in this branch shows zero current failures (failedTotal: 0).

Commits in this PR

  • 413ad11 add local link check reports and baseline workflow
  • 5db36e0 remove script-course tutorial series
  • 51b0360 refresh reports after script-course removal
  • 40a2bbf clean non-429 dead links and refresh report
  • e2726d6 remove intro-to-script blog series
  • 32494b3 redact token output and refresh filtered reports
  • d62d16a resolve remaining GitHub link issues and sync zero-failure report

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nervos-ckb-docs Ready Ready Preview, Comment May 6, 2026 9:42am

Request Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a local broken-link checking workflow (including report artifacts), removes the deprecated “script-course” docs/blog series, and updates a set of documentation links to reduce dead links and false positives during link checking.

Changes:

  • Added local link-check tooling (check-urls.sh, report processing + comparison scripts) and checked in baseline report artifacts under website/reports/link-check/.
  • Removed the “script-course” doc series and the corresponding “intro-to-script-*” blog posts, with navigation/config updates to match.
  • Performed targeted link cleanups across several docs pages.

Reviewed changes

Copilot reviewed 46 out of 46 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
website/sidebars.js Removes the “Script Development Course” category from the sidebar.
website/reports/link-check/unresolved-known.json Adds generated artifact for unresolved known failures.
website/reports/link-check/summary.json Adds generated run summary artifact.
website/reports/link-check/report.md Adds human-readable link-check report artifact.
website/reports/link-check/recovered.json Adds generated artifact for recovered links.
website/reports/link-check/new-failures.json Adds generated artifact for newly failing links.
website/reports/link-check/known-failures.json Adds baseline file for accepted failures.
website/reports/link-check/history.jsonl Adds historical log of link-check runs.
website/reports/link-check/dead-links.json Adds processed “current failures” artifact.
website/reports/link-check/dead-links-raw.json Adds raw lychee JSON output artifact.
website/package.json Adds link:check / link:report scripts for local link-check workflow.
website/docusaurus.config.js Updates nav active regex to remove script-course routing.
website/docs/script/vm-version.mdx Updates MOP reference links.
website/docs/script/rust/rust-api-error.mdx Updates syscall source link to a stable tag reference.
website/docs/script/fuzzing-ckb-scripts.mdx Updates GitHub links (repository/branch targets).
website/docs/script-course/intro-to-script-9.md Removes deprecated script-course lesson content.
website/docs/script-course/intro-to-script-6.md Removes deprecated script-course lesson content.
website/docs/script-course/intro-to-script-5.md Removes deprecated script-course lesson content.
website/docs/script-course/intro-to-script-4.md Removes deprecated script-course lesson content.
website/docs/script-course/intro-to-script-2.md Removes deprecated script-course lesson content.
website/docs/script-course/intro-to-script-10.md Removes deprecated script-course lesson content.
website/docs/script-course/intro-to-script-1.md Removes deprecated script-course lesson content.
website/docs/node/run-light-client-node.mdx Cleans up prerequisites (removes Xcode link).
website/docs/node/run-a-node-over-tor.mdx Updates Tor bridge guidance link.
website/docs/mining/guide.mdx Removes a broken vendor link from miner purchasing options.
website/docs/history-and-hard-forks/rethinking-fork.mdx Replaces shortened/tracking links with direct canonical references.
website/docs/assets-token-standards/spore-protocol.md Updates the RFC link target for CKB cryptoeconomics reference.
website/blog/intro-to-script-9.md Removes deprecated blog post content.
website/blog/intro-to-script-6.md Removes deprecated blog post content.
website/blog/intro-to-script-5.md Removes deprecated blog post content.
website/blog/intro-to-script-4.md Removes deprecated blog post content.
website/blog/intro-to-script-2.md Removes deprecated blog post content.
website/blog/intro-to-script-10.md Removes deprecated blog post content.
website/blog/intro-to-script-1.md Removes deprecated blog post content.
website/.prettierignore Excludes link-check history JSONL from formatting.
scripts/process-link-results.js Adds post-processing of raw lychee results into structured artifacts + history.
scripts/convert-github-urls.js Improves GitHub URL → API URL conversion to reduce false positives.
scripts/compare-link-report.js Adds comparison against baseline (known-failures.json) and report generation.
scripts/check-urls.sh Expands link-check script (token redaction, env config, JSON output, processing).
README.md Documents the local link-check workflow and artifact meanings.
Comments suppressed due to low confidence (1)

website/reports/link-check/history.jsonl:10

  • history.jsonl does not include an entry corresponding to the committed summary.json.runAt (2026-05-06T09:30:59Z) / report.md generation time, which indicates the historical log is out of sync with the latest report artifacts. If these files are meant to be generated together, please re-run and commit a consistent history.jsonl that includes the latest run.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread website/package.json
Comment on lines 12 to 16
"gen-term": "node scripts/generate-key-terms.mjs",
"fmt": "prettier --write . --ignore-path .prettierignore",
"link:check": "../scripts/check-urls.sh",
"link:report": "node ../scripts/compare-link-report.js",
"publish-gh-pages": "docusaurus-publish",
Comment thread README.md
Comment on lines 96 to +101

1. Install [lychee](https://github.com/lycheeverse/lychee).
2. Build the website: `cd website && yarn build`.
3. Run the script: `./scripts/check-urls.sh`.
3. Run the check: `cd website && yarn link:check`.
4. Review results: `cd website && yarn link:report`.

Comment thread scripts/check-urls.sh
LINK_CHECK_ACCEPT=${LINK_CHECK_ACCEPT:-"200..=299,403"}
GITHUB_TOKEN=${GITHUB_TOKEN:-""}

cd website
Comment thread scripts/check-urls.sh
Comment on lines +43 to +64
LYCHEE_CMD="lychee --config .lychee.toml --cache-exclude-status=\"400..=699\" --format json --output reports/link-check/dead-links-raw.json"

if [ -n "$GITHUB_TOKEN" ]; then
LYCHEE_CMD="$LYCHEE_CMD --header \"Authorization: Bearer $GITHUB_TOKEN\""
fi

# Override config with environment variables
LYCHEE_CMD="$LYCHEE_CMD --max-concurrency $LINK_CHECK_CONCURRENCY"
LYCHEE_CMD="$LYCHEE_CMD --timeout $LINK_CHECK_TIMEOUT"
LYCHEE_CMD="$LYCHEE_CMD --max-retries $LINK_CHECK_RETRIES"
LYCHEE_CMD="$LYCHEE_CMD --accept \"$LINK_CHECK_ACCEPT\""

echo "🚀 Running link check with concurrency=$LINK_CHECK_CONCURRENCY, timeout=${LINK_CHECK_TIMEOUT}s, retries=$LINK_CHECK_RETRIES..."
DISPLAY_CMD="$LYCHEE_CMD"
if [ -n "$GITHUB_TOKEN" ]; then
DISPLAY_CMD="${DISPLAY_CMD//$GITHUB_TOKEN/***REDACTED***}"
fi
echo "Command: $DISPLAY_CMD build"

# Run lychee and capture both output and exit code
set +e
eval "$LYCHEE_CMD build" 2>&1 | grep --color=never -v 'InvalidPathToUri'
Comment thread scripts/check-urls.sh
Comment on lines +14 to 24
# Pre-flight checks
echo "🔍 Pre-flight checks..."
if ! command -v lychee &> /dev/null; then
echo "❌ Error: lychee is not installed. Please install it first: https://github.com/lycheeverse/lychee"
exit 1
fi

if ! command -v node &> /dev/null; then
echo "❌ Error: node is not installed."
exit 1
fi
Comment on lines +1 to +20
{
"total": 250,
"successful": 236,
"unknown": 0,
"unsupported": 0,
"timeouts": 0,
"redirects": 0,
"excludes": 0,
"errors": 14,
"cached": 0,
"success_map": {},
"error_map": {
"build/github-api-urls.txt": [
{
"url": "https://api.github.com/repos/nervosnetwork/molecule/contents/docs/encoding_spec.md?ref=master",
"status": {
"text": "Rejected status code (this depends on your \"accept\" configuration)",
"code": 429
}
},
Comment on lines +1 to +7
{
"runAt": "2026-05-06T09:30:59Z",
"scannedTotal": 250,
"failedTotal": 0,
"newFailedTotal": 0,
"recoveredTotal": 0
}
Comment on lines +34 to +43
Object.entries(rawResults.error_map).forEach(([source, errors]) => {
errors.forEach(error => {
deadLinks.push({
url: error.url,
status: error.status?.code || 'unknown',
sourceHint: source,
firstSeenAt: new Date().toISOString(),
lastSeenAt: new Date().toISOString(),
note: error.status?.text || null
});

- [Rust (≥v.1.71.1)](https://www.rust-lang.org/tools/install)
- [XCode](https://developer.apple.com/xcode/resources/) (MacOs only)
- XCode (MacOs only)
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