From fca789fee2e1fc75b75bd2dc7182a43249aa5e0a Mon Sep 17 00:00:00 2001 From: Kumar Ujjawal Date: Tue, 15 Sep 2026 09:23:45 +0530 Subject: [PATCH 1/4] dev: include ASF status checks in the local lint suite `dev/rust_lint.sh` now runs `ci/scripts/check_asf_yaml_status_checks.py` as a read-only step, after the workflow install check and before the Markdown link check. The validator compares the required status names in `.asf.yaml` with the jobs in `.github/workflows`, so a renamed job that still has a stale requirement fails locally instead of leaving a pull request waiting for a status that never arrives. The validator runs with `python3` from PATH and imports PyYAML. The runner checks both before it installs any tool or runs any formatter, and reports a distinct, actionable error for each missing prerequisite. It does not install Python packages. Help output stays independent of these checks. The validator becomes executable so the runner can invoke it directly, as it does for every other registered script. Its body, `.asf.yaml`, and the GitHub workflow are unchanged, and `--write` never reaches it. Partial progress on #21048. --- ci/scripts/check_asf_yaml_status_checks.py | 0 dev/rust_lint.sh | 20 ++++++++++++++ docs/source/contributor-guide/testing.md | 31 ++++++++++++++++++++++ 3 files changed, 51 insertions(+) mode change 100644 => 100755 ci/scripts/check_asf_yaml_status_checks.py diff --git a/ci/scripts/check_asf_yaml_status_checks.py b/ci/scripts/check_asf_yaml_status_checks.py old mode 100644 new mode 100755 diff --git a/dev/rust_lint.sh b/dev/rust_lint.sh index 542ed18c6bd72..8d8a7c3f8a076 100755 --- a/dev/rust_lint.sh +++ b/dev/rust_lint.sh @@ -26,6 +26,9 @@ # 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. # +# The ASF status-check validator runs with `python3` from PATH and needs the +# PyYAML package. This script checks both but does not install Python packages. +# # # # For each lint scripts: @@ -88,6 +91,22 @@ done SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# `ci/scripts/check_asf_yaml_status_checks.py` runs with `python3` from PATH +# and imports PyYAML. Report a missing prerequisite before any tool is +# installed or any formatter runs. +ensure_python_with_yaml() { + if ! command -v python3 &> /dev/null; then + echo "[${SCRIPT_NAME}] python3 was not found on PATH. Install Python 3 to run ci/scripts/check_asf_yaml_status_checks.py." >&2 + exit 1 + fi + if ! python3 -c 'import yaml' &> /dev/null; then + echo "[${SCRIPT_NAME}] PyYAML is not installed for $(command -v python3). Install it in your active Python environment with: python3 -m pip install pyyaml" >&2 + exit 1 + fi +} + +ensure_python_with_yaml + # Load the tool versions shared with CI (for example, LYCHEE_VERSION). source "${SCRIPT_DIR}/../ci/scripts/utils/tool_versions.sh" @@ -114,6 +133,7 @@ declare -a WRITE_STEPS=( declare -a READONLY_STEPS=( "ci/scripts/check_no_cargo_install_in_workflows.sh|false" + "ci/scripts/check_asf_yaml_status_checks.py|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 2d0cad99cfddb..d0375bfb16c63 100644 --- a/docs/source/contributor-guide/testing.md +++ b/docs/source/contributor-guide/testing.md @@ -220,6 +220,37 @@ Rust doc comments are validated by rustdoc in CI and can be checked locally with bash ci/scripts/rust_docs.sh ``` +## ASF Status Check Validation + +`.asf.yaml` lists the GitHub Actions jobs that must pass before a PR can merge. +If a job is renamed and `.asf.yaml` still requires the old name, PRs wait for a +status that never arrives. `ci/scripts/check_asf_yaml_status_checks.py` compares +the required names with the jobs in `.github/workflows` and fails on a mismatch. + +`./dev/rust_lint.sh` runs this check. It needs `python3` with [PyYAML] on your +`PATH`. If either is missing, the suite stops with a setup error before any +formatter runs. The script does not install Python packages. To install PyYAML +in a virtual environment: + +```shell +python3 -m venv venv +source venv/bin/activate +python3 -m pip install pyyaml +``` + +To run the check on its own: + +```shell +python3 ci/scripts/check_asf_yaml_status_checks.py +``` + +Notes: + +- The check reads local files only. It does not call the GitHub API and does not change `.asf.yaml` or the workflows. +- The `venv` directory is ignored by git. + +[pyyaml]: https://pypi.org/project/PyYAML/ + ## Benchmarks ### Criterion Benchmarks From ef05edd970fcc72eb6978f0c9172fa25f60570b4 Mon Sep 17 00:00:00 2001 From: Kumar Ujjawal Date: Tue, 15 Sep 2026 09:53:57 +0530 Subject: [PATCH 2/4] docs: shorten the ASF status check section of the testing guide --- docs/source/contributor-guide/testing.md | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/docs/source/contributor-guide/testing.md b/docs/source/contributor-guide/testing.md index d0375bfb16c63..23ac23442ecf1 100644 --- a/docs/source/contributor-guide/testing.md +++ b/docs/source/contributor-guide/testing.md @@ -222,19 +222,11 @@ bash ci/scripts/rust_docs.sh ## ASF Status Check Validation -`.asf.yaml` lists the GitHub Actions jobs that must pass before a PR can merge. -If a job is renamed and `.asf.yaml` still requires the old name, PRs wait for a -status that never arrives. `ci/scripts/check_asf_yaml_status_checks.py` compares -the required names with the jobs in `.github/workflows` and fails on a mismatch. - -`./dev/rust_lint.sh` runs this check. It needs `python3` with [PyYAML] on your -`PATH`. If either is missing, the suite stops with a setup error before any -formatter runs. The script does not install Python packages. To install PyYAML -in a virtual environment: +`ci/scripts/check_asf_yaml_status_checks.py` checks that every required status +check in `.asf.yaml` matches a job in `.github/workflows`. `./dev/rust_lint.sh` +runs it and needs `python3` with [PyYAML]: ```shell -python3 -m venv venv -source venv/bin/activate python3 -m pip install pyyaml ``` @@ -244,11 +236,6 @@ To run the check on its own: python3 ci/scripts/check_asf_yaml_status_checks.py ``` -Notes: - -- The check reads local files only. It does not call the GitHub API and does not change `.asf.yaml` or the workflows. -- The `venv` directory is ignored by git. - [pyyaml]: https://pypi.org/project/PyYAML/ ## Benchmarks From 25c16b7b2012e27f8be00123c3bd9b98ffea10b1 Mon Sep 17 00:00:00 2001 From: Kumar Ujjawal Date: Wed, 16 Sep 2026 10:32:14 +0530 Subject: [PATCH 3/4] dev: point the Python prerequisite errors at uv run --- dev/rust_lint.sh | 10 ++++++---- docs/source/contributor-guide/testing.md | 7 ++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/dev/rust_lint.sh b/dev/rust_lint.sh index 8d8a7c3f8a076..e9704d2108e7e 100755 --- a/dev/rust_lint.sh +++ b/dev/rust_lint.sh @@ -27,7 +27,8 @@ # installs that pinned version. An already installed tool is used as is. # # The ASF status-check validator runs with `python3` from PATH and needs the -# PyYAML package. This script checks both but does not install Python packages. +# PyYAML package. This script checks both but does not install Python packages; +# `uv run ./dev/rust_lint.sh` provides them from the uv workspace. # # # @@ -93,14 +94,15 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # `ci/scripts/check_asf_yaml_status_checks.py` runs with `python3` from PATH # and imports PyYAML. Report a missing prerequisite before any tool is -# installed or any formatter runs. +# installed or any formatter runs, and point at `uv run`, which sets up the +# Python dependencies from the uv workspace. ensure_python_with_yaml() { if ! command -v python3 &> /dev/null; then - echo "[${SCRIPT_NAME}] python3 was not found on PATH. Install Python 3 to run ci/scripts/check_asf_yaml_status_checks.py." >&2 + echo "[${SCRIPT_NAME}] python3 was not found on PATH. Please run the suite through uv, which provides Python and its packages: uv run ./dev/rust_lint.sh" >&2 exit 1 fi if ! python3 -c 'import yaml' &> /dev/null; then - echo "[${SCRIPT_NAME}] PyYAML is not installed for $(command -v python3). Install it in your active Python environment with: python3 -m pip install pyyaml" >&2 + echo "[${SCRIPT_NAME}] PyYAML is not installed for $(command -v python3). Please run the suite through uv, which installs it: uv run ./dev/rust_lint.sh" >&2 exit 1 fi } diff --git a/docs/source/contributor-guide/testing.md b/docs/source/contributor-guide/testing.md index 23ac23442ecf1..dc4430ebf4a1f 100644 --- a/docs/source/contributor-guide/testing.md +++ b/docs/source/contributor-guide/testing.md @@ -224,19 +224,20 @@ bash ci/scripts/rust_docs.sh `ci/scripts/check_asf_yaml_status_checks.py` checks that every required status check in `.asf.yaml` matches a job in `.github/workflows`. `./dev/rust_lint.sh` -runs it and needs `python3` with [PyYAML]: +runs it and needs `python3` with [PyYAML]. The [uv] workspace provides both: ```shell -python3 -m pip install pyyaml +uv run ./dev/rust_lint.sh ``` To run the check on its own: ```shell -python3 ci/scripts/check_asf_yaml_status_checks.py +uv run python3 ci/scripts/check_asf_yaml_status_checks.py ``` [pyyaml]: https://pypi.org/project/PyYAML/ +[uv]: https://docs.astral.sh/uv/ ## Benchmarks From 52d8c0f6031ea1125350fe84aef6491a85d8113d Mon Sep 17 00:00:00 2001 From: Kumar Ujjawal Date: Wed, 16 Sep 2026 10:39:48 +0530 Subject: [PATCH 4/4] dev: drop a redundant header comment from rust_lint.sh --- dev/rust_lint.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dev/rust_lint.sh b/dev/rust_lint.sh index e9704d2108e7e..6f185d2348cba 100755 --- a/dev/rust_lint.sh +++ b/dev/rust_lint.sh @@ -26,10 +26,6 @@ # 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. # -# The ASF status-check validator runs with `python3` from PATH and needs the -# PyYAML package. This script checks both but does not install Python packages; -# `uv run ./dev/rust_lint.sh` provides them from the uv workspace. -# # # # For each lint scripts: