Skip to content

[ci] Add a docs-go label to skip code tests on content-only doc PRs - #64553

Merged
elliot-barn merged 4 commits into
ray-project:masterfrom
dstrodtman:docs-go-escape-hatch
Jul 10, 2026
Merged

elliot-barn merged 4 commits into
ray-project:masterfrom
dstrodtman:docs-go-escape-hatch

Conversation

@dstrodtman

@dstrodtman dstrodtman commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Why

Documentation content PRs — prose, restructuring, non-executable edits — currently trigger the per-team doc tests steps and the API annotation/consistency checks. Those steps are library/code tests that happen to be authored in or alongside the docs (docstring doctests, doc_code/ scripts, notebooks, testcode:: blocks); they tell you whether Ray code works, not whether the documentation is good. An author who knows a PR is content-only has no way to skip them, and a single doc asset fans the doc tests out across every library team.

The real documentation checks are the Read the Docs render build, linkcheck, and Vale — those are separate from the steps this touches and still run.

What

Adds a docs-go PR label, honored by a Buildkite if: guard on the code-test steps, so a PR labeled docs-go skips them:

if: '!(build.pull_request.labels includes "docs-go")'

This is the inverse of the continuous-build label pattern already used in these files. When the label is absent (the default), every step runs exactly as before, so unlabeled PRs are unaffected.

Guarded steps:

  • per-team doc tests: core, data (+ dask, + doc gpu), ml, rllib, serve (+ doc gpu)
  • doc: check API annotations, doc: check API doc consistency
  • the llm test suites (llm cpu tests, llm gpu tests, llm gpu tests (4 GPUs)), which run doc targets, so a doc/source/llm/** change reaches them

Scope guard (abuse protection)

Skipping tests via a label is only safe if the label can't be used to bypass tests that should run. A required guard step (lint: validate docs-go scope) runs whenever the label is present and fails the build unless every changed file is documentation content under doc/, excluding BUILD files. It's the one step the label does not turn off.

So:

  • docs-go on a genuinely content-only PR → doc/library tests skip, guard passes, mergeable.
  • docs-go on a PR that touches python/ray/**, .buildkite/**, bazel/**, src/, a doc/**/BUILD file, etc. → the tests skip but the guard fails and blocks the merge, so the label buys nothing.

The guard can't tell an editorial edit from a code edit inside a doc file (e.g. changing the code in a doc_code/ script). That's irreducible author judgment — it's why the label exists — and it's the narrow, low-stakes case the post-merge doc: build backstops.

Notes for review

  • Draft. The label is an author assertion, bounded by the scope guard above. The if:/tag composition, the actual skip behavior, and the guard's base-ref detection (it mirrors the .readthedocs.yaml post_checkout guard: git fetch origin master + merge-base) are only fully verifiable on a real premerge run — please confirm before this leaves draft.
  • The docs-go label must be created in the repo. Until it exists, an absent label just means "run everything," so this is safe but inert.
  • The llm guard is broad: llm folds its doc tests into its general suite, so docs-go skips the whole llm suite. That's correct for a genuinely content-only PR, and it's the clearest case for later separating the in-docs library tests from the library tag so a doc change routes only to a doc-scoped step.
  • The Read the Docs render is not currently a required check, so it doesn't block. That's an accepted starting point; the scope guard is what keeps docs-go from being abused in the meantime.

Documentation content PRs (prose, structure, non-executable edits) today
trigger the per-team "doc tests" steps and the API annotation/consistency
checks. Those are library/code tests that live in or next to the docs; they
validate code, not the documentation. An author who knows a PR is
content-only has no way to skip them, and a single doc asset can fan the
"doc tests" out across every library team.

Add a "docs-go" PR label, honored by a Buildkite `if:` guard on those steps,
so a PR labeled "docs-go" skips them while the Read the Docs render build
(the actual documentation check) still runs. This mirrors the existing
`continuous-build` label pattern already used in these files.

Guarded steps: the per-team doc tests (core, data + dask + gpu, ml, rllib,
serve + gpu), the API annotation and API doc consistency checks, and the llm
test suites (which run doc targets, so a doc/source/llm change reaches them).

The label is an author assertion; a mislabeled PR that changes executable
code is caught by the post-merge doc build. The exact skip behavior should be
confirmed on a real premerge run before this leaves draft.

Signed-off-by: Douglas Strodtman <[email protected]>

@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 updates multiple Buildkite configuration files to skip various documentation, API, and LLM tests when the pull request is labeled with "docs-go". I have no feedback to provide.

The docs-go label skips the per-team doc/example test steps and the API
consistency checks. Add a guard step that runs whenever the label is present
and fails the build unless every changed file is documentation content under
doc/, excluding BUILD files (which define test targets and must not change
under a test-skipping label).

This bounds what the label can do: it can skip tests on a genuinely
content-only PR, but it cannot be used to bypass tests that should run on a
code, CI, or build change -- the guard is the one step the label does not turn
off, and it blocks the merge if the diff escapes the doc/ envelope. It cannot
distinguish an editorial edit from a code edit inside a doc file; that stays
author judgment, backstopped by the post-merge doc build.

The base-ref detection mirrors the .readthedocs.yaml post_checkout guard.

Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman
dstrodtman marked this pull request as ready for review July 9, 2026 17:19
@dstrodtman
dstrodtman requested review from a team as code owners July 9, 2026 17:19
@dstrodtman dstrodtman added the go add ONLY when ready to merge, run all tests label Jul 9, 2026
@ray-gardener ray-gardener Bot added docs An issue or change related to documentation devprod labels Jul 9, 2026
@elliot-barn
elliot-barn merged commit e05eaaa into ray-project:master Jul 10, 2026
3 checks passed
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…ay-project#64553)

## Why

Documentation content PRs — prose, restructuring, non-executable edits —
currently trigger the per-team `doc tests` steps and the API
annotation/consistency checks. Those steps are library/code tests that
happen to be authored in or alongside the docs (docstring doctests,
`doc_code/` scripts, notebooks, `testcode::` blocks); they tell you
whether Ray code works, not whether the documentation is good. An author
who knows a PR is content-only has no way to skip them, and a single doc
asset fans the `doc tests` out across every library team.

The real documentation checks are the Read the Docs render build,
linkcheck, and Vale — those are separate from the steps this touches and
still run.

## What

Adds a **`docs-go`** PR label, honored by a Buildkite `if:` guard on the
code-test steps, so a PR labeled `docs-go` skips them:

```yaml
if: '!(build.pull_request.labels includes "docs-go")'
```

This is the inverse of the `continuous-build` label pattern already used
in these files. When the label is absent (the default), every step runs
exactly as before, so unlabeled PRs are unaffected.

Guarded steps:
- per-team doc tests: `core`, `data` (+ `dask`, + `doc gpu`), `ml`,
`rllib`, `serve` (+ `doc gpu`)
- `doc: check API annotations`, `doc: check API doc consistency`
- the `llm` test suites (`llm cpu tests`, `llm gpu tests`, `llm gpu
tests (4 GPUs)`), which run doc targets, so a `doc/source/llm/**` change
reaches them

## Scope guard (abuse protection)

Skipping tests via a label is only safe if the label can't be used to
bypass tests that *should* run. A required guard step (`lint: validate
docs-go scope`) runs whenever the label is present and **fails the build
unless every changed file is documentation content under `doc/`,
excluding BUILD files**. It's the one step the label does not turn off.

So:
- `docs-go` on a genuinely content-only PR → doc/library tests skip,
guard passes, mergeable.
- `docs-go` on a PR that touches `python/ray/**`, `.buildkite/**`,
`bazel/**`, `src/`, a `doc/**/BUILD` file, etc. → the tests skip but the
guard **fails and blocks the merge**, so the label buys nothing.

The guard can't tell an editorial edit from a code edit *inside* a doc
file (e.g. changing the code in a `doc_code/` script). That's
irreducible author judgment — it's why the label exists — and it's the
narrow, low-stakes case the post-merge `doc: build` backstops.

## Notes for review

- **Draft.** The label is an author assertion, bounded by the scope
guard above. The `if:`/tag composition, the actual skip behavior, and
the guard's base-ref detection (it mirrors the `.readthedocs.yaml`
`post_checkout` guard: `git fetch origin master` + `merge-base`) are
only fully verifiable on a real premerge run — please confirm before
this leaves draft.
- The **`docs-go` label must be created** in the repo. Until it exists,
an absent label just means "run everything," so this is safe but inert.
- The `llm` guard is broad: `llm` folds its doc tests into its general
suite, so `docs-go` skips the whole `llm` suite. That's correct for a
genuinely content-only PR, and it's the clearest case for later
separating the in-docs library tests from the library tag so a doc
change routes only to a doc-scoped step.
- The Read the Docs render is not currently a required check, so it
doesn't block. That's an accepted starting point; the scope guard is
what keeps `docs-go` from being abused in the meantime.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Signed-off-by: 400Ping <[email protected]>
elliot-barn pushed a commit that referenced this pull request Oct 13, 2026
…n that runs only the changed files' tests (#66806)

## Description

Doc-side edits no longer start a library's docs example tests. A new
`docs-example-test` label opts a PR back in, and it runs **only the
tests that name a changed doc file directly**. It never falls back to a
library's whole docs example suite and never runs GPU tests. This
replaces the `docs-go` label, which skipped the same steps by request
and needed a scope guard to stay safe.

### What changes by default

Doc assets under `doc/source/` (`.py`, `.ipynb`, `.yaml`) and
`doc/external/` stop emitting `<lib>_doc`. They now emit a new
`doc_example` tag, and only the label-gated opt-in step listens for it.
Coverage for everything else is unchanged:

| Change | Before | After, no label |
| --- | --- | --- |
| Library code, such as `python/ray/data/` | The library's suites,
including its docs example steps | Unchanged |
| `doc/BUILD.bazel`, example `BUILD.bazel` files | The owning library's
docs example steps | Unchanged, because they define test targets |
| `doc/test_myst_doc.py` (shared notebook runner) | `core: docs example
tests` | Unchanged |
| Data `doc_code/*.py` | All three Data docs example steps, including
GPU | No tests |
| LLM notebook under `doc/source/llm/` | Four llm suites, `llm:
wheel-aarch64 tests`, both API checks | No tests |
| Prose and images | No tests | No tests |

Postmerge still runs every docs example suite in each library's own
image.

`doc/source/llm/` and `doc/source/data/doc_code/working-with-llms/` move
off the raw `llm` tag. Every LLM doc example test is tagged `gpu`, so
these paths route to nothing rather than starting the llm library
suites.

### The opt-in

With the `docs-example-test` label, the new `doc: docs example tests
(opt-in)` step in `others.rayci.yml` does the following:

1. Runs `//ci/ray_ci/doc:cmd_doc_example_targets`, which diffs the PR
against its base branch and maps each changed file under `doc/source/`
or `doc/external/` to the Bazel test targets that reference it directly.
A target matches when it names the file in `srcs` or `data`, or, for a
notebook test, as the file in its `--path` argument. A file that a test
reaches only through a filegroup doesn't count.
1. Reports in the step log, instead of running, any GPU target and any
library-wide `doctest()` target that takes every prose file of a
library. Only Ray Data has per-file prose targets today
(`doctest_each`), so Data prose is the only prose the opt-in can test
file by file. Data `.md` and `.rst` therefore route to `doc_example`
too.
1. Runs the selected targets once per team, all in the existing
`doctestbuild` image. That's a single Python 3.10 environment whose
dependency set covers core, data, train, tune, rllib, and Serve. It
doesn't use each library's own per-version images.

**The opt-in runs on premerge only, by design.** Apply both
`docs-example-test` and `go`. Microcheck selects steps from an
allow-list of step IDs: the steps where its high-impact and changed
tests last ran, according to the test database. The pipeline settings
set that list through `RAYCI_SELECT`, and a new step with no test
history never appears on it. A smoke test confirmed this in microcheck
build
[#55791](https://buildkite.com/ray-project/microcheck/builds/55791).
With the label on and five doc files changed, rayci selected
`doc_example`, but microcheck ran lint only. That's the intended
outcome: microcheck on a docs PR stays light, and the focused tests run
when the PR goes to premerge.

`tester.py` gains `--exact-targets`, which stops microcheck-style
narrowing of an explicit target list to high-impact and srcs-changed
tests. Premerge doesn't narrow, so the flag matters only if microcheck
ever runs this step. Without it, microcheck would silently drop notebook
and prose targets, because they aren't `srcs`.

To preview what the label would run:

```bash
bazel run //ci/ray_ci/doc:cmd_doc_example_targets -- doc/source/data/doc_code/key_concepts.py
```

### Retiring `docs-go`

This PR removes the label's `if:` guards from 12 steps, the `lint:
validate docs-go scope` step, and `ci/lint/validate_docs_go_scope.sh`.
Open PRs that carry the label keep working, since skipping is now the
default. The contributor docs (`ci.md`, `writing-code-snippets.md`,
`doc/AGENTS.md`) are updated in this PR. That includes correcting the
`ci.md` claim that prose can't change tested code. Prose can carry
doctests.

### Known cost

rayci evaluates tags, not labels. A gated step that tags select still
pulls its `depends_on` image builds into the build, even when Buildkite
then drops the step. So an unlabeled PR that edits a doc asset or Data
prose emits five cached Python 3.10 image jobs (`oss-ci-base_test`,
`oss-ci-base_build`, `doctestbuild`, `ray-core-build`,
`ray-dashboard-build`) and runs no tests. For a Data `doc_code` edit
that's 10 jobs in total, down from 24. A follow-up rayci change, which
drops label-gated steps before dependency marking, would make the
unlabeled cost zero.

## Related issues

Related to #64553, which introduced `docs-go`.

## Additional information

**Not a duplicate.** I searched open PRs for `docs-go`,
`docs-example-test`, and doc example test routing, and found none that
change this behavior.

**Tests run, all passing:**

- `bazel test //ci/ray_ci/doc:test_doc_example_targets
//ci/ray_ci:test_tester //ci/pipeline/...`
- `rayci test-rules`, built from rayci v0.48.0, the version
`.rayciversion` pins. It covers all 182 expectations in
`.buildkite/test.rules.test.txt`, which this PR updates. I confirmed it
fails on a planted wrong expectation.
- The selector against the real `bazel query 'tests(//doc/...)'` output
(281 targets), one file per kind:
- A Data `doc_code` file and `data/working-with-tensors.md` each map to
their own target.
  - A notebook maps by `--path`.
  - A Serve page reports its library-wide `doctest[serve]` target.
  - An LLM notebook reports as GPU-only.
  - The shared notebook runner is ignored.
- `ci/ray_ci/doc/run_doc_example_tests.sh` with a stubbed `bazel`, to
check the per-team grouping and that a failure exit code propagates.
Also run with no changed files, to check it exits 0 without starting a
container.
- `rayci` pipeline generation for simulated PR builds, old base against
this branch, for the cases in the table above.

Not yet run: the opt-in step itself on Buildkite. Whether every
library's selected doc tests pass in `doctestbuild` gets proven on the
first labeled PR.

**AI assistance:** I wrote this PR with Claude Code (Claude Opus 5.5)
and reviewed the changes myself.

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

---------

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

Labels

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