Skip to content

[ci] Gate the docstring-only and docs-example-test labels with rayci label rules - #67341

Merged
elliot-barn merged 2 commits into
masterfrom
reef-209-label-rules-adoption
Oct 28, 2026
Merged

elliot-barn merged 2 commits into
masterfrom
reef-209-label-rules-adoption

Conversation

@dstrodtman

@dstrodtman dstrodtman commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Important

Draft until rayci ships label rules (rayci#510, rayci#511) and this PR bumps .rayciversion to that release. Don't merge it before then: today's rayci ignores *.labels.yaml, so removing the per-step gates would stop the docstring-only label from skipping Ray Data's suites.

Why are these changes needed?

The docstring-only and docs-example-test labels gate steps with Buildkite if: conditions, which Buildkite evaluates after rayci has selected the steps and marked their dependencies. That causes two problems:

  • Images build for steps that don't run. An unlabeled prose PR builds the 5 images only the opt-in step needs. An unlabeled Python PR builds docstringbuild for doc: docstring examples.
  • docstring-only covers only Ray Data. Each skipped step needs its own negated if:. Extending the label means a gate on nearly every premerge test step, and a new step that forgets one silently runs under the label.

rayci#510 and #511 let PR labels adjust step selection before dependency marking, through rules in .buildkite/*.labels.yaml. This PR adopts them.

What changes

  • Adds .buildkite/docs.labels.yaml with the following rules:
    • docstring-only keeps only steps tagged always, lint, doc_api, or docstring_examples. That's the same set a labeled Data PR runs today (doc/source/ray-contribute/ci.md): the docstring examples step, the two API surface checks, lint, and the scope guard, which is tagged always. It now applies to every library, not just Ray Data. Without the label, it skips doc: docstring examples.
    • docs-example-test skips the opt-in step without the label.
  • Tags the two steps in others.rayci.yml: docstring_examples on doc: docstring examples, and doc_example_optin on doc: docs example tests (opt-in).
  • Removes the 10 negated docstring-only gates from data.rayci.yml.
  • Keeps the positive if: gates on the examples step, the opt-in step, and the scope guard. They're redundant now, but they show a reader of the step why it's label-gated.

Behavior change to review

Under docstring-only, examples that need torch or TensorFlow are reported as skipped by the light examples image, and their library's doctest() target is skipped with the rest of the suites. Today that's true only for Ray Data. With this PR it's true for every library, so those examples get no premerge coverage on a labeled PR. ml: data integration tests, which #67237 gates with its own if:, is also covered by the keep-only rule, so that gate becomes redundant.

Duplicate check

No open PR adopts rayci label rules, which don't exist yet in a release. Related open PRs: #67237 adds a docstring-only gate to ml: data integration tests, and #67204 rewrites the docstring-only section of ci.md. The ci.md update for this change (the label covering every library) waits until #67204 lands, to avoid conflicting with it.

Testing

I generated the premerge pipeline locally with a Linux build of rayci #510 and #511 against this branch. Each row simulates a PR that changes one file:

Simulated PR rayci v0.50.0 on master This branch, unlabeled This branch, labeled
Doc prose (doc/source/data/aggregating-data.md) 11 steps 5 steps: the opt-in step and the 5 images only it needs drop 11 steps with docs-example-test
Ray Data docstring (python/ray/data/dataset.py) 51 steps 49 steps: doc: docstring examples and docstringbuild drop 19 steps with docstring-only
Core docstring (python/ray/actor.py) 165 steps 163 steps: the same 2 drop 19 steps with docstring-only

The 19 labeled steps are test-rules, the lint steps, the scope guard, both API surface checks, doc: docstring examples, and their images. Apart from the two dropped steps, unlabeled pipelines are identical to v0.50.0 on master. pre-commit run on the changed files passes. Once a rayci release exists, the .rayciversion bump goes here and premerge runs with and without each label.

This PR was prepared with AI assistance (Claude Code). It stays in draft until a human review of every changed line and a premerge run on the release.

…label rules

Add .buildkite/docs.labels.yaml, which rayci applies to step selection
before it marks dependencies:

- docstring-only keeps only steps tagged always, lint, doc_api, or
  docstring_examples, so the label skips every library's test suites,
  not just Ray Data's. It replaces the 10 per-step if: gates in
  data.rayci.yml. Without the label, doc: docstring examples is skipped
  and docstringbuild no longer builds.
- docs-example-test skips the opt-in step without the label, along with
  the images only it needs.

Requires a rayci release with label rules; .rayciversion is bumped
separately once one exists.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman
dstrodtman marked this pull request as ready for review October 28, 2026 15:33
@dstrodtman
dstrodtman requested a review from a team as a code owner October 28, 2026 15:33
@dstrodtman dstrodtman added the go add ONLY when ready to merge, run all tests label Oct 28, 2026

@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 the Buildkite CI configuration by introducing a new label-based step selection mechanism via the newly added .buildkite/docs.labels.yaml file. It removes inline docstring-only label checks from .buildkite/data.rayci.yml and instead configures centralized rules for docstring-only and docs-example-test labels. Additionally, it updates .buildkite/others.rayci.yml with corresponding tags (docstring_examples and doc_example_optin) and bumps the .rayciversion to 0.51.0. There are no review comments, so we have no feedback to provide.

@elliot-barn
elliot-barn merged commit afd1fc4 into master Oct 28, 2026
7 checks passed
@elliot-barn
elliot-barn deleted the reef-209-label-rules-adoption branch October 28, 2026 18:41
dstrodtman added a commit that referenced this pull request Oct 28, 2026
The docstring-only label now skips every library's test suites through .buildkite/docs.labels.yaml (#67341). Update the contributor CI page to match, recommend an @rtd-build commit line alongside the label, and describe which label-gated steps still show as broken.

Signed-off-by: Douglas Strodtman <[email protected]>
dstrodtman added a commit that referenced this pull request Oct 28, 2026
The docstring-only keep-only rule in .buildkite/docs.labels.yaml (#67341) already drops this step, so the per-step if: is redundant.

Signed-off-by: Douglas Strodtman <[email protected]>
dstrodtman added a commit that referenced this pull request Oct 28, 2026
Since #67341, the docs-example-test label rule drops the opt-in step before dependency marking, so unlabeled prose PRs no longer build its images.

Signed-off-by: Douglas Strodtman <[email protected]>
dstrodtman added a commit that referenced this pull request Oct 28, 2026
The docstring-only label now skips every library's test suites through .buildkite/docs.labels.yaml (#67341). Update the contributor CI page to match, recommend an @rtd-build commit line alongside the label, and describe which label-gated steps still show as broken.

Signed-off-by: Douglas Strodtman <[email protected]>
dstrodtman added a commit that referenced this pull request Oct 28, 2026
The docstring-only keep-only rule in .buildkite/docs.labels.yaml (#67341) already drops this step, so the per-step if: is redundant.

Signed-off-by: Douglas Strodtman <[email protected]>
dstrodtman added a commit that referenced this pull request Oct 28, 2026
Since #67341, the docs-example-test label rule drops the opt-in step before dependency marking, so unlabeled prose PRs no longer build its images.

Signed-off-by: Douglas Strodtman <[email protected]>
dstrodtman added a commit that referenced this pull request Oct 29, 2026
…per-page doctest targets (#67204)

## Why are these changes needed?

Several contributor-facing CI docs fell behind the docs CI changes that
merged this month.

- **`ci.md`, "Docstring-only changes."** The section still described
`data: docstring examples` and said the examples step covers Ray Data
only. Since #67083, `doc: docstring examples` in `others.rayci.yml` runs
the changed modules' `>>>` examples for every library that a CPU
`doctest()` target covers. It runs in the light `docstringbuild` image,
which has no torch or TensorFlow, and reports examples that need those
libraries as skipped, by name. Since #67341, the label also skips every
library's test suites through `.buildkite/docs.labels.yaml`, so the
section now says that, and recommends an `@rtd-build` commit line
alongside the label so Read the Docs builds the API reference the
docstrings render into.
- **`ci.md`, broken steps and post-merge builds.** A new "Why some steps
show as broken" section says that on a PR the label rules remove the
steps a label skips, so they don't appear at all, that the scope guard
is the one label-gated step still shown as `broken` on an unlabeled PR,
and that scheduled post-merge builds don't apply label rules, so all
three label-gated steps show as `broken` there. The page also
distinguishes the two kinds of post-merge build on `master`. The build
each merge starts doesn't run the docs example tests, and the scheduled
builds that the release automation triggers run the full suite, so the
page now says "scheduled post-merge builds" wherever it means those.
- **`writing-code-snippets.md`, "How to test examples with GPUs."** It
told readers to open `doc/BUILD` and exclude their page from a
`glob(["source/**/*.rst"])` catch-all target. Neither exists: #66809 and
#67003 replaced library-wide prose targets with per-page
`doctest_each()` lists. The steps now show both cases: a doc page moves
from its library's `doctest_each` list to the GPU `doctest` rule, and a
docstring module moves from the CPU glob's `exclude` to the GPU rule. A
new short section says how a page with its first runnable example joins
CI, which the `doc_prose_doctest_targets` lint enforces.
- **`docs.md` and `writing-style.md`.** Both said CI enforces Vale. The
`documentation_style` check is out of the `lint.rayci.yml` matrix for
now, so they say the check is temporarily off.
- **`ci/ray_ci/doc/README.md`.** It described only the doc build and the
API guard. It now covers the scripts behind the `docs-example-test` and
`docstring-only` labels and `linkcheck_report.py`.
- **`doc/README.md`.** It said CI doesn't run linkcheck. The postmerge
`doc: linkcheck` step does, as a soft-fail step that never blocks.

Docs-only. No CI or behavior changes.

## Related issue number

None. Follows #66806, #66809, #66814, #67003, and #67083.

## Duplicate check

Not a duplicate. `gh pr list --repo ray-project/ray --state open`
searches for `"ci.md docstring"`, `"writing-code-snippets"`, and
`"ci/ray_ci/doc README"` return two other open PRs that touch these
files, both mine, neither covering these sections:

- #65868 adds a "How to test a Ray Serve deployment" section to
`writing-code-snippets.md` at the same insertion point as this PR's new
section, so whichever merges second needs a trivial rebase.
- #66884 updates the LLM doc paths in `ci.md`, not the docstring-only
section.

## Testing

- Every changed claim was checked against `master` at 3ae1b8b:
`.buildkite/others.rayci.yml`, `.buildkite/data.rayci.yml`,
`.buildkite/lint.rayci.yml`, `.buildkite/doc.rayci.yml`,
`doc/BUILD.bazel`, `python/ray/train/BUILD.bazel` (the GPU rule examples
are copied from the real `doctest[train-gpu]` and
`py_doctest[train-gpu]` rules), `doc/test_prose_doctest_targets.py`, and
the scripts under `ci/ray_ci/doc/`.
- `pre-commit run` on the changed files passes, including the
master-link check.
- Not run: a Sphinx build. The Read the Docs preview on this PR is the
check.

AI assistance (Claude Code) was used to find the stale text and draft
the changes. I reviewed every changed line.

🤖 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]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
dstrodtman added a commit that referenced this pull request Oct 29, 2026
The docstring-only keep-only rule in .buildkite/docs.labels.yaml (#67341) already drops this step, so the per-step if: is redundant.

Signed-off-by: Douglas Strodtman <[email protected]>
dstrodtman added a commit that referenced this pull request Oct 29, 2026
Since #67341, the docs-example-test label rule drops the opt-in step before dependency marking, so unlabeled prose PRs no longer build its images.

Signed-off-by: Douglas Strodtman <[email protected]>
dstrodtman added a commit that referenced this pull request Oct 30, 2026
## Why are these changes needed?

Some docs and CI infrastructure files select GPU test steps even though
a change to them can't affect GPU behavior. The clearest case is
`doc/BUILD.bazel`: `.buildkite/test.rules.txt` routes it to `core_doc
data_doc ml_doc rllib_doc serve_doc llm`, so a one-line edit there
starts the Ray Data and Ray Serve docs example GPU steps and every LLM
GPU step, plus the GPU images they need. #67525 moves the LLM GPU steps
onto a reserved H100 pool that release tests also use, so an incidental
run now costs pool capacity, not only runner time.

rayci v0.51.0, the version `.rayciversion` pins, supports
`skip_tags_when_present` in `.buildkite/*.labels.yaml`. This PR uses it
to add an opt-out label.

## What changes

- **Adds a `skip-gpu-tests` rule** to `.buildkite/docs.labels.yaml`.
With the label, rayci skips every step tagged `gpu`, in every library,
along with the images only those steps need. Because label rules apply
before rayci marks step dependencies, the GPU images don't build either.
Without the label, nothing changes.
- **Documents the `skip_tags_when_present` mode** in the file's header
comment, next to the two modes it already describes.
- **Documents the label** in `doc/source/ray-contribute/ci.md`: a new
"Skipping GPU tests" section, with when not to use it, and a mention in
"Why some steps show as broken".

## Scope decision to review

The rule skips the shared `gpu` tag, not an LLM-only tag. `gpu` is on 19
steps across core, data, ml, rllib, serve, and llm. For the case this
targets, a `doc/BUILD.bazel` edit, that's the right scope, because the
same edit also selects the Data and Serve docs example GPU steps. An
LLM-only valve would need a new tag on the LLM GPU steps, which #67525
is rewriting. If reviewers prefer that narrower scope, the rule can
switch to that tag once #67525 lands.

The label is a judgment call by whoever applies it, and it needs write
access. Scheduled post-merge builds carry no PR labels, so they still
run every GPU step. A GPU failure the label hides surfaces there, after
merge.

## Related issues

Related to #67525, which migrates the LLM GPU steps to H100s. This PR
doesn't depend on it: the new 2-GPU step in #67525 carries the `gpu`
tag, so the rule covers it once it lands.

## Duplicate check

No open PR adds a label rule or a GPU opt-out. I searched open PRs for
`labels.yaml` and for GPU-skip labels. #67341 introduced
`docs.labels.yaml` with the `docstring-only` and `docs-example-test`
rules, and this PR follows its pattern.

## Testing

I built rayci v0.51.0 locally and generated the PR pipeline for a
simulated PR that changes only `doc/BUILD.bazel`, with this branch's
`docs.labels.yaml` as the base:

| Labels | Selected tags | Steps |
|---|---|---|
| `go` | `always core_doc data_doc lint llm ml_doc rllib_doc serve_doc`
| 61 |
| `go`, `skip-gpu-tests` | same | 51 |

The label drops exactly these 10 steps, and the two pipelines are
otherwise identical:

- `:database: data: docs example gpu tests`
- `:ray-serve: serve: docs example gpu tests`
- `llm gpu tests`, `llm gpu tests (4 GPUs)`, `llm custom vllm plugin gpu
test`
- The images only they need: `oss-ci-base_gpu-py3.10`,
`oss-ci-base_cu130-py3.12`, `docgpubuild-py3.10`, `llmgpubuild`,
`custom-vllm-plugin-gpubuild`

`pre-commit run` on the changed files passes.

Two follow-ups if this merges:

- A maintainer needs to create the `skip-gpu-tests` label on the repo.
- `.buildkite/docs.labels.yaml` matches no rule in `test.rules.txt`, so
this PR falls through to the catch-all `*` and runs a broad premerge.
That's unchanged from #67341. A rule for `.buildkite/*.labels.yaml`
could narrow it, but it belongs in its own change.

This PR was prepared with AI assistance (Claude Code).

🤖 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]>
dstrodtman added a commit that referenced this pull request Nov 2, 2026
The docstring-only keep-only rule in .buildkite/docs.labels.yaml (#67341) already drops this step, so the per-step if: is redundant.

Signed-off-by: Douglas Strodtman <[email protected]>
dstrodtman added a commit that referenced this pull request Nov 2, 2026
Since #67341, the docs-example-test label rule drops the opt-in step before dependency marking, so unlabeled prose PRs no longer build its images.

Signed-off-by: Douglas Strodtman <[email protected]>
dstrodtman added a commit that referenced this pull request Nov 3, 2026
…ttings in the examples runner (#67237)

## Description

Follow-ups to the `docstring-only` label (#66814, #67083) after its
first real campaign PRs on Ray Data. They're bundled into one PR because
they share files and all need ray-ci review. Stacked on #67204, which
updates the contributor docs this PR edits.


1. **Skip polars examples by name instead of marking them render-only.**
`Dataset.join` needs `polars`, which the light `docstringbuild` image
doesn't install, so #67202 marked the docstring `+SKIP_EXAMPLE`. That
also stopped it from running in `//python/ray/data:doctest`, whose image
installs polars through `test-requirements.txt`. This PR adds `polars`
to `OMITTED_LIBRARIES` and removes the flag. The examples step now
reports `SKIP Dataset.join (needs polars)`, and Data's target runs the
three `join` examples.
- Polars isn't added to the image. `polars==1.40.0` plus
`polars-runtime-32==1.40.0` is a 57 MB x86_64 wheel and about 195 MB
installed, larger than pyarrow at 136 MB, for one docstring. Every
current extra is 21 MB or less.
- **lance, the same way.** `Dataset.write_lance` needs `lance`, from the
`pylance` distribution. It's about 138 MB installed on Linux aarch64,
for one docstring, and Data's doctest image installs it through
`data-test-requirements.txt`. This PR adds `lance` to
`OMITTED_LIBRARIES`, so the examples step reports `SKIP
Dataset.write_lance (needs lance)`. #67238, stacked on this PR, converts
that docstring and `write_sql`'s from `testcode` to `>>>`.
- **LightGBM and XGBoost, the same way.**
`ray.tune.integration.lightgbm` and `.xgboost`, and Ray Train's LightGBM
and XGBoost modules, import these at module level. The image installs
neither, so a `docstring-only` change to one of those modules failed the
examples step at import, even though Tune's examples there are
render-only (`+SKIP_EXAMPLE`) and Train's are still `testcode`. The ML
images install both through
`python/requirements/ml/core-requirements.txt`, which meets the omit
rule in item 2. The step now reports `SKIP
python/ray/tune/integration/lightgbm.py (module needs lightgbm)`, and
likewise for `xgboost`. #67619, stacked on this PR, converts those two
Tune examples.
2. **Write the inclusion rule into
`docstring-examples-requirements.txt`.** The header now states when to
add a library to the image and when to omit it by name. Each entry names
the APIs whose examples need it, so it can go once those stop needing
it. Comment-only. `raydepsets --check` reports the locks unchanged.
3. **Apply Ray Data's doctest settings in the runner.**
`doctest_pytest_plugin.py` sets `preserve_order` and turns off
`print_on_execution_start` for every Data docstring. The runner applied
neither, so an order-dependent example could pass in its target and
flake in the step. It now applies both to `ray.data` modules and
restores them after each docstring.
4. **`ml: data integration tests` under the label.** This PR originally
added a negated `if:` gate to it. #67341 merged the `docstring-only`
keep-only rule in `.buildkite/docs.labels.yaml`, which drops this step
with every other library test step, so the gate is removed and
`ml.rayci.yml` is unchanged.
5. **Count the output a render-only docstring hides.** `+SKIP_EXAMPLE`
skips a whole docstring, so expected output inside it is never checked.
The skip line now names how many such examples there are. Across
`python/ray` at this commit, 26 docstrings carry the flag, and only
`Dataset.join` had expected output, which item 1 makes runnable. So the
count is a signal rather than a failure: a render-only example can
legitimately show sample output, such as for an external service.
6. **`check_docstring_only.py --base` diffs from the merge base.** It
diffed against the ref literally. After master moved past the branch
point, `--base upstream/master` flagged files the PR never touched. The
CI path, which already used the merge base, is unchanged. This matches
`run_docstring_examples.py`, and the `ci.md` instructions drop the
manual `git merge-base` wrapper.
7. **Stale comments.** The `doc_example` prose rule's comment in
`test.rules.txt` said an unlabeled prose PR still builds the opt-in
step's images. Since #67341, the `docs-example-test` label rule drops
the step before dependency marking, so the comment now says that. The
`doc: doctest` comment in `others.rayci.yml` still called
`//doc:doctest` the catch-all target, but #67003 split it into per-page
`team:none` targets. The `docstring examples` comment now names the
omitted libraries. It also said Buildkite drops the step on an unlabeled
PR that selects it, but Buildkite shows it as `broken`, and that the
skipped Ray Data examples run in "postmerge", which now says the
scheduled postmerge builds, since the build each merge starts doesn't
run them.

## Related issues

Related to #66814, #67083, #67202, and #67204. #67238 and #67619 are
stacked on this PR.

## Additional information

**Not a duplicate.** I searched open PRs for `run_docstring_examples`,
`check_docstring_only`, `docstring-only`, `OMITTED_LIBRARIES`, and `data
integration tests`. Only #67204, which this stacks on, touches these
files, and it changes docs only.

**Tests run**

- `bazel test //ci/ray_ci/doc:test_run_docstring_examples
//ci/ray_ci/doc:test_check_docstring_only`: both pass. New cases cover:
  - The `Dataset.join` polars message.
  - The hidden-output count.
- The Data settings, applied and restored, and left alone for other
modules.
  - `--base` against a base that moved past the branch point.
- `missing_library` for `lightgbm` and `xgboost` module-level imports.
For that commit I ran the suite with `pytest` directly rather than
through Bazel: 33 passed.
- `run_docstring_examples.py` on `dataset.py`, `aggregate.py`, and
`read_api.py`. I ran it in an aarch64 image built from
`docstring_examples_depset_py3.10.lock`, without `decord` (no aarch64
wheel) and `ray-haproxy`, with the Ray nightly at `093faf5583e`.
  - 114 docstrings ran, and `Dataset.join` skipped for polars.
- The one failure is `read_videos`, which needs decord. The x86_64 CI
image installs it.
- With polars installed, `Dataset.join` passes, and 115 docstrings run.
- With the Data settings, `Starting execution of Dataset` lines drop to
zero, and all 18 `aggregate.py` docstrings pass.
- `run_docstring_examples.py` on `ray.tune.integration.lightgbm` and
`.xgboost` from #67619, in a Python 3.12 virtualenv with
`ray[tune]==2.59.0` and neither library installed: both modules skipped
by name, 0 failed. Before this change, both failed at import.
- `bazel run //ci/raydepsets:raydepsets -- build
ci/raydepsets/configs/docs.depsets.yaml --check`: lock files are up to
date.
- `pre-commit run` on the changed files: passes.
- `rayci` v0.50.0 pipeline generation for a labeled Data docstring PR on
this branch, as above.

This PR's own premerge runs the Data and ML suites, because it changes
`dataset.py`. That run is also the check that Data's doctest image has
polars.

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

🤖 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

go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants