From 3bc570f86ebbd0cd5f178714877d7dbff2c80225 Mon Sep 17 00:00:00 2001 From: Kumar Ujjawal Date: Mon, 14 Sep 2026 11:14:29 +0530 Subject: [PATCH 1/2] dev: include Markdown link checks in the local lint suite `dev/rust_lint.sh` now runs `ci/scripts/markdown_link_check.sh` as a read-only step, after the workflow install check and before the Rust documentation build. The runner loads `LYCHEE_VERSION` from `ci/scripts/utils/tool_versions.sh` and installs that pinned version when `lychee` is missing. An already installed `lychee` is used as is, matching the runner's existing policy for other tools. The checker becomes executable so the runner can invoke it directly, as it does for every other registered script. Its body, configuration, file selection, and the GitHub workflow are unchanged, and `--write` never reaches the link check. Partial progress on #21048. --- ci/scripts/markdown_link_check.sh | 0 dev/rust_lint.sh | 10 +++++++++- docs/source/contributor-guide/testing.md | 9 ++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) mode change 100644 => 100755 ci/scripts/markdown_link_check.sh diff --git a/ci/scripts/markdown_link_check.sh b/ci/scripts/markdown_link_check.sh old mode 100644 new mode 100755 diff --git a/dev/rust_lint.sh b/dev/rust_lint.sh index 73cab9c7f70bd..542ed18c6bd72 100755 --- a/dev/rust_lint.sh +++ b/dev/rust_lint.sh @@ -22,7 +22,9 @@ # # Note: The installed checking tools (e.g., taplo) are not guaranteed to match # the CI versions for simplicity, there might be some minor differences. Check -# `.github/workflows` for the CI versions. +# `.github/workflows` for the CI versions. When this script installs a missing +# tool that has a pinned version in `ci/scripts/utils/tool_versions.sh`, it +# installs that pinned version. An already installed tool is used as is. # # # @@ -84,10 +86,15 @@ while [[ $# -gt 0 ]]; do done SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +# Load the tool versions shared with CI (for example, LYCHEE_VERSION). +source "${SCRIPT_DIR}/../ci/scripts/utils/tool_versions.sh" ensure_tool "taplo" "cargo install taplo-cli --locked" ensure_tool "hawkeye" "cargo install hawkeye --locked" ensure_tool "typos" "cargo install typos-cli --locked" +ensure_tool "lychee" "cargo install lychee --locked --version ${LYCHEE_VERSION}" run_step() { local name="$1" @@ -107,6 +114,7 @@ declare -a WRITE_STEPS=( declare -a READONLY_STEPS=( "ci/scripts/check_no_cargo_install_in_workflows.sh|false" + "ci/scripts/markdown_link_check.sh|false" "ci/scripts/rust_docs.sh|false" ) diff --git a/docs/source/contributor-guide/testing.md b/docs/source/contributor-guide/testing.md index 44bd327013a49..35f76382cab8c 100644 --- a/docs/source/contributor-guide/testing.md +++ b/docs/source/contributor-guide/testing.md @@ -188,7 +188,14 @@ tested in the same way using the [doc_comment] crate. See the end of ## Documentation Link Checks -Run the internal markdown link check locally: +The local lint suite, `./dev/rust_lint.sh`, includes the internal markdown link +check. When `lychee` is not on your `PATH`, the suite installs the version +pinned in `ci/scripts/utils/tool_versions.sh`, which is the version CI uses. An +already installed `lychee` is used as is, so its version can differ from the +CI pin. The check is read-only: `--write` and `--allow-dirty` do not change +links. + +Run the internal markdown link check on its own: ```shell source ci/scripts/utils/tool_versions.sh From 0c1ac9deba5d224ed3d06b65b6fb3183b6b0907a Mon Sep 17 00:00:00 2001 From: Kumar Ujjawal Date: Mon, 14 Sep 2026 11:24:20 +0530 Subject: [PATCH 2/2] docs: tighten the link check section of the testing guide --- docs/source/contributor-guide/testing.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/source/contributor-guide/testing.md b/docs/source/contributor-guide/testing.md index 35f76382cab8c..2d0cad99cfddb 100644 --- a/docs/source/contributor-guide/testing.md +++ b/docs/source/contributor-guide/testing.md @@ -188,14 +188,12 @@ tested in the same way using the [doc_comment] crate. See the end of ## Documentation Link Checks -The local lint suite, `./dev/rust_lint.sh`, includes the internal markdown link -check. When `lychee` is not on your `PATH`, the suite installs the version -pinned in `ci/scripts/utils/tool_versions.sh`, which is the version CI uses. An -already installed `lychee` is used as is, so its version can differ from the -CI pin. The check is read-only: `--write` and `--allow-dirty` do not change -links. +`./dev/rust_lint.sh` runs the internal markdown link check. If `lychee` is +missing, the script installs the version pinned in +`ci/scripts/utils/tool_versions.sh`. It uses an existing installation as is, +even if the version differs from the pin. -Run the internal markdown link check on its own: +To run the check on its own: ```shell source ci/scripts/utils/tool_versions.sh @@ -207,6 +205,7 @@ Notes: - The script is run with `bash` and is compatible with the default Bash on macOS (no `mapfile` dependency). - The CI configuration currently checks internal markdown links only. External `http(s)` and `mailto` links are excluded to avoid flaky failures. +- The check only reports broken links. `./dev/rust_lint.sh --write` does not change them. When a link is broken, lychee prints the file and URL/path that failed. For example: