Skip to content

[ci] Skip the code-oriented lint matrix on documentation-prose PRs - #65292

Merged
dstrodtman merged 3 commits into
ray-project:masterfrom
dstrodtman:djs-260807-ci-doc-lint-exemption
Aug 10, 2026
Merged

dstrodtman merged 3 commits into
ray-project:masterfrom
dstrodtman:djs-260807-ci-doc-lint-exemption

Conversation

@dstrodtman

Copy link
Copy Markdown
Contributor

Why

A Markdown-only PR (#65285, one file under doc/) ran all 15 lint steps and took 27+ minutes on microcheck (build 51723). clang_format, bazel_buildifier, bazel_team, copyright_format, dashboard_format, pytest_format, semgrep_lint, and test_coverage all ran against a one-file prose change. None of them can fail on Markdown.

Almost none of that time was lint work. Aggregated across the lint group: ~2,730s of checkout against ~1,275s of actual linting. dashboard_format spent 858s cloning to do 143s of work.

Two things made every step run:

  1. always.rules.txt had no file-shape scoping at all — a bare * catch-all emitting always lint for every changed file.
  2. The lint steps carried always in addition to lint, so scoping the lint tag alone would have changed nothing.

This PR doesn't address the per-job clone cost, which is infrastructure-side and much the larger win. It removes 10 of 15 jobs that pay it, which is where the pathological tail (858s, 1028s) came from.

What

Skip the code-oriented lint steps on prose-only PRs

  • always.rules.txt: add a rule ahead of the catch-all that emits always without lint for .md, .rst, image assets, and doc/.claude/. The path set matches the existing prose skip rule in test.rules.txt so the two files agree on what prose is.
  • lint.rayci.yml: split the lint-small matrix in two. Steps a prose change can actually fail keep always; the code-oriented steps carry lint alone and are filtered out on a prose-only diff. Same for pydoclint.
  • lint.sh: add pre_commit_docs, running the three hooks that actually reach prose (trailing-whitespace, end-of-file-fixer, check-added-large-files). The other 20 hooks in pre_commit are scoped to Python, C++, BUILD, TS/TSX, or shell. pre_commit runs every hook with --all-files, so its 443s is independent of the diff — this keeps the prose coverage without keeping the cost.

No new tag is needed. always is emitted for every file by the catch-all, so lint alone carries the split, and now means "the diff contains a file that is not documentation prose."

Fail-safe by construction. Tags union across changed files, so one non-prose file anywhere in a diff re-emits lint and the full matrix runs — mixed PRs lose no coverage. Non-PR builds bypass rule evaluation entirely (needRunAllTags returns ["*"] for master, release branches, and manual builds), so post-merge lint coverage is unchanged.

The microcheck pipeline's hardcoded RAYCI_SELECT=...,tag:lint is not a blocker: stepFilter.accept is acceptSelectHit(step) && acceptTagHit(step), so selects and rule-emitted tags are ANDed. tag:lint only makes these steps eligible; the rules still have to emit lint. So the whole change lands in this repo, with no pipeline-definition change.

Make banned_words cover Markdown (second commit)

While classifying which lint steps are prose-relevant, I found check-banned-words.sh describes itself as checking "Python and doc files" but only included *.py and *.rst. Since doc/test_no_new_rst.py rejects newly added .rst files, the check was blind to the format every new Ray doc page is written in.

  • Add *.md and *.ipynb to the includes.
  • Report every banned word before failing instead of exiting on the first match — this step pays a full clone, so the old behavior cost a CI round-trip per misspelling.
  • Fix the one occurrence this surfaced: Kuberay → KubeRay in doc/source/cluster/kubernetes/user-guides/tpu.md.

The banned list itself is unchanged (RLLib, Rllib, Kuberay). I added a comment noting the case-sensitive match is deliberate, since it reads like a bug otherwise.

One occurrence is deliberately left: Kuberay in a Buildkite step label in .buildkite/release-automation/pre_release.rayci.yml. .yml stays out of the check's includes because config files aren't doc files, and fixing it would pull another CODEOWNERS group in for one word. Happy to include it if reviewers would rather.

A note on scope

The narrower-than-obvious path set is intentional. Executable assets under doc/ such as .py and .ipynb are not exempt, because pre_commit is the only premerge step that runs black, ruff, and mypy over doc/source/*.py at all — exempting all of doc/ would let a conf.py formatting violation reach master. This is also why the exemption isn't wired to the docs-go scope definition: that label is an author-asserted escape hatch with a fail-closed guard, whereas this exemption is automatic, so it stays limited to file types that cannot carry code.

Note this PR is itself a mixed diff and so runs the full lint matrix — it can't demonstrate its own skip. A subsequent prose-only PR is the live proof.

Testing

Rule evaluation — verified against the ray-project/rayci Go evaluator (the authority for tag computation), not the in-repo reference parser:

cd rayci && go run . -buildkite-dir <ray>/.buildkite test-rules

130 cases pass. Added cases to always.rules.test.txt covering prose, images, and doc/.claude/ (expect always), plus the negative cases doc/source/conf.py, .ipynb, examples.yml, doc/BUILD.bazel, and prose outside doc/ (expect always lint). Confirmed non-vacuous by appending a deliberately wrong expectation, which failed as expected — worth noting that the RAYCI_TEST_RULE_FILES env var mentioned in test-rules' usage text is not actually implemented, so passing it makes the run auto-discover nothing and exit 0.

Step selection — simulated acceptTagHit against the new lint.rayci.yml:

  • emitted tags {always} → the 5 prose steps run, the 10 code-oriented steps are filtered
  • emitted tags {always, lint} → all 15 run

pre_commit_docs — ran the three hooks locally: all pass, 39s versus 443s for the full pre_commit step.

banned_words — ./ci/lint/check-banned-words.sh passes on the tree. Verified non-vacuous: a temporary doc/canary_banned.md containing all three words is now caught, reports all three in one run, and exits 1; the previous version of the script passed that same file silently.

Lint on the changed files — shellcheck and bash -n on both shell scripts; pre-commit whitespace hooks clean.

Not a duplicate

Searched open PRs for always.rules, lint.rayci, and the lint matrix/microcheck area — no open PR touches always.rules.txt, the lint matrix split, or check-banned-words.sh.

AI assistance

AI assistance (Claude Code) was used for this change. I reviewed every changed line and ran the test commands above locally.

🤖 Generated with Claude Code

dstrodtman and others added 2 commits August 7, 2026 13:43
## Why

A Markdown-only PR (one file under `doc/`) ran all 15 lint steps and took
27+ minutes on microcheck. `clang_format`, `bazel_buildifier`, `bazel_team`,
`copyright_format`, `dashboard_format`, `pytest_format`, `semgrep_lint`, and
`test_coverage` all ran against a one-file prose change, none of which can
fail on Markdown.

Two things made every step run. `always.rules.txt` was a bare `*` catch-all
emitting `always lint` for every file, so nothing was ever scoped by file
shape; and the lint steps carried `always` on top of `lint`, so scoping
`lint` alone would have changed nothing.

The aggregate cost was ~2,730s of checkout against ~1,275s of actual linting.
`dashboard_format` spent 858s cloning to do 143s of work. This change doesn't
address the per-job clone cost, but it removes 10 of 15 jobs that pay it,
which is where the pathological tail came from.

## What

- `always.rules.txt`: add a prose rule ahead of the catch-all that emits
  `always` without `lint`, for `.md`, `.rst`, image assets, and
  `doc/.claude/`. The path set matches the existing prose skip rule in
  `test.rules.txt` so the two files agree on what prose is.
- `lint.rayci.yml`: split the `lint-small` matrix in two. The steps a prose
  change can fail keep `always`; the code-oriented steps carry `lint` alone
  and so are filtered out on a prose-only diff. Same for pydoclint.
- `lint.sh`: add `pre_commit_docs`, running the three hooks that actually
  reach prose (`trailing-whitespace`, `end-of-file-fixer`,
  `check-added-large-files`). The other 20 hooks in `pre_commit` are scoped
  to Python, C++, BUILD, TS/TSX, or shell. `pre_commit` runs every hook with
  `--all-files`, so its 443s is diff-independent; this keeps the prose
  coverage without keeping the cost.

No new tag is needed: `always` is emitted for every file by the catch-all, so
`lint` alone carries the split and now means "the diff contains a file that is
not documentation prose."

Fail-safe by construction. Tags union across changed files, so one non-prose
file anywhere in a diff re-emits `lint` and the full matrix runs; mixed PRs
lose no coverage. Non-PR builds bypass rule evaluation entirely, so post-merge
lint coverage is unchanged.

The fix is entirely in this repo. The microcheck pipeline's hardcoded
`tag:lint` selector is not a blocker: rayci ANDs selects with rule-emitted
tags, so `tag:lint` only makes these steps eligible and the rules still have
to emit `lint`.

## Testing

- `rayci test-rules` against the modified `.buildkite` dir: 130 cases pass.
  Added cases covering prose, images, `doc/.claude/`, and the negative cases
  (`doc/source/conf.py`, `.ipynb`, `examples.yml`, `doc/BUILD.bazel`, and
  prose outside `doc/`) all still emit `lint`. Verified non-vacuous with a
  deliberately wrong expectation, which failed as expected.
- Verified the split against the rayci step filter semantics: on emitted tags
  `{always}` the 5 prose steps run and the 10 code-oriented steps are
  filtered; on `{always, lint}` all 15 run.
- Ran the three `pre_commit_docs` hooks locally: all pass, 39s versus 443s
  for the full step.
- `shellcheck` and `bash -n` on `lint.sh`; pre-commit whitespace hooks on all
  changed files.

AI assistance (Claude Code) was used for this change.

Not a duplicate: no open PR touches `always.rules.txt` or the lint matrix
split.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
## Why

`check-banned-words.sh` describes itself as checking "Python and doc files",
but its grep only included `*.py` and `*.rst`. New pages under `doc/source/`
must be MyST Markdown -- `doc/test_no_new_rst.py` rejects newly added `.rst`
files -- so the check was blind to the format most Ray prose is now written
in. It had been silently passing over `.md` entirely.

One occurrence had already landed: `Kuberay` in
`doc/source/cluster/kubernetes/user-guides/tpu.md`. Fixed here, since adding
`*.md` to the check surfaces it.

## What

- Add `*.md` and `*.ipynb` to the include list. Notebooks are the other
  documentation format, and neither had any coverage.
- Report every banned word before failing, instead of exiting on the first
  match. This step pays a full repository clone, so discovering one
  misspelling per CI round-trip was needlessly slow.
- Add `set -uo pipefail` and a note that the case-sensitive match is
  deliberate: the correct spellings are `RLlib` and `KubeRay`, and the point
  is to catch the wrong capitalizations.

The banned list itself is unchanged: `RLLib`, `Rllib`, `Kuberay`.

## Testing

- `./ci/lint/check-banned-words.sh` passes on the tree (exit 0).
- Verified non-vacuous: a temporary `doc/canary_banned.md` containing all
  three words is now caught, reports all three in one run, and exits 1. On the
  previous version of the script the same file passed silently.
- `bash -n` and `shellcheck` clean.

AI assistance (Claude Code) was used for this change.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman
dstrodtman requested review from a team and andrewsykim as code owners August 7, 2026 18:03

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request optimizes the CI pipeline by splitting the lint matrix so that documentation-prose-only pull requests skip expensive code-oriented lint checks while still running prose-relevant checks. It also updates the banned words check to include .md and .ipynb files and report all violations before exiting. The reviewer suggested replacing grep -R with git grep in the banned words check to avoid traversing symlinks and scanning untracked files, which improves performance and prevents false positives.

Comment thread ci/lint/check-banned-words.sh Resolved

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit f5d508c. Configure here.

Comment thread ci/lint/lint.sh Resolved
## Drop `pre_commit_docs` (Bugbot)

Bugbot correctly caught that this step was theater. `.pre-commit-config.yaml`
excludes `doc/source/` in its top-level `exclude:` block, so
`trailing-whitespace`, `end-of-file-fixer`, and `check-added-large-files`
cannot see the prose a documentation change actually touches. My earlier
reasoning only checked the per-hook `files`/`types` filters and missed the
global exclude.

Measured: 588 of the 596 `.md`/`.rst` files under `doc/` are excluded. The 8
that aren't are `doc/README.md`, `doc/redirects/README.md`, and the
`doc/.claude/` agent files. Verified directly by adding trailing whitespace to
both `doc/source/index.rst` and `doc/README.md` and running the hook: it fixed
`doc/README.md` and left `doc/source/index.rst` untouched.

So the step would have cost 39s to cover almost nothing. Removed, and the
claim it supported is removed from `ci.md` as well. A prose-only PR now runs
four lint steps rather than five.

The real problem is that `doc/source/` is in that global exclude at all, which
means whitespace and end-of-file hygiene is unchecked for every Ray doc page
on every PR, and was before this PR too. Fixing it means removing the exclude
and absorbing a large mechanical diff, so it belongs in its own change.
`ci.md` and `lint.rayci.yml` now say so explicitly rather than implying prose
gets coverage it doesn't.

## Use `git grep` in the banned-words check (Gemini)

Good suggestion, taken. `grep -R` follows symlinks, unlike `-r`, so it would
traverse `bazel-out`/`bazel-bin` on a local run, and it scans untracked files,
so an untracked virtualenv containing an installed Ray could produce false
positives. `git grep` searches tracked files only, which avoids both and adds
line numbers to the output.

## Testing

- `./ci/lint/check-banned-words.sh` passes on the tree (exit 0). Re-verified
  non-vacuous with the `git grep` implementation: a staged `doc/canary.md`
  containing all three words is caught, reports all three with line numbers,
  and exits 1; removing it returns exit 0.
- `rayci test-rules` still passes (130 cases).
- Step-selection simulation after removing the step: prose-only emits
  `{always}` and runs 4 lint steps plus the label-gated docs-go guard, with 10
  code-oriented steps filtered; `{always, lint}` runs all 15.
- `bash -n` and `shellcheck` clean on both shell scripts.
- Confirmed no dangling `pre_commit_docs` references remain in `ci/`,
  `.buildkite/`, or `doc/`.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman

Copy link
Copy Markdown
Contributor Author

Both bot findings were correct and are addressed in 8928685.

Bugbot: pre_commit_docs covered nothing — step removed

This was a real catch, and it invalidated my rationale rather than just the implementation. I had checked the per-hook files/types filters in .pre-commit-config.yaml and concluded trailing-whitespace, end-of-file-fixer, and check-added-large-files reach prose because they carry no filter. I missed the top-level exclude: block, which lists doc/source/.

Measured it: 588 of the 596 .md/.rst files under doc/ are excluded. The 8 that aren't are doc/README.md, doc/redirects/README.md, and the doc/.claude/ agent files.

Verified directly rather than by reading the config — appended trailing whitespace to both doc/source/index.rst and doc/README.md, then ran the hook:

$ pre-commit run trailing-whitespace --all-files
trim trailing whitespace.................................................Failed
Fixing doc/README.md

It fixed doc/README.md and left doc/source/index.rst untouched. So the step would have spent 39s to cover essentially nothing.

Removed the step, and removed the claim it supported from ci.md. A prose-only PR now runs four lint steps, not five.

Worth stating plainly, because it's the more interesting consequence: whitespace and end-of-file hygiene is unchecked for every Ray doc page today, on every PR, and was before this PR. Skipping pre_commit on prose therefore costs prose nothing. The fix is to remove doc/source/ from that exclude and absorb the resulting mechanical diff, which is its own change. ci.md and lint.rayci.yml now say this explicitly instead of implying coverage that doesn't exist.

Gemini: git grep instead of grep -R — taken

Correct on both counts, and the symlink point is the sharper one: -R follows symlinks where -r doesn't, so a local run would traverse bazel-out/bazel-bin. Scanning untracked files also means an untracked virtualenv with Ray installed could produce false positives — more likely now that I widened the check to .md. git grep avoids both and adds line numbers.

Re-verified non-vacuous after the switch: a staged doc/canary.md containing all three banned words is caught, reports all three with line numbers, and exits 1; removing it returns exit 0.

Re-verification after these changes

  • rayci test-rules: 130 cases still pass.
  • Step selection: prose-only ({always}) runs 4 lint steps plus the label-gated docs-go guard, with 10 code-oriented steps filtered; {always, lint} runs all 15.
  • bash -n and shellcheck clean on both shell scripts; no dangling pre_commit_docs references remain.

@ray-gardener ray-gardener Bot added docs An issue or change related to documentation core Issues that should be addressed in Ray Core devprod labels Aug 7, 2026
@dstrodtman dstrodtman added the go add ONLY when ready to merge, run all tests label Aug 7, 2026
@dstrodtman
dstrodtman merged commit 9522666 into ray-project:master Aug 10, 2026
7 checks passed
Artimislyy pushed a commit to Artimislyy/ray that referenced this pull request Aug 11, 2026
…ay-project#65292)

## Why

A Markdown-only PR (ray-project#65285, one file under `doc/`) ran all 15 lint steps
and took 27+ minutes on `microcheck` ([build
51723](https://buildkite.com/ray-project/microcheck/builds/51723)).
`clang_format`, `bazel_buildifier`, `bazel_team`, `copyright_format`,
`dashboard_format`, `pytest_format`, `semgrep_lint`, and `test_coverage`
all ran against a one-file prose change. None of them can fail on
Markdown.

Almost none of that time was lint work. Aggregated across the lint
group: **~2,730s of checkout against ~1,275s of actual linting.**
`dashboard_format` spent 858s cloning to do 143s of work.

Two things made every step run:

1. `always.rules.txt` had no file-shape scoping at all — a bare `*`
catch-all emitting `always lint` for every changed file.
2. The lint steps carried `always` *in addition to* `lint`, so scoping
the `lint` tag alone would have changed nothing.

This PR doesn't address the per-job clone cost, which is
infrastructure-side and much the larger win. It removes 10 of 15 jobs
that pay it, which is where the pathological tail (858s, 1028s) came
from.

## What

**Skip the code-oriented lint steps on prose-only PRs**

- `always.rules.txt`: add a rule ahead of the catch-all that emits
`always` **without** `lint` for `.md`, `.rst`, image assets, and
`doc/.claude/`. The path set matches the existing prose skip rule in
`test.rules.txt` so the two files agree on what prose is.
- `lint.rayci.yml`: split the `lint-small` matrix in two. Steps a prose
change can actually fail keep `always`; the code-oriented steps carry
`lint` alone and are filtered out on a prose-only diff. Same for
pydoclint.
- `lint.sh`: add `pre_commit_docs`, running the three hooks that
actually reach prose (`trailing-whitespace`, `end-of-file-fixer`,
`check-added-large-files`). The other 20 hooks in `pre_commit` are
scoped to Python, C++, BUILD, TS/TSX, or shell. `pre_commit` runs every
hook with `--all-files`, so its 443s is independent of the diff — this
keeps the prose coverage without keeping the cost.

**No new tag is needed.** `always` is emitted for every file by the
catch-all, so `lint` alone carries the split, and now means "the diff
contains a file that is not documentation prose."

**Fail-safe by construction.** Tags union across changed files, so one
non-prose file anywhere in a diff re-emits `lint` and the full matrix
runs — mixed PRs lose no coverage. Non-PR builds bypass rule evaluation
entirely (`needRunAllTags` returns `["*"]` for master, release branches,
and manual builds), so **post-merge lint coverage is unchanged.**

The microcheck pipeline's hardcoded `RAYCI_SELECT=...,tag:lint` is not a
blocker: `stepFilter.accept` is `acceptSelectHit(step) &&
acceptTagHit(step)`, so selects and rule-emitted tags are ANDed.
`tag:lint` only makes these steps *eligible*; the rules still have to
emit `lint`. So the whole change lands in this repo, with no
pipeline-definition change.

**Make `banned_words` cover Markdown** (second commit)

While classifying which lint steps are prose-relevant, I found
`check-banned-words.sh` describes itself as checking "Python and doc
files" but only included `*.py` and `*.rst`. Since
`doc/test_no_new_rst.py` rejects newly added `.rst` files, the check was
blind to the format every new Ray doc page is written in.

- Add `*.md` and `*.ipynb` to the includes.
- Report every banned word before failing instead of exiting on the
first match — this step pays a full clone, so the old behavior cost a CI
round-trip per misspelling.
- Fix the one occurrence this surfaced: `Kuberay` → `KubeRay` in
`doc/source/cluster/kubernetes/user-guides/tpu.md`.

The banned list itself is unchanged (`RLLib`, `Rllib`, `Kuberay`). I
added a comment noting the case-sensitive match is deliberate, since it
reads like a bug otherwise.

One occurrence is deliberately left: `Kuberay` in a Buildkite step label
in `.buildkite/release-automation/pre_release.rayci.yml`. `.yml` stays
out of the check's includes because config files aren't doc files, and
fixing it would pull another CODEOWNERS group in for one word. Happy to
include it if reviewers would rather.

## A note on scope

The narrower-than-obvious path set is intentional. Executable assets
under `doc/` such as `.py` and `.ipynb` are **not** exempt, because
`pre_commit` is the only premerge step that runs black, ruff, and mypy
over `doc/source/*.py` at all — exempting all of `doc/` would let a
`conf.py` formatting violation reach master. This is also why the
exemption isn't wired to the `docs-go` scope definition: that label is
an author-asserted escape hatch with a fail-closed guard, whereas this
exemption is automatic, so it stays limited to file types that cannot
carry code.

Note this PR is itself a mixed diff and so runs the full lint matrix —
it can't demonstrate its own skip. A subsequent prose-only PR is the
live proof.

## Testing

**Rule evaluation** — verified against the `ray-project/rayci` Go
evaluator (the authority for tag computation), not the in-repo reference
parser:

```
cd rayci && go run . -buildkite-dir <ray>/.buildkite test-rules
```

130 cases pass. Added cases to `always.rules.test.txt` covering prose,
images, and `doc/.claude/` (expect `always`), plus the negative cases
`doc/source/conf.py`, `.ipynb`, `examples.yml`, `doc/BUILD.bazel`, and
prose outside `doc/` (expect `always lint`). Confirmed non-vacuous by
appending a deliberately wrong expectation, which failed as expected —
worth noting that the `RAYCI_TEST_RULE_FILES` env var mentioned in
`test-rules`' usage text is not actually implemented, so passing it
makes the run auto-discover nothing and exit 0.

**Step selection** — simulated `acceptTagHit` against the new
`lint.rayci.yml`:

- emitted tags `{always}` → the 5 prose steps run, the 10 code-oriented
steps are filtered
- emitted tags `{always, lint}` → all 15 run

**`pre_commit_docs`** — ran the three hooks locally: all pass, 39s
versus 443s for the full `pre_commit` step.

**`banned_words`** — `./ci/lint/check-banned-words.sh` passes on the
tree. Verified non-vacuous: a temporary `doc/canary_banned.md`
containing all three words is now caught, reports all three in one run,
and exits 1; the previous version of the script passed that same file
silently.

**Lint on the changed files** — `shellcheck` and `bash -n` on both shell
scripts; pre-commit whitespace hooks clean.

## Not a duplicate

Searched open PRs for `always.rules`, `lint.rayci`, and the lint
matrix/microcheck area — no open PR touches `always.rules.txt`, the lint
matrix split, or `check-banned-words.sh`.

## AI assistance

AI assistance (Claude Code) was used for this change. I reviewed every
changed line and ran the test commands above locally.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…ay-project#65292)

## Why

A Markdown-only PR (ray-project#65285, one file under `doc/`) ran all 15 lint steps
and took 27+ minutes on `microcheck` ([build
51723](https://buildkite.com/ray-project/microcheck/builds/51723)).
`clang_format`, `bazel_buildifier`, `bazel_team`, `copyright_format`,
`dashboard_format`, `pytest_format`, `semgrep_lint`, and `test_coverage`
all ran against a one-file prose change. None of them can fail on
Markdown.

Almost none of that time was lint work. Aggregated across the lint
group: **~2,730s of checkout against ~1,275s of actual linting.**
`dashboard_format` spent 858s cloning to do 143s of work.

Two things made every step run:

1. `always.rules.txt` had no file-shape scoping at all — a bare `*`
catch-all emitting `always lint` for every changed file.
2. The lint steps carried `always` *in addition to* `lint`, so scoping
the `lint` tag alone would have changed nothing.

This PR doesn't address the per-job clone cost, which is
infrastructure-side and much the larger win. It removes 10 of 15 jobs
that pay it, which is where the pathological tail (858s, 1028s) came
from.

## What

**Skip the code-oriented lint steps on prose-only PRs**

- `always.rules.txt`: add a rule ahead of the catch-all that emits
`always` **without** `lint` for `.md`, `.rst`, image assets, and
`doc/.claude/`. The path set matches the existing prose skip rule in
`test.rules.txt` so the two files agree on what prose is.
- `lint.rayci.yml`: split the `lint-small` matrix in two. Steps a prose
change can actually fail keep `always`; the code-oriented steps carry
`lint` alone and are filtered out on a prose-only diff. Same for
pydoclint.
- `lint.sh`: add `pre_commit_docs`, running the three hooks that
actually reach prose (`trailing-whitespace`, `end-of-file-fixer`,
`check-added-large-files`). The other 20 hooks in `pre_commit` are
scoped to Python, C++, BUILD, TS/TSX, or shell. `pre_commit` runs every
hook with `--all-files`, so its 443s is independent of the diff — this
keeps the prose coverage without keeping the cost.

**No new tag is needed.** `always` is emitted for every file by the
catch-all, so `lint` alone carries the split, and now means "the diff
contains a file that is not documentation prose."

**Fail-safe by construction.** Tags union across changed files, so one
non-prose file anywhere in a diff re-emits `lint` and the full matrix
runs — mixed PRs lose no coverage. Non-PR builds bypass rule evaluation
entirely (`needRunAllTags` returns `["*"]` for master, release branches,
and manual builds), so **post-merge lint coverage is unchanged.**

The microcheck pipeline's hardcoded `RAYCI_SELECT=...,tag:lint` is not a
blocker: `stepFilter.accept` is `acceptSelectHit(step) &&
acceptTagHit(step)`, so selects and rule-emitted tags are ANDed.
`tag:lint` only makes these steps *eligible*; the rules still have to
emit `lint`. So the whole change lands in this repo, with no
pipeline-definition change.

**Make `banned_words` cover Markdown** (second commit)

While classifying which lint steps are prose-relevant, I found
`check-banned-words.sh` describes itself as checking "Python and doc
files" but only included `*.py` and `*.rst`. Since
`doc/test_no_new_rst.py` rejects newly added `.rst` files, the check was
blind to the format every new Ray doc page is written in.

- Add `*.md` and `*.ipynb` to the includes.
- Report every banned word before failing instead of exiting on the
first match — this step pays a full clone, so the old behavior cost a CI
round-trip per misspelling.
- Fix the one occurrence this surfaced: `Kuberay` → `KubeRay` in
`doc/source/cluster/kubernetes/user-guides/tpu.md`.

The banned list itself is unchanged (`RLLib`, `Rllib`, `Kuberay`). I
added a comment noting the case-sensitive match is deliberate, since it
reads like a bug otherwise.

One occurrence is deliberately left: `Kuberay` in a Buildkite step label
in `.buildkite/release-automation/pre_release.rayci.yml`. `.yml` stays
out of the check's includes because config files aren't doc files, and
fixing it would pull another CODEOWNERS group in for one word. Happy to
include it if reviewers would rather.

## A note on scope

The narrower-than-obvious path set is intentional. Executable assets
under `doc/` such as `.py` and `.ipynb` are **not** exempt, because
`pre_commit` is the only premerge step that runs black, ruff, and mypy
over `doc/source/*.py` at all — exempting all of `doc/` would let a
`conf.py` formatting violation reach master. This is also why the
exemption isn't wired to the `docs-go` scope definition: that label is
an author-asserted escape hatch with a fail-closed guard, whereas this
exemption is automatic, so it stays limited to file types that cannot
carry code.

Note this PR is itself a mixed diff and so runs the full lint matrix —
it can't demonstrate its own skip. A subsequent prose-only PR is the
live proof.

## Testing

**Rule evaluation** — verified against the `ray-project/rayci` Go
evaluator (the authority for tag computation), not the in-repo reference
parser:

```
cd rayci && go run . -buildkite-dir <ray>/.buildkite test-rules
```

130 cases pass. Added cases to `always.rules.test.txt` covering prose,
images, and `doc/.claude/` (expect `always`), plus the negative cases
`doc/source/conf.py`, `.ipynb`, `examples.yml`, `doc/BUILD.bazel`, and
prose outside `doc/` (expect `always lint`). Confirmed non-vacuous by
appending a deliberately wrong expectation, which failed as expected —
worth noting that the `RAYCI_TEST_RULE_FILES` env var mentioned in
`test-rules`' usage text is not actually implemented, so passing it
makes the run auto-discover nothing and exit 0.

**Step selection** — simulated `acceptTagHit` against the new
`lint.rayci.yml`:

- emitted tags `{always}` → the 5 prose steps run, the 10 code-oriented
steps are filtered
- emitted tags `{always, lint}` → all 15 run

**`pre_commit_docs`** — ran the three hooks locally: all pass, 39s
versus 443s for the full `pre_commit` step.

**`banned_words`** — `./ci/lint/check-banned-words.sh` passes on the
tree. Verified non-vacuous: a temporary `doc/canary_banned.md`
containing all three words is now caught, reports all three in one run,
and exits 1; the previous version of the script passed that same file
silently.

**Lint on the changed files** — `shellcheck` and `bash -n` on both shell
scripts; pre-commit whitespace hooks clean.

## Not a duplicate

Searched open PRs for `always.rules`, `lint.rayci`, and the lint
matrix/microcheck area — no open PR touches `always.rules.txt`, the lint
matrix split, or `check-banned-words.sh`.

## AI assistance

AI assistance (Claude Code) was used for this change. I reviewed every
changed line and ran the test commands above locally.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: 400Ping <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…ay-project#65292)

## Why

A Markdown-only PR (ray-project#65285, one file under `doc/`) ran all 15 lint steps
and took 27+ minutes on `microcheck` ([build
51723](https://buildkite.com/ray-project/microcheck/builds/51723)).
`clang_format`, `bazel_buildifier`, `bazel_team`, `copyright_format`,
`dashboard_format`, `pytest_format`, `semgrep_lint`, and `test_coverage`
all ran against a one-file prose change. None of them can fail on
Markdown.

Almost none of that time was lint work. Aggregated across the lint
group: **~2,730s of checkout against ~1,275s of actual linting.**
`dashboard_format` spent 858s cloning to do 143s of work.

Two things made every step run:

1. `always.rules.txt` had no file-shape scoping at all — a bare `*`
catch-all emitting `always lint` for every changed file.
2. The lint steps carried `always` *in addition to* `lint`, so scoping
the `lint` tag alone would have changed nothing.

This PR doesn't address the per-job clone cost, which is
infrastructure-side and much the larger win. It removes 10 of 15 jobs
that pay it, which is where the pathological tail (858s, 1028s) came
from.

## What

**Skip the code-oriented lint steps on prose-only PRs**

- `always.rules.txt`: add a rule ahead of the catch-all that emits
`always` **without** `lint` for `.md`, `.rst`, image assets, and
`doc/.claude/`. The path set matches the existing prose skip rule in
`test.rules.txt` so the two files agree on what prose is.
- `lint.rayci.yml`: split the `lint-small` matrix in two. Steps a prose
change can actually fail keep `always`; the code-oriented steps carry
`lint` alone and are filtered out on a prose-only diff. Same for
pydoclint.
- `lint.sh`: add `pre_commit_docs`, running the three hooks that
actually reach prose (`trailing-whitespace`, `end-of-file-fixer`,
`check-added-large-files`). The other 20 hooks in `pre_commit` are
scoped to Python, C++, BUILD, TS/TSX, or shell. `pre_commit` runs every
hook with `--all-files`, so its 443s is independent of the diff — this
keeps the prose coverage without keeping the cost.

**No new tag is needed.** `always` is emitted for every file by the
catch-all, so `lint` alone carries the split, and now means "the diff
contains a file that is not documentation prose."

**Fail-safe by construction.** Tags union across changed files, so one
non-prose file anywhere in a diff re-emits `lint` and the full matrix
runs — mixed PRs lose no coverage. Non-PR builds bypass rule evaluation
entirely (`needRunAllTags` returns `["*"]` for master, release branches,
and manual builds), so **post-merge lint coverage is unchanged.**

The microcheck pipeline's hardcoded `RAYCI_SELECT=...,tag:lint` is not a
blocker: `stepFilter.accept` is `acceptSelectHit(step) &&
acceptTagHit(step)`, so selects and rule-emitted tags are ANDed.
`tag:lint` only makes these steps *eligible*; the rules still have to
emit `lint`. So the whole change lands in this repo, with no
pipeline-definition change.

**Make `banned_words` cover Markdown** (second commit)

While classifying which lint steps are prose-relevant, I found
`check-banned-words.sh` describes itself as checking "Python and doc
files" but only included `*.py` and `*.rst`. Since
`doc/test_no_new_rst.py` rejects newly added `.rst` files, the check was
blind to the format every new Ray doc page is written in.

- Add `*.md` and `*.ipynb` to the includes.
- Report every banned word before failing instead of exiting on the
first match — this step pays a full clone, so the old behavior cost a CI
round-trip per misspelling.
- Fix the one occurrence this surfaced: `Kuberay` → `KubeRay` in
`doc/source/cluster/kubernetes/user-guides/tpu.md`.

The banned list itself is unchanged (`RLLib`, `Rllib`, `Kuberay`). I
added a comment noting the case-sensitive match is deliberate, since it
reads like a bug otherwise.

One occurrence is deliberately left: `Kuberay` in a Buildkite step label
in `.buildkite/release-automation/pre_release.rayci.yml`. `.yml` stays
out of the check's includes because config files aren't doc files, and
fixing it would pull another CODEOWNERS group in for one word. Happy to
include it if reviewers would rather.

## A note on scope

The narrower-than-obvious path set is intentional. Executable assets
under `doc/` such as `.py` and `.ipynb` are **not** exempt, because
`pre_commit` is the only premerge step that runs black, ruff, and mypy
over `doc/source/*.py` at all — exempting all of `doc/` would let a
`conf.py` formatting violation reach master. This is also why the
exemption isn't wired to the `docs-go` scope definition: that label is
an author-asserted escape hatch with a fail-closed guard, whereas this
exemption is automatic, so it stays limited to file types that cannot
carry code.

Note this PR is itself a mixed diff and so runs the full lint matrix —
it can't demonstrate its own skip. A subsequent prose-only PR is the
live proof.

## Testing

**Rule evaluation** — verified against the `ray-project/rayci` Go
evaluator (the authority for tag computation), not the in-repo reference
parser:

```
cd rayci && go run . -buildkite-dir <ray>/.buildkite test-rules
```

130 cases pass. Added cases to `always.rules.test.txt` covering prose,
images, and `doc/.claude/` (expect `always`), plus the negative cases
`doc/source/conf.py`, `.ipynb`, `examples.yml`, `doc/BUILD.bazel`, and
prose outside `doc/` (expect `always lint`). Confirmed non-vacuous by
appending a deliberately wrong expectation, which failed as expected —
worth noting that the `RAYCI_TEST_RULE_FILES` env var mentioned in
`test-rules`' usage text is not actually implemented, so passing it
makes the run auto-discover nothing and exit 0.

**Step selection** — simulated `acceptTagHit` against the new
`lint.rayci.yml`:

- emitted tags `{always}` → the 5 prose steps run, the 10 code-oriented
steps are filtered
- emitted tags `{always, lint}` → all 15 run

**`pre_commit_docs`** — ran the three hooks locally: all pass, 39s
versus 443s for the full `pre_commit` step.

**`banned_words`** — `./ci/lint/check-banned-words.sh` passes on the
tree. Verified non-vacuous: a temporary `doc/canary_banned.md`
containing all three words is now caught, reports all three in one run,
and exits 1; the previous version of the script passed that same file
silently.

**Lint on the changed files** — `shellcheck` and `bash -n` on both shell
scripts; pre-commit whitespace hooks clean.

## Not a duplicate

Searched open PRs for `always.rules`, `lint.rayci`, and the lint
matrix/microcheck area — no open PR touches `always.rules.txt`, the lint
matrix split, or `check-banned-words.sh`.

## AI assistance

AI assistance (Claude Code) was used for this change. I reviewed every
changed line and ran the test commands above locally.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Issues that should be addressed in Ray Core devprod docs An issue or change related to documentation go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants