Repository navigation
[ci] Reserve the doc tag for doc validation; route doc example tests per library - #64775
Conversation
…per library The per-team "X: doc tests" steps are library example and doctest suites that happen to live under doc/. They were tagged `doc`, and every executable doc asset emitted `doc`, so a one-library doc change fanned out to every team's step. The name also implied the steps validate the documentation, when they exercise library code. Give each step a dedicated <lib>_doc tag (core_doc, data_doc, ml_doc, serve_doc; rllib already had the near-dedicated rllib_directly) and route doc/source/<lib>/** to it in test.rules.txt, so a doc change runs only the owning library's example tests instead of every team's. Reserve the `doc` tag for documentation validation (build/render, Vale). Rename the steps to "X: docs example tests" to match what they run. Executable doc assets in unowned dirs fall to the core step as the catch-all. Also fix the doc build-file rule: test.rules.txt matched `doc/BUILD` and `doc/*/BUILD`, but the files are BUILD.bazel, so editing a file that defines the doc test targets ran no doc tests premerge. Match the .bazel files and route them to the same per-library steps. The library tag stays on each step, so a library code change still runs its doc example tests. The docs-go content-only skip is unaffected. Adds test.rules.test.txt coverage for the new routing. Signed-off-by: Douglas Strodtman <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request refactors the Buildkite CI configuration to route executable documentation assets (such as Python scripts and Jupyter notebooks) to library-specific doc tags (such as core_doc, data_doc, ml_doc, rllib_doc, and serve_doc) instead of a single blanket doc tag. This ensures that documentation changes for a specific library only trigger tests for that library rather than running tests across all teams. There are no review comments, so I have no feedback to provide.
doc/source/conf.py and the in-repo Sphinx extensions under doc/source/_ext/ are consumed only by the -W documentation build, not by any library's doctest or example execution. Without an explicit rule they fell through to the catch-all doc/*.py -> core_doc, so a config or extension change would kick off Ray Core's doctest and example steps while never running the docs build that actually exercises them. Route both to the doc validation-infra rule so they emit only the doc tag. A change to the Sphinx config or a build extension now triggers the docs build, linkcheck, API checks, and Vale, and no library code execution. Add replay cases pinning conf.py and _ext/ to the doc tag. Signed-off-by: Douglas Strodtman <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request refactors the documentation test routing by replacing the blanket doc tag with dedicated library-specific tags (such as core_doc, data_doc, ml_doc, rllib_doc, and serve_doc). This ensures that changes to executable doc assets only trigger tests for the owning library. The reviewer noted that routing entire directories to these tags will cause non-executable assets like images to unnecessarily trigger the doc example tests, and suggested adding common image extensions to the skip rules in .buildkite/test.rules.txt to prevent this.
| # (.md/.rst) is skipped by the leading rule; the llm doc assets are routed to | ||
| # `llm` earlier. Each directory rule also covers that library's example | ||
| # BUILD.bazel files. | ||
| doc/source/data/ |
There was a problem hiding this comment.
By routing the entire directory doc/source/data/ (and other library doc directories below) to <lib>_doc tags, any change to non-executable assets (such as images like .png, .svg, .jpg, .gif) under these directories will now trigger the library's doc example tests. Previously, these files fell through to the catch-all doc/ skip rule at the end of the file and triggered nothing.\n\nTo prevent image/diagram updates from unnecessarily running the doc example tests, we should add common image extensions to the skip rule at the top of .buildkite/test.rules.txt (around line 29):\n\ntxt\ndoc/*.md\ndoc/*.rst\ndoc/*.png\ndoc/*.svg\ndoc/*.jpg\ndoc/*.jpeg\ndoc/*.gif\n# pass\n;\n
There was a problem hiding this comment.
Applied in b1d0362, thanks. Added .png, .svg, .jpg, .jpeg, .gif, and .webp to the leading skip rule, which is the right placement: it precedes the per-library rules and matching is first-match-wins, so it takes priority over the directory match.
This was the highest-value finding on the PR. 310 tracked image files were routed to a library's docs example step where before this rework they fell through to the trailing doc/ skip and triggered nothing:
| png | svg | gif | jpg | total |
|---|---|---|---|---|
| 158 | 145 | 6 | 1 | 310 |
One deliberate narrowing of the suggestion: I left .yaml and .sh routed rather than skipping every non-executable extension. Those assets can change what a test actually does, unlike an image, so under a library doc dir they keep routing to that library. Added replay cases for both directions.
… tag Two follow-ups from bot review of the doc-tag rework. Static images. The per-library rules match whole directories, so a .png or .svg edit under doc/source/<lib>/ routed to that library's docs example step, where before this rework it fell through to the trailing doc/ skip and triggered nothing. Adds the image extensions to the leading prose-skip rule, ahead of the per-library rules. 310 tracked image files stop triggering example tests. Config and script assets examples consume (.yaml, .sh) are deliberately left routed, since they can change what a test does. Sphinx build modules. conf.py imports custom_directives, api_autogen, template_collections, and api_mock_imports, and none of them were listed in the validation-infra rule, so they fell to the doc/*.py catch-all and emitted core_doc. That ran Ray Core's doctests and example execution for a docs-build-machinery edit while never running the documentation build that actually exercises them. Adds those four plus preprocess_github_markdown and the doc-root build helpers (load_doc_cache, update_cache_env, rtd_doctor, test_no_new_rst), 9 files moving from core_doc to doc. The modules are enumerated individually rather than matched with a doc/source/*.py pattern: * is fnmatch here and crosses /, so a pattern would also swallow every example script under doc/source/<lib>/doc_code/ and stop those from reaching the per-library rules. Noted in the rule comment. Also documents why doc/test_myst_doc.py stays on the catch-all core step rather than fanning out to all five library tags, so the trade is explicit for the next reader. Verified by replaying all 90 test.rules.test.txt cases through the in-repo rule parser (ci/pipeline/determine_tests_to_run.py): check_rules() passes and 90/90 cases match. Additionally swept all 1626 tracked doc/ files and asserted every image skips, all 10 infra modules emit exactly doc, and all 273 library example scripts and notebooks still carry their library's tag. AI assistance was used for this change. Signed-off-by: Douglas Strodtman <[email protected]>
ray-project#64458 adds doc/test_llms_txt.py and doc/source/llms_txt_summary.txt but no test.rules.txt change, so on merge the test would land on the doc/*.py catch-all and emit core_doc. That runs Ray Core's doctests and example execution for a test whose own docstring describes it as hermetic: it builds a tiny Sphinx project in a temp dir, in-process, with no network and no Ray import, and needs only sphinx and myst-parser. It also would not run the :book: doc: test llms.txt extension step that actually executes it, since that step is tagged doc. The summary file is worse off: as a bare .txt under doc/source/ it matches no rule and falls through to the trailing doc/ skip, so editing the text the generator injects into llms.txt would verify nothing at all. Routes both to doc. Rules for absent paths are inert, so this is safe to land first and means ray-project#64458 merges correctly scoped with no follow-up and no ordering dependency in either direction. Note for anyone tracing the doc tag's premerge behavior: ray-project#64458's new step carries no skip-on-premerge, unlike doc: build. Once it lands, doc is a live premerge selector again rather than a post-merge-only one. Replayed all 92 test.rules.test.txt cases through ci/pipeline/determine_tests_to_run.py: check_rules() passes, 92/92 match, and the full doc/ sweep invariants still hold. AI assistance was used for this change. Signed-off-by: Douglas Strodtman <[email protected]>
…o ml_doc Two scoping corrections, both closing gaps where a change would run a step that cannot test it. doc/.claude/ triggers nothing. Claude Code skills and agent files never participate in the Sphinx build and define no test targets, but doc/.claude/skills/sphinx-fix/sphinx_fix.py matched the doc/*.py catch-all and emitted core_doc. The RtD build guard already excludes this exact path for the same reason (the :!doc/.claude/ exclude in .readthedocs.yaml); the two guards now agree. On master this file emits the blanket doc tag, which reaches all five per-team doc test steps, so this is a fix for pre-existing behavior rather than a regression introduced here. The five team:ml notebooks under ray-core/ route to ml_doc. highly_parallel, plot_hyperparameter, batch_prediction, plot_parameter_server, and plot_pong_example live under doc/source/ray-core/examples/ but their targets in doc/BUILD.bazel are tagged team:ml. The team argument to ci/ray_ci:test_in_docker filters targets by team:<team> (_get_all_test_query, ci/ray_ci/tester.py:372), so the core step does not execute them. Routing them to core_doc would have run a step that tests everything under ray-core/ except the file that changed. They now route to the step that owns the targets. Re-tagging those targets team:core in doc/BUILD.bazel is the alternative fix and would let the five rule lines go away. Recorded in the rule comment so the choice is legible. Replayed all 96 test.rules.test.txt cases through ci/pipeline/determine_tests_to_run.py: check_rules() passes, 96/96 match. The doc/ sweep invariants hold, with the team:ml-under-core exception now asserted explicitly rather than tripping the directory heuristic. The core_doc catch-all population is down to 30 files. AI assistance was used for this change. Signed-off-by: Douglas Strodtman <[email protected]>
Relocate doc/test_llms_txt.py to doc/source/_ext/test_llms_txt.py so it sits beside the extension it covers and is routed by a directory rule rather than a per-file line in .buildkite/test.rules.txt. The rules file matches with fnmatch, whose `*` crosses `/`, so `doc/*.py` already routes everything under doc/ to the `doc` tag today; the move keeps that correct while making the test fall under the `doc/source/_ext/` rule once #64775 narrows `doc` to doc-build infra and sends `doc/*.py` to the per-library `<lib>_doc` tags. Adjust _EXT_DIR to the file's own directory and update the Buildkite command to the new path. No Bazel target picks the file up: doc/BUILD.bazel's `source/**` globs match .md/.rst only, and its .py globs name specific doc_code/ dirs. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: Ronny Roland <[email protected]>
doc/.claude/CLAUDE.md still described the pre-ray-project#64775 model, where a single doc tag covered content under doc/. Replaces that with the current three-way split (doc for build and validation infra, <lib>_doc for executable doc assets, doc_api for the API reference surface), notes that prose and images trigger nothing, and adds the docs-go label and its scope guard. Also corrects two smaller drifts: the docs deplock rule now emits doc_api as well, and the 'tag it doc' advice under 'When to revise the test rules' pointed at a tag that no longer selects content steps. Signed-off-by: Douglas Strodtman <[email protected]>
…cipe (#65285) ## Why this change `doc/source/ray-contribute/ci.md` explains what CI runs on a PR, but stops at `microcheck` and the `go` label. It says nothing about what runs when the PR changes documentation, which is the case the page's likely reader is in. This adds that, and folds in a recipe for reproducing the API consistency check locally. ### What's new **"Documentation CI checks"** covers, in the order a contributor meets them: - The Read the Docs render gate, including that `fail_on_warning: true` makes any Sphinx warning a build failure, and when the preview build skips. - The two API surface checks, and the `doc_api` tag that lets an API reference page edit reach them even though it's a documentation change. - The per-library `<library>: docs example tests` steps, with a table mapping path to step to tag, plus the Ray Core fallback and the Ray LLM exception. - That a prose-only or image-only change runs no library test steps at all. - The `docs-go` label and the `lint: validate docs-go scope` guard that bounds it. - The two post-merge-only steps, `doc: build` and `doc: linkcheck`. **"Running the API consistency check locally"** documents the three phases of `api_policy_check`, what the `docbuild` image does and doesn't install (the deep-learning backends are mocked even in CI), and a `uv` recipe that gets close enough for iteration. It also updates one example commit message under the `microcheck` section that named the old `serve doc tests` step label. **`doc/.claude/CLAUDE.md`** carried the same staleness, so it's fixed in the same PR. It still said the `doc` tag "covers content under `doc/`", which stopped being true when #64775 landed. It now describes the three-way split (`doc` for build and validation infra, `<lib>_doc` for executable doc assets, `doc_api` for the API reference surface), records that prose and images trigger nothing, and documents the `docs-go` label and its scope guard. Two smaller drifts are corrected alongside: the docs deplock rule emits `doc_api` now too, and the "tag it `doc`" advice pointed at a tag that no longer selects content steps. This file is an agent instruction file rather than published documentation, so it's worth saying why it rides along here instead of going out separately. `AGENTS.md` requires a dedicated PR for changes to itself, which this isn't. `doc/.claude/` is on the skip rule in `test.rules.txt` and excluded from the Read the Docs build guard, so including it changes this PR's trigger set by nothing. And it's the same factual correction as the page, from the same source reading — splitting them would mean verifying the same CI configuration twice and risking the two descriptions drifting apart again. ## Not a duplicate This supersedes two of my own open PRs and replaces both: - #64842 added a documentation CI overview. It was written before #64775 landed and describes the pre-rework model, where a single `doc` tag selected the per-team doc test steps. That's no longer how routing works, so landing it as-is would have documented the wrong thing. - #64450 added the local API-check section. Its content is carried over here essentially unchanged. Both branched from the same pre-#64775 commit and added an identically titled section, so they also conflicted with each other. Combining them is cheaper to review than rebasing two PRs that overlap. I'm not aware of another open PR touching this page. Checked with `gh pr list --repo ray-project/ray --state open --search "ray-contribute ci.md"`. ## Verification Every factual claim was checked against `master` at `695a8814ea` rather than carried over from the superseded PRs: - Step labels, tags, and `if:` guards read from `.buildkite/doc.rayci.yml`, `core.rayci.yml`, `data.rayci.yml`, `ml.rayci.yml`, `rllib.rayci.yml`, `serve.rayci.yml`, and `lint.rayci.yml`. - Path-to-tag routing read from `.buildkite/test.rules.txt`. - The render gate behavior read from `.readthedocs.yaml` (`fail_on_warning: true`, the `post_checkout` skip guard) and `doc/Makefile`. - The mocked-backend claim checked against `ci/docker/doc.build.Dockerfile`, which stages the `ray-core` and `ray-dashboard` artifacts and installs only the docs lock, and `doc/source/api_mock_imports.py`, which lists `torch`, `transformers`, and `tensorflow`. This corrects #64842, which claimed the base images supply those libraries for real. - `doc: build`'s upload behavior read from `ci/ray_ci/doc/cmd_build.py` (postmerge, `master` only). - The `docs/readthedocs.com:anyscale-ray` check name confirmed from the status checks on an open PR. Commands run: ``` vale --config=.vale.ini doc/source/ray-contribute/ci.md python doc/test_no_new_rst.py pre-commit run --files doc/source/ray-contribute/ci.md ``` `test_no_new_rst.py` passes. `pre-commit` reports no applicable hooks for a Markdown file under `doc/source/`. Vale surfaces no new findings in the added text beyond spelling hits on project vocabulary (`Buildkite`, `premerge`, `docbuild`, `autodoc`, `autosummary`, `toctree`); note that CI's `documentation_style` lint scopes Vale to `doc/source/data` and `doc/source/ray-overview/examples`, so this page isn't in its path set. The same source reading backs the `doc/.claude/CLAUDE.md` edit; it asserts nothing the page doesn't. Rendering verified by parsing the page with `myst-parser` using the repo's `myst_heading_anchors = 4`: the table, the `{warning}` directive, and the heading hierarchy all parse, with no skipped heading levels. Both cross-references (`writing-code-snippets.md`, `docs.md#building-the-ray-documentation`) point at existing `.md` sources and an existing heading. The Read the Docs preview on this PR is the real render check. ## AI assistance AI assistance (Claude Code) was used to draft this change and to cross-check the claims against the CI configuration. I've reviewed every line. --------- Signed-off-by: Douglas Strodtman <[email protected]>
…ep (#65289) ## Why this change The trailing catch-all in `.buildkite/test.rules.txt` routes any remaining `.py` or `.ipynb` under `doc/` to `core_doc`. For a few directories that starts Ray Core's docs example step for files the step cannot run, because no bazel target covers them: - `doc/BUILD.bazel` names `source/templates/` exactly once, and it's a doctest *exclusion*. - Nothing covers `doc/source/cluster/doc_code/`, `doc/source/ray-contribute/doc_code/`, or `doc/source/_templates/`. So the step spins up, runs Core's own targets, and never touches the file that changed. Cost without signal. This is a follow-on to #64775, which introduced the per-library `<lib>_doc` tags and left this population on the catch-all deliberately, pending a check of what was actually there. ## What it does Splits the population by what the documentation build actually reads. **Routed to `doc` (build and validation only).** Sources a rendered page pulls in with `literalinclude`. Nothing executes them, but Sphinx reads them, so a rename or delete breaks the including page and the build is the only premerge check that can catch it. Same reasoning #64775 applied to `highly_parallel.ipynb`. - `doc/source/cluster/doc_code/` — included by four `cluster/vms/user-guides/community/` pages - `doc/source/ray-contribute/doc_code/` — included 3x by `writing-code-snippets.md` - `doc/source/templates/05_dreambooth_finetuning/` — included ~12x by `train/examples/pytorch/dreambooth_finetuning.rst` **Skipped.** `exclude_patterns` in `doc/source/conf.py` drops `templates/*` from the build outright, so Sphinx never reads any of it. `01`–`03` have no reference anywhere in the repo; `04` is cited only as a GitHub URL from `train/deepspeed.rst`, `train/huggingface-accelerate.rst`, and the Train examples gallery, none of which a build step resolves. `_templates/template.ipynb` is boilerplate contributors copy, linked as a GitHub URL from `ray-contribute/docs.md`. - `doc/source/templates/` (01 through 04) - `doc/source/_templates/` Images and prose under the `doc`-routed directories are unaffected: the leading prose-and-image skip still matches them first, as everywhere else in the tree. The dreambooth page's `.. image::` targets therefore stay skipped, consistent with every other doc image. Widening that is a separate decision and belongs in that rule. ## Blast radius Dry-ran `ci/pipeline/determine_tests_to_run.py` over **all 10,255 tracked files**, before and after: - **33 paths change routing. All are under `doc/`. Zero outside.** - 14 move `core_doc` → `doc` (the `literalinclude` sources) - 11 move `core_doc` → nothing (templates 01–04, `_templates`) - 8 move nothing → `doc` (non-`.py` include inputs such as `slurm-basic.sh`, `ray-skein.yaml`, `dreambooth_run.sh`, which the catch-all's `.py`/`.ipynb` patterns never reached) Net: 25 files stop starting a docs example step that couldn't run them; 8 gain the documentation build, which is the cheap step and the one that can catch a broken include. These are directory rules, matching how `doc/external/` is handled. That means four non-included assets under `05` (its Dockerfile, two compute configs, `requirements.txt`) start the build too. Deliberate trade — enumerating individual include targets would rot the moment someone adds a `literalinclude`. ## Tests Added 8 cases to `.buildkite/test.rules.test.txt`, including two regression guards: that the leading prose-and-image skip still wins *inside* a `doc`-routed directory, and that `doc/test_myst_doc.py` stays on `core_doc` so the catch-all keeps working for its real purpose. ``` $ python ci/pipeline/determine_tests_to_run.py # replayed over every fixture case fixture cases: 124 evaluated: 124 mismatches: 0 ``` All 124 cases pass, the 116 pre-existing ones included. `pre-commit run --files .buildkite/test.rules.txt .buildkite/test.rules.test.txt` passes. The authoritative tag computation is the external `rayci` `test-rules` step, not this in-repo parser, so premerge on this PR is the real confirmation. ## Not a duplicate No open PR touches `.buildkite/test.rules.txt` (`gh pr list --search "test.rules.txt in:title,body"` returns four unrelated PRs). This continues #64775, which is merged. ## Follow-up, deliberately not in this PR `doc/source/templates/README.md` documents a contribution workflow that can't be followed: it points at `templates.yaml`, `testing/validate.py`, `testing/release/`, and `//doc:workspace_templates`, none of which exist. Templates `01`–`03` look like orphaned 2.6-era artifacts and are probably deletable, but `04` and `05` are not, since published pages link to or inline them. That's content cleanup with its own reviewers, and external links to those GitHub paths may exist, so it wants a maintainer's call separately. --- AI assistance was used to research and draft this change. Opening as a draft for my own review pass before requesting maintainer review. Signed-off-by: Douglas Strodtman <[email protected]>
## Why this change `.buildkite/others.rayci.yml` has a step labeled `doc tests`, tagged `python`. **`python` is declared in no `.rules.txt` file and emitted by no rule.** It isn't in the tag-declaration block of `test.rules.txt` or `always.rules.txt`, and no rule emits it. In `raycicmd/step_filter.go`, `acceptTagHit` returns early only when `runAll` is set; the `noTagMeansAlways` escape doesn't apply because the step *does* carry a tag, so it falls through to `step.hasTagInMap(f.tags)` and misses. On non-pull-request builds `needRunAllTags` returns `["*"]`, `runAll` is set, and the step runs. So the step is postmerge-only, but by accident rather than by intent. Nothing in the file says so, and the behavior rests on a tag that reads like it means something. Confirmed against real builds: - Premerge [71703](https://buildkite.com/ray-project/premerge/builds/71703) — 231 jobs, the broadest recent build, with all five per-library docs example steps present. A job named `doc tests` is **absent**. - Postmerge [19099](https://buildkite.com/ray-project/postmerge/builds/19099) — 923 jobs. `doc tests [g14_s1]` is **present** and passed. It's also the last step in the repo still called `doc tests`, after #64775 renamed the per-library steps to `<library>: docs example tests`. `git grep 'label:.*doc test'` returned exactly this one line. That's a naming collision with five steps that do something else: those execute a library's documentation examples, while this one runs `//doc:doctest`, the catch-all doctest target for documentation prose that no library owns (tagged `team:none`). The per-library steps each filter on their own `team:<lib>`, so this is the only step that reaches it. ## What this changes Tags and label only. **No behavior change** — the step runs exactly where it ran before. - **`skip-on-premerge`** states the existing postmerge-only behavior explicitly, instead of leaving it to an unmatched tag. Matches `doc: build` and `doc: linkcheck` in `doc.rayci.yml`, and the postmerge-only minimal-tests step in `core.rayci.yml`, which uses the same pattern with a comment. - **`doc`** is the build-and-validation tag, which is what this step is. It does **not** re-enable the step on premerge: skip tags are rejected in the filter's first pass (`hit = !reject(step) && accept(step)`) before tag selection runs. That's why `doc: build` carries `doc`, a rule-emitted tag, and is still postmerge-only. - **`oss`** matches the sibling doc steps. - **`python`** is dropped. It stays on `core_minimal_tests_postmerge` in `core.rayci.yml`, where it's harmless because that step also carries real tags and an explicit `skip-on-premerge`. - The label becomes **`doc: doctest`**, after the target it runs, matching the `doc:` prefix the other doc steps use. Renaming is safe for microcheck step-id selection because ids are positional (`g<group>_s<step>`) and the step keeps its position in its group. Reordering would be the risky operation; this isn't one. ## Testing **Emitted-pipeline differential using the pinned rayci binary** (`v0.46.0`, from the repo's own `.rayciversion`), rather than inferring from tags. Probe path `.readthedocs.yaml`, chosen because it emits `doc` — the tag being added — so this is the case most likely to expose an accidental premerge trigger. Both runs report `selected tags: always doc lint` and emit the same 6 steps: ``` wanda: forge :test_tube: test-rules [g5_s0] :lint-roller: lint: {{matrix}} [g11_s0] :lint-roller: lint: {{matrix}} [g11_s1] :lint-roller: pre-commit pydoclint [g11_s2] :lint-roller: lint: validate docs-go scope [g11_s3] ``` Diffing the two full pipeline YAMLs, the only differences are the probe commit SHAs in `BUILDKITE_ARTIFACT_UPLOAD_DESTINATION`, which are an artifact of how the probe commit is generated. Everything else is byte-identical, and `doc: doctest` appears in neither pipeline. So with `doc` emitted, the step stays off premerge before and after. **Postmerge preservation.** `doc: build [g9_s2]` and `doc: linkcheck [g9_s5]` both carry `skip-on-premerge` and both appear on postmerge build 19099, so the added skip tag doesn't remove a step from postmerge. **Filter simulation** across four scenarios (prose-only premerge, broad code premerge, docs-infra premerge, and postmerge run-all): identical selection before and after in all four. **Lint.** `pre-commit run --files .buildkite/others.rayci.yml` passes. YAML parses, and the step's `depends_on`, `instance_type`, and commands are untouched. ## Not a duplicate `gh pr list --repo ray-project/ray --state open` searched for `others.rayci.yml`, `"doc tests"`, and `doctest` in title and body — no open PR touches this step or this file. ## Follow-ups deliberately not in this PR While measuring this step I found two things that are about the *target*, not its routing, so they need different reviewers and their own change: - **`//doc:doctest` currently collects zero doctests.** Of the 204 files in its glob, the 131 `.md` files contain no `>>>` prompt, which is the only form pytest collects. The one file in the glob that has a doctest is `ray-references/glossary.rst`, and the pytest arg is `--doctest-glob=*.md`, so `.rst` isn't collected. The three other prose files in the tree carrying `>>>` are all in the target's own exclude list. Its measured cost is ~8m wall clock for 57.9s of bazel work. - **`bazel/pytest_wrapper.py` maps `NO_TESTS_COLLECTED` to `OK`**, so a target that collects nothing passes green. That applies to every `doctest()` target in the repo, so any of them could silently stop collecting and stay green. Happy to open those separately, or to fold the size correction bazel already suggests (`Test execution time (57.9s ...) outside of range for LONG tests`) into whichever change resolves the collection question, since the right size depends on what the target ends up collecting. ## AI assistance AI assistance (Claude Code) was used to research and draft this change. I reviewed every changed line and ran the verification commands above locally. Signed-off-by: Douglas Strodtman <[email protected]>
…per library (ray-project#64775) ## Reviewer summary **What this does.** The per-team `X: doc tests` steps are library example and doctest suites that live under `doc/`. They exercise library code, not documentation quality. Today every executable doc asset emits the blanket `doc` tag and all six teams' steps are tagged `doc`, so a one-library doc change starts every team's step. This gives each step a dedicated `<lib>_doc` tag, routes `doc/source/<lib>/**` to the owning library's tag, renames the steps to `X: docs example tests`, and leaves `doc` for documentation validation (the build and the Vale/config infra). The library tag stays on each step, so a library **code** change runs its doc example tests exactly as before. **What's verified.** | Claim | Evidence | |---|---| | Each path emits exactly the intended tag, and no other | `test-rules` green on this PR. That's the pinned `rayci` binary replaying all 103 `test.rules.test.txt` assertions (up from 57 on master) with **exact set equality**, so each case also proves the blanket `doc` tag does *not* come along. | | The emitted tags resolve to the intended steps, and only those | Generated the real pipeline locally with the pinned `rayci v0.46.0` release binary for a one-file Serve doc-example change, before and after this branch. Output below. | | The renamed steps still run and pass | All five plus the GPU and dask siblings green on this PR, selected via the library tags this change preserves. | | Every executable target under `doc/` routes to a step that can actually select it | Swept all 948 (file, target) claims against the per-team `team:` / `--only-tags` / `--except-tags` filters. One deliberate exception (`doc/test_myst_doc.py`, below) and two pre-existing gaps that this change doesn't create. | | The rename doesn't reset step identity | rayci derives step IDs positionally (`fmt.Sprintf("g%d_s%d", i, j)`, `converter.go`), not from the label. The generated pipelines confirm it: `g16_s12`, `g16_s21`, `g6_s22`, `g13_s26` are identical before and after. | **What I need from a reviewer.** 1. **One question I can't answer from inside the repo.** `ci/build/get_build_info.py` sets `config.env` to `"Buildkite " + BUILDKITE_LABEL`, and `ci/build/upload_build_info.sh` uploads it on postmerge pipelines on `master` only. Does anything downstream of that `metadata.json` treat `config.env` as an identity or grouping key? If it's descriptive, renaming five steps is free. If something groups on it, those five steps' postmerge history splits at the merge commit. Flaky-test selection and target selection both key on `team` (unchanged here) and test identity is the bazel target name (`f"{system}:{name}"` in `release/ray_release/test.py`), so I believe `config.env` is the only place the label escapes. 1. **Confirm the API-check behavior change below is acceptable.** 1. **Confirm the catch-all owner.** Executable doc assets in directories with no per-team step route to the core step: roughly 25 files, being 18 `doc/source/templates/*/start.ipynb` plus a handful under `doc/source/cluster/doc_code/`, `doc/source/ray-contribute/doc_code/`, and `doc/source/_templates/`. The templates majority may be retired or externally managed, in which case a skip rule is the better answer than core ownership. **Known behavior change worth your eyes.** Because `doc/source/<lib>/doc_code/` and `examples/` now emit `<lib>_doc` instead of `doc`, the two API-surface checks (`doc: check API annotations`, `doc: check API doc consistency`) stop running on library doc-example changes. They carry the blanket `doc` tag among their library tags, so today a `doc_code` edit incidentally triggers a premerge `make -C doc/ html`. I think that's correct: those checks guard the documented public API surface, which a doc example can't change, and the example itself is still executed by the owning library's step while the render is gated by Read the Docs. But it is a premerge signal that disappears, so it should be a decision rather than a side effect. Raised on ray-project#64812, which routes the API **reference** pages to a dedicated `doc_api` tag for the related case. **Out of scope, tracked separately.** `.buildkite/others.rayci.yml:13` declares a sixth step labeled `doc tests`, running `//python/ray/... //doc/... none --only-tags doctest` and tagged `python`, a tag no rule in `test.rules.txt` emits. Generating the full-fan-out pipeline shows it does get emitted (`doc tests [g14_s1]`), so it is live. After this rename it becomes the only step in the repo still called "doc tests." This PR doesn't touch `others.rayci.yml` and the fix is independent. --- ## What this changes 1. **Dedicated per-library tag.** Each step gets a `<lib>_doc` tag (`core_doc`, `data_doc`, `ml_doc`, `rllib_doc`, `serve_doc`) and drops the blanket `doc` tag. The library tag stays. 1. **Path routing.** `test.rules.txt` routes `doc/source/<lib>/**` to that library's tag, so a doc change runs only the owning library's example tests. LLM doc assets already route to `llm` and keep doing so. 1. **`doc` reserved for validation.** It now stays only on the documentation build and the Vale/config infra. 1. **Rename** to `X: docs example tests`, since a failure in these steps means library code or an example broke, not that the docs are wrong. 1. **Build-file rule fix.** `test.rules.txt` matched `doc/BUILD` and `doc/*/BUILD`, but the files are `BUILD.bazel`, so editing a file that *defines* the doc test targets ran no doc tests premerge. It now matches the `.bazel` files and routes them to the same per-library steps. The root `doc/BUILD.bazel` defines every library's targets, so it routes to all of them. ### Scoping exceptions, and why each exists Several paths sit under a library doc directory but can't be meaningfully tested by that library's example step, so they're routed explicitly rather than by directory: - **Static images skip entirely.** Image extensions sit on the leading skip rule, ahead of the per-library rules, so a `.png` or `.svg` edit triggers nothing. 310 tracked image files. `.yaml` and `.sh` stay routed, since unlike an image they can change what a test does. - **Sphinx build machinery routes to `doc`.** `conf.py` imports `custom_directives`, `api_autogen`, `api_mock_imports`, and `template_collections`; none was listed in the validation-infra rule, so all fell to the `doc/*.py` catch-all and emitted `core_doc`, running Ray Core's doctests for a docs-build-machinery edit. Those four plus `preprocess_github_markdown` and the doc-root build helpers now route to `doc`. They're enumerated one per line on purpose: `*` is fnmatch here and crosses `/`, so a `doc/source/*.py` pattern would also swallow every example script under `doc/source/<lib>/doc_code/`. There's a comment on the rule saying so. - **Gallery configs route to `doc`.** `doc/source/{data,serve,train}/examples.yml` are parsed by `custom_directives.py` (`EXAMPLE_GALLERY_CONFIGS`) to generate the gallery pages. They hold no executable code and can't change what any example does. Narrowed to a three-path exception rather than a blanket `.yml` skip, because a sibling `.yml` under a library doc directory can be a config an example consumes. - **`doc/.claude/` triggers nothing.** Agent files never participate in the Sphinx build and define no test targets, but `doc/.claude/skills/sphinx-fix/sphinx_fix.py` matched the `doc/*.py` catch-all. The Read the Docs build guard already excludes this exact path for the same reason, so the two guards now agree. Pre-existing rather than a regression from this PR: on master the file emits the blanket `doc` tag, which reaches all five per-team steps. - **Four `team:ml` notebooks under `ray-core/` route to `ml_doc`.** `plot_hyperparameter`, `batch_prediction`, `plot_parameter_server`, and `plot_pong_example` live under `doc/source/ray-core/examples/` but their targets are tagged `team:ml`, and the team argument to `//ci/ray_ci:test_in_docker` filters targets by `team:<team>` (`_get_all_test_query`, `ci/ray_ci/tester.py`). Routing them to `core_doc` would run a step that tests everything under `ray-core/` except the file that changed. Re-tagging the four `team:core` in `doc/BUILD.bazel` is the alternative fix and would let the rule lines go away. - **`highly_parallel.ipynb` routes to `doc`.** Its `py_test` carries a `highly_parallel` tag that the ml docs example step excludes, and the notebook glob in `doc/source/ray-core/examples/BUILD.bazel` excludes it too, as a release test needing a live multi-node cluster. The remaining ml `//doc/...` steps select `gpu` / `train_v2_gpu` and the target has neither, so no premerge step executes it. Routing to `doc` means the build renders it (`nb_execution_mode` defaults to `off`, so render-and-lint only), which is the only validation premerge offers here. - **`doc/external/` routes to `ml_doc`.** Its `test_external_hashes` target is tagged `team:ml`; it had fallen through the `doc/*.py` catch-all to `core_doc`, where the core step's `team:core` query never sees it. - **The `llms.txt` files route to `doc`.** ray-project#64458 adds `doc/test_llms_txt.py` and `doc/source/llms_txt_summary.txt` with no `test.rules.txt` change. Left alone the test would land on the `doc/*.py` catch-all and emit `core_doc`, running Ray Core's doctests for a test its own docstring describes as hermetic, while never running the step that executes it. Rules for absent paths are inert, so there's no ordering dependency: this PR doesn't touch `doc.rayci.yml`, ray-project#64458 doesn't touch `test.rules.txt`, and whichever lands first the other merges correctly scoped. - **Declined:** fanning `doc/test_myst_doc.py` out to all five `<lib>_doc` tags. It backs 19 targets across every team, but it's shared infrastructure, so a break surfaces in core as readily as anywhere. One library's worth of execution is a sufficient smoke signal and the post-merge build covers the rest. The rule carries a comment recording that trade and when to revisit it. ### Effect on a doc-only PR (no `docs-go`) | Change | Before | After | |---|---|---| | A Serve doc example | every team's `doc tests` step | `serve: docs example tests` and its GPU sibling | | A Data doc example | every team's `doc tests` step | `data: docs example tests`, plus the dask and GPU siblings | | An image under a library doc dir | that library's example step | nothing | | A Sphinx build module (`custom_directives.py` etc.) | `core: docs example tests` | `doc: build` only (post-merge) | | A gallery config (`examples.yml`) | that library's example step | `doc: build` only (post-merge) | | Editing `doc/BUILD.bazel` | nothing (rule was dead) | the doc example steps it defines | | The two `doc: check API*` checks | ran, via the blanket `doc` tag | don't run (see reviewer summary) | The GPU and dask siblings carry `<lib>_doc` too, and tag matching is a non-empty intersection, so they're selected alongside the main step. That's unchanged behavior: they carried the blanket `doc` tag before, so a doc change already started them. No new GPU cost. ## Verification **Rule conformance, under the authoritative evaluator.** `test-rules` is green on this PR. It replays all 103 `test.rules.test.txt` assertions through the pinned `rayci` binary, and `runTestRules` compares the full computed tag set per path, so every case is also a negative assertion that no other tag fires. **Tag-to-step resolution, generated locally.** The tag set isn't the step set: rayci filters steps by tag, then `markDeps` pulls in everything reachable through `depends_on` regardless of that step's own tags. To confirm the composition rather than infer it, I ran the pinned `rayci v0.46.0` release binary against a one-file Serve doc-example change, on master and on this branch: ``` before (base=master) changed files: [doc/source/serve/doc_code/app_builder.py] selected tags: always doc lint doc-related steps emitted: core: doc tests [g6_s22] ml: doc tests [g13_s26] data: doc tests [g7_s21] rllib: doc tests [g15_s8] data: dask doc tests [g7_s22] serve: doc tests [g16_s12] data: doc gpu tests [g7_s23] serve: doc gpu tests [g16_s21] doc: check API annotations [g9_s3] doc: check API doc consistency [g9_s4] after (this branch) changed files: [doc/source/serve/doc_code/app_builder.py] selected tags: always lint serve_doc doc-related steps emitted: serve: docs example tests [g16_s12] serve: docs example gpu tests [g16_s21] ``` Six teams' example steps collapse to the owning team's two, and the step IDs are unchanged across the rename. **Routing versus coverage.** Correct routing isn't sufficient: the step that starts still has to select the target. `ci/ray_ci/tester.py` filters by `attr(tags, 'team:<team>')`, then intersects `--only-tags` and subtracts `--except-tags`, so a change can route perfectly, start the right-looking step, and be invisible to every command in it. I swept all 948 (file, target) claims under `doc/` against the per-team filters. After the exceptions above, the only deliberate team mismatch left is `doc/test_myst_doc.py`. Two pre-existing gaps fell out, neither created by this change: - **GPU-tagged ml and core doc examples have no owning step** — six `team:ml` notebooks tagged `gpu`, five `team:core` `doc_code` modules tagged `multi_gpu`, and one `post_wheel_build` module. `data` and `serve` each have a GPU doc-example step; ml and core never got one, so the only steps that would run these are gated on `train_gpu` and `cgraphs_direct_transport`, which no doc path emits. No `doc`-tagged step ran them before the split either. This needs a REEf and library-team decision rather than a rules change. - **Prose doctests aren't triggered by prose edits.** The `doc/BUILD.bazel` `doctest` targets over `doc/source/**/*.{md,rst}` are reachable only from the `others.rayci.yml` step gated on `python`, while prose paths hit the leading skip rule. Roughly 700 files. I consider this correct as-is: given current coverage the Read the Docs render build is the gate a prose change needs. **Also swept** all 1,628 tracked `doc/` files against the previous rules to confirm exactly which paths changed routing and that nothing else moved. ## Change log Consolidated above; kept here so the review history stays legible. - `6a1310d3b5` — the split: per-library tags, path routing, rename, `BUILD.bazel` rule fix. - `c6302c8a21`, `b1d03629cf` — first bot-review pass: static images skip; Sphinx build modules route to `doc`. - `99c3af2c28` — pre-route the `llms.txt` extension test and summary ahead of ray-project#64458. - `3795c6161b` — skip `doc/.claude/`; route the `team:ml` `ray-core` notebooks to `ml_doc`. - `e88e8a4b52` — remove a stray `TEMP(do-not-merge)` marker that reached master with ray-project#65040. Inert, and independent of this PR's thesis; happy to split it out. - `f8347baf54` — second bot-review pass: gallery configs to `doc`; correct `highly_parallel.ipynb` to `doc`. - `6a050a0511` — route `doc/external/` to `ml_doc` so the hash guard still runs. ## AI assistance This change was drafted with AI assistance (Claude Code) and reviewed by me. --------- Signed-off-by: Douglas Strodtman <[email protected]>
…ce checks (ray-project#64812) ## The problem Two premerge checks in `.buildkite/doc.rayci.yml` cross-check every `@PublicAPI` symbol against the autosummary pages that document it: - `doc: check API annotations` - `doc: check API doc consistency` They currently run on the wrong set of changes, in both directions. **They miss changes they should catch.** API reference pages are `.rst` and `.md`, so the leading prose-and-image skip rule in `test.rules.txt` matches them first. Editing `doc/source/data/api/api.rst` changes the documented public API surface and triggers **no premerge step at all**. **They run on changes that can't affect the API surface.** Both steps carry the blanket `doc` tag. Since ray-project#64775 reserved `doc` for documentation validation, that tag now covers two unlike things: the autodoc machinery that decides what the API reference *contains*, and rendering config that can't change it. So a Vale vocabulary tweak pays for a `docbuild` plus both checks. ## The fix Add a `doc_api` tag, and route to it everything that can change the documented API surface or how it's computed. Then take the blanket `doc` tag off the two steps. | A change to | today | with this PR | |---|---|---| | An API reference page | **skip** | run | | The checker's own source (`ci/ray_ci/doc/`) | **skip** | run | | `conf.py`, `api_autogen.py`, `api_mock_imports.py`, `_ext/` | run | run | | Docs dependency locks (`deplocks/docs/*.lock`) | run | run | | Library Python source | run | run | | `.vale.ini`, Vale vocabularies | run | **skip** | | `rtd_doctor.py`, `template_collections.py` | run | **skip** | | `.readthedocs.yaml`, gallery configs | run | **skip** | | Narrative prose, images | skip | skip | ## What's in the diff Three commits, 7 files. 1. **`a0b545cc3e`** declares `doc_api` and routes the six per-team API reference directories to it, ahead of the skip rule. Also splits the doc-build infra block in two: the autodoc machinery emits `doc doc_api`, the rendering-only half emits `doc` alone. Then drops the bare `doc` tag from both check steps. 2. **`e0d520381d`** adds two drift guards in `//ci/pipeline:test_doc_api_rules_sync`. Both `doc_api` lists are hand-maintained and fail *silently* when they drift — a missing entry means those paths quietly stop being checked. One guard keeps the page list aligned with `API_PATH_PREFIXES` in `doc/source/_ext/api_sidebar.py`. The other requires every local module `conf.py` imports to be routed to `doc_api` or named as an explicit rendering-only exception. 3. **`f3db137384`** routes `api_sidebar.py` to `tools` as well, so the first guard actually runs. It was one-directional before: `test.rules.txt` emits `tools`, so the guard fired on a rules-side edit, but `api_sidebar.py` didn't, so growing `API_PATH_PREFIXES` without the matching rule never executed it — the likelier mistake, and exactly the drift the guard exists to catch. Also removes four duplicated assertions. Three details worth knowing, since each looks like an oversight otherwise: - **`ci/ray_ci/doc/` keeps `tools` alongside `doc_api`.** It declares six `ci_unit` `py_test` targets and `tools` is what selects the job that runs them, so dropping it would mean editing the checker never runs the checker's own unit tests. - **`doc.rayci.yml` also emits `doc_api`,** so editing a check's step definition exercises the check it defines. - **`doc/source/ray-observability/reference/` is routed even though it sits outside `doc/source/*/api/`.** Ray Core's `api/index.rst` toctrees into its `api.rst`, so it's part of the Core API-surface walk. ## Testing `test.rules.test.txt` gains cases for the API pages (including a nested leaf page, to pin recursive directory matching), the checker source, each machinery path, and negative cases asserting the rendering half still emits `doc` alone. **These are the real gate:** the `test-rules` step runs them through rayci's parser as exact set equality, so a passing case proves a path emits precisely those tags and nothing else. Locally, against the in-repo reference engine (`ci/pipeline/determine_tests_to_run.py`): - `check_rules()` passes; **115 of 115** replay cases pass. - Across all 10,213 tracked files the routing change is **purely additive: 95 files gain tags, none lose any.** - No executable asset (`.py`, `.ipynb`) lives under the routed API directories, so no library docs-example step loses coverage. ``` python -m pytest ci/pipeline/test_doc_api_rules_sync.py ``` ## Two notes for reviewers **One behavior change to sanity-check.** Neither check carries an `if:` guard now, including the `docs-go` one they had before. A content-only PR labeled `docs-go` that touches an API reference page will run both checks plus their `docbuild` dependency, where it previously skipped them. That's intended — `docs-go` exists to skip per-team doc *example execution*, and an API reference edit is exactly the content-only change these checks must still cover — but it's a real cost change for that workflow. `docs-go` keeps its role everywhere else: 12 per-team doc example steps across `core`, `data`, `llm`, `ml`, `rllib`, `serve`, and `linux_aarch64`, plus the `lint: validate docs-go scope` step that enforces the label is only used on doc-only PRs. **This PR changed shape, so earlier comments describe an older design.** It began as a `docs-api-go` PR label that would re-enable the checks on a `docs-go` PR. That's removed: tag selection and Buildkite `if:` are separate passes, and `if:` can only suppress a step the tags already emitted, so with the routing correct the label could only ever subtract. Dropping the `if:` achieves the same thing with no label to create or remember. Consequently the earlier Gemini review and the 2026-08-04 comment above both reference a `docs-api-go` label that no longer exists. Everything else in that comment still stands, including its decision that `doc_code/` and `examples/` should *not* grow into `doc_api`. 🤖 Written with assistance from Claude Code. --------- Signed-off-by: Douglas Strodtman <[email protected]>
…cipe (ray-project#65285) ## Why this change `doc/source/ray-contribute/ci.md` explains what CI runs on a PR, but stops at `microcheck` and the `go` label. It says nothing about what runs when the PR changes documentation, which is the case the page's likely reader is in. This adds that, and folds in a recipe for reproducing the API consistency check locally. ### What's new **"Documentation CI checks"** covers, in the order a contributor meets them: - The Read the Docs render gate, including that `fail_on_warning: true` makes any Sphinx warning a build failure, and when the preview build skips. - The two API surface checks, and the `doc_api` tag that lets an API reference page edit reach them even though it's a documentation change. - The per-library `<library>: docs example tests` steps, with a table mapping path to step to tag, plus the Ray Core fallback and the Ray LLM exception. - That a prose-only or image-only change runs no library test steps at all. - The `docs-go` label and the `lint: validate docs-go scope` guard that bounds it. - The two post-merge-only steps, `doc: build` and `doc: linkcheck`. **"Running the API consistency check locally"** documents the three phases of `api_policy_check`, what the `docbuild` image does and doesn't install (the deep-learning backends are mocked even in CI), and a `uv` recipe that gets close enough for iteration. It also updates one example commit message under the `microcheck` section that named the old `serve doc tests` step label. **`doc/.claude/CLAUDE.md`** carried the same staleness, so it's fixed in the same PR. It still said the `doc` tag "covers content under `doc/`", which stopped being true when ray-project#64775 landed. It now describes the three-way split (`doc` for build and validation infra, `<lib>_doc` for executable doc assets, `doc_api` for the API reference surface), records that prose and images trigger nothing, and documents the `docs-go` label and its scope guard. Two smaller drifts are corrected alongside: the docs deplock rule emits `doc_api` now too, and the "tag it `doc`" advice pointed at a tag that no longer selects content steps. This file is an agent instruction file rather than published documentation, so it's worth saying why it rides along here instead of going out separately. `AGENTS.md` requires a dedicated PR for changes to itself, which this isn't. `doc/.claude/` is on the skip rule in `test.rules.txt` and excluded from the Read the Docs build guard, so including it changes this PR's trigger set by nothing. And it's the same factual correction as the page, from the same source reading — splitting them would mean verifying the same CI configuration twice and risking the two descriptions drifting apart again. ## Not a duplicate This supersedes two of my own open PRs and replaces both: - ray-project#64842 added a documentation CI overview. It was written before ray-project#64775 landed and describes the pre-rework model, where a single `doc` tag selected the per-team doc test steps. That's no longer how routing works, so landing it as-is would have documented the wrong thing. - ray-project#64450 added the local API-check section. Its content is carried over here essentially unchanged. Both branched from the same pre-ray-project#64775 commit and added an identically titled section, so they also conflicted with each other. Combining them is cheaper to review than rebasing two PRs that overlap. I'm not aware of another open PR touching this page. Checked with `gh pr list --repo ray-project/ray --state open --search "ray-contribute ci.md"`. ## Verification Every factual claim was checked against `master` at `695a8814ea` rather than carried over from the superseded PRs: - Step labels, tags, and `if:` guards read from `.buildkite/doc.rayci.yml`, `core.rayci.yml`, `data.rayci.yml`, `ml.rayci.yml`, `rllib.rayci.yml`, `serve.rayci.yml`, and `lint.rayci.yml`. - Path-to-tag routing read from `.buildkite/test.rules.txt`. - The render gate behavior read from `.readthedocs.yaml` (`fail_on_warning: true`, the `post_checkout` skip guard) and `doc/Makefile`. - The mocked-backend claim checked against `ci/docker/doc.build.Dockerfile`, which stages the `ray-core` and `ray-dashboard` artifacts and installs only the docs lock, and `doc/source/api_mock_imports.py`, which lists `torch`, `transformers`, and `tensorflow`. This corrects ray-project#64842, which claimed the base images supply those libraries for real. - `doc: build`'s upload behavior read from `ci/ray_ci/doc/cmd_build.py` (postmerge, `master` only). - The `docs/readthedocs.com:anyscale-ray` check name confirmed from the status checks on an open PR. Commands run: ``` vale --config=.vale.ini doc/source/ray-contribute/ci.md python doc/test_no_new_rst.py pre-commit run --files doc/source/ray-contribute/ci.md ``` `test_no_new_rst.py` passes. `pre-commit` reports no applicable hooks for a Markdown file under `doc/source/`. Vale surfaces no new findings in the added text beyond spelling hits on project vocabulary (`Buildkite`, `premerge`, `docbuild`, `autodoc`, `autosummary`, `toctree`); note that CI's `documentation_style` lint scopes Vale to `doc/source/data` and `doc/source/ray-overview/examples`, so this page isn't in its path set. The same source reading backs the `doc/.claude/CLAUDE.md` edit; it asserts nothing the page doesn't. Rendering verified by parsing the page with `myst-parser` using the repo's `myst_heading_anchors = 4`: the table, the `{warning}` directive, and the heading hierarchy all parse, with no skipped heading levels. Both cross-references (`writing-code-snippets.md`, `docs.md#building-the-ray-documentation`) point at existing `.md` sources and an existing heading. The Read the Docs preview on this PR is the real render check. ## AI assistance AI assistance (Claude Code) was used to draft this change and to cross-check the claims against the CI configuration. I've reviewed every line. --------- Signed-off-by: Douglas Strodtman <[email protected]>
…ep (ray-project#65289) ## Why this change The trailing catch-all in `.buildkite/test.rules.txt` routes any remaining `.py` or `.ipynb` under `doc/` to `core_doc`. For a few directories that starts Ray Core's docs example step for files the step cannot run, because no bazel target covers them: - `doc/BUILD.bazel` names `source/templates/` exactly once, and it's a doctest *exclusion*. - Nothing covers `doc/source/cluster/doc_code/`, `doc/source/ray-contribute/doc_code/`, or `doc/source/_templates/`. So the step spins up, runs Core's own targets, and never touches the file that changed. Cost without signal. This is a follow-on to ray-project#64775, which introduced the per-library `<lib>_doc` tags and left this population on the catch-all deliberately, pending a check of what was actually there. ## What it does Splits the population by what the documentation build actually reads. **Routed to `doc` (build and validation only).** Sources a rendered page pulls in with `literalinclude`. Nothing executes them, but Sphinx reads them, so a rename or delete breaks the including page and the build is the only premerge check that can catch it. Same reasoning ray-project#64775 applied to `highly_parallel.ipynb`. - `doc/source/cluster/doc_code/` — included by four `cluster/vms/user-guides/community/` pages - `doc/source/ray-contribute/doc_code/` — included 3x by `writing-code-snippets.md` - `doc/source/templates/05_dreambooth_finetuning/` — included ~12x by `train/examples/pytorch/dreambooth_finetuning.rst` **Skipped.** `exclude_patterns` in `doc/source/conf.py` drops `templates/*` from the build outright, so Sphinx never reads any of it. `01`–`03` have no reference anywhere in the repo; `04` is cited only as a GitHub URL from `train/deepspeed.rst`, `train/huggingface-accelerate.rst`, and the Train examples gallery, none of which a build step resolves. `_templates/template.ipynb` is boilerplate contributors copy, linked as a GitHub URL from `ray-contribute/docs.md`. - `doc/source/templates/` (01 through 04) - `doc/source/_templates/` Images and prose under the `doc`-routed directories are unaffected: the leading prose-and-image skip still matches them first, as everywhere else in the tree. The dreambooth page's `.. image::` targets therefore stay skipped, consistent with every other doc image. Widening that is a separate decision and belongs in that rule. ## Blast radius Dry-ran `ci/pipeline/determine_tests_to_run.py` over **all 10,255 tracked files**, before and after: - **33 paths change routing. All are under `doc/`. Zero outside.** - 14 move `core_doc` → `doc` (the `literalinclude` sources) - 11 move `core_doc` → nothing (templates 01–04, `_templates`) - 8 move nothing → `doc` (non-`.py` include inputs such as `slurm-basic.sh`, `ray-skein.yaml`, `dreambooth_run.sh`, which the catch-all's `.py`/`.ipynb` patterns never reached) Net: 25 files stop starting a docs example step that couldn't run them; 8 gain the documentation build, which is the cheap step and the one that can catch a broken include. These are directory rules, matching how `doc/external/` is handled. That means four non-included assets under `05` (its Dockerfile, two compute configs, `requirements.txt`) start the build too. Deliberate trade — enumerating individual include targets would rot the moment someone adds a `literalinclude`. ## Tests Added 8 cases to `.buildkite/test.rules.test.txt`, including two regression guards: that the leading prose-and-image skip still wins *inside* a `doc`-routed directory, and that `doc/test_myst_doc.py` stays on `core_doc` so the catch-all keeps working for its real purpose. ``` $ python ci/pipeline/determine_tests_to_run.py # replayed over every fixture case fixture cases: 124 evaluated: 124 mismatches: 0 ``` All 124 cases pass, the 116 pre-existing ones included. `pre-commit run --files .buildkite/test.rules.txt .buildkite/test.rules.test.txt` passes. The authoritative tag computation is the external `rayci` `test-rules` step, not this in-repo parser, so premerge on this PR is the real confirmation. ## Not a duplicate No open PR touches `.buildkite/test.rules.txt` (`gh pr list --search "test.rules.txt in:title,body"` returns four unrelated PRs). This continues ray-project#64775, which is merged. ## Follow-up, deliberately not in this PR `doc/source/templates/README.md` documents a contribution workflow that can't be followed: it points at `templates.yaml`, `testing/validate.py`, `testing/release/`, and `//doc:workspace_templates`, none of which exist. Templates `01`–`03` look like orphaned 2.6-era artifacts and are probably deletable, but `04` and `05` are not, since published pages link to or inline them. That's content cleanup with its own reviewers, and external links to those GitHub paths may exist, so it wants a maintainer's call separately. --- AI assistance was used to research and draft this change. Opening as a draft for my own review pass before requesting maintainer review. Signed-off-by: Douglas Strodtman <[email protected]>
…project#65333) ## Why this change `.buildkite/others.rayci.yml` has a step labeled `doc tests`, tagged `python`. **`python` is declared in no `.rules.txt` file and emitted by no rule.** It isn't in the tag-declaration block of `test.rules.txt` or `always.rules.txt`, and no rule emits it. In `raycicmd/step_filter.go`, `acceptTagHit` returns early only when `runAll` is set; the `noTagMeansAlways` escape doesn't apply because the step *does* carry a tag, so it falls through to `step.hasTagInMap(f.tags)` and misses. On non-pull-request builds `needRunAllTags` returns `["*"]`, `runAll` is set, and the step runs. So the step is postmerge-only, but by accident rather than by intent. Nothing in the file says so, and the behavior rests on a tag that reads like it means something. Confirmed against real builds: - Premerge [71703](https://buildkite.com/ray-project/premerge/builds/71703) — 231 jobs, the broadest recent build, with all five per-library docs example steps present. A job named `doc tests` is **absent**. - Postmerge [19099](https://buildkite.com/ray-project/postmerge/builds/19099) — 923 jobs. `doc tests [g14_s1]` is **present** and passed. It's also the last step in the repo still called `doc tests`, after ray-project#64775 renamed the per-library steps to `<library>: docs example tests`. `git grep 'label:.*doc test'` returned exactly this one line. That's a naming collision with five steps that do something else: those execute a library's documentation examples, while this one runs `//doc:doctest`, the catch-all doctest target for documentation prose that no library owns (tagged `team:none`). The per-library steps each filter on their own `team:<lib>`, so this is the only step that reaches it. ## What this changes Tags and label only. **No behavior change** — the step runs exactly where it ran before. - **`skip-on-premerge`** states the existing postmerge-only behavior explicitly, instead of leaving it to an unmatched tag. Matches `doc: build` and `doc: linkcheck` in `doc.rayci.yml`, and the postmerge-only minimal-tests step in `core.rayci.yml`, which uses the same pattern with a comment. - **`doc`** is the build-and-validation tag, which is what this step is. It does **not** re-enable the step on premerge: skip tags are rejected in the filter's first pass (`hit = !reject(step) && accept(step)`) before tag selection runs. That's why `doc: build` carries `doc`, a rule-emitted tag, and is still postmerge-only. - **`oss`** matches the sibling doc steps. - **`python`** is dropped. It stays on `core_minimal_tests_postmerge` in `core.rayci.yml`, where it's harmless because that step also carries real tags and an explicit `skip-on-premerge`. - The label becomes **`doc: doctest`**, after the target it runs, matching the `doc:` prefix the other doc steps use. Renaming is safe for microcheck step-id selection because ids are positional (`g<group>_s<step>`) and the step keeps its position in its group. Reordering would be the risky operation; this isn't one. ## Testing **Emitted-pipeline differential using the pinned rayci binary** (`v0.46.0`, from the repo's own `.rayciversion`), rather than inferring from tags. Probe path `.readthedocs.yaml`, chosen because it emits `doc` — the tag being added — so this is the case most likely to expose an accidental premerge trigger. Both runs report `selected tags: always doc lint` and emit the same 6 steps: ``` wanda: forge :test_tube: test-rules [g5_s0] :lint-roller: lint: {{matrix}} [g11_s0] :lint-roller: lint: {{matrix}} [g11_s1] :lint-roller: pre-commit pydoclint [g11_s2] :lint-roller: lint: validate docs-go scope [g11_s3] ``` Diffing the two full pipeline YAMLs, the only differences are the probe commit SHAs in `BUILDKITE_ARTIFACT_UPLOAD_DESTINATION`, which are an artifact of how the probe commit is generated. Everything else is byte-identical, and `doc: doctest` appears in neither pipeline. So with `doc` emitted, the step stays off premerge before and after. **Postmerge preservation.** `doc: build [g9_s2]` and `doc: linkcheck [g9_s5]` both carry `skip-on-premerge` and both appear on postmerge build 19099, so the added skip tag doesn't remove a step from postmerge. **Filter simulation** across four scenarios (prose-only premerge, broad code premerge, docs-infra premerge, and postmerge run-all): identical selection before and after in all four. **Lint.** `pre-commit run --files .buildkite/others.rayci.yml` passes. YAML parses, and the step's `depends_on`, `instance_type`, and commands are untouched. ## Not a duplicate `gh pr list --repo ray-project/ray --state open` searched for `others.rayci.yml`, `"doc tests"`, and `doctest` in title and body — no open PR touches this step or this file. ## Follow-ups deliberately not in this PR While measuring this step I found two things that are about the *target*, not its routing, so they need different reviewers and their own change: - **`//doc:doctest` currently collects zero doctests.** Of the 204 files in its glob, the 131 `.md` files contain no `>>>` prompt, which is the only form pytest collects. The one file in the glob that has a doctest is `ray-references/glossary.rst`, and the pytest arg is `--doctest-glob=*.md`, so `.rst` isn't collected. The three other prose files in the tree carrying `>>>` are all in the target's own exclude list. Its measured cost is ~8m wall clock for 57.9s of bazel work. - **`bazel/pytest_wrapper.py` maps `NO_TESTS_COLLECTED` to `OK`**, so a target that collects nothing passes green. That applies to every `doctest()` target in the repo, so any of them could silently stop collecting and stay green. Happy to open those separately, or to fold the size correction bazel already suggests (`Test execution time (57.9s ...) outside of range for LONG tests`) into whichever change resolves the collection question, since the right size depends on what the target ends up collecting. ## AI assistance AI assistance (Claude Code) was used to research and draft this change. I reviewed every changed line and ran the verification commands above locally. Signed-off-by: Douglas Strodtman <[email protected]>
…documentation content in the docs-go scope guard (#65342) ## Why this change is needed `ci/lint/validate_docs_go_scope.sh` fails any pull request carrying the `docs-go` label if a changed file lives outside `doc/`. Two kinds of documentation work live outside `doc/` and are therefore locked out of the label today: - **Ray's Vale configuration** (`.vale.ini`, `.vale/`) sits at the repository root, so a PR that adds or edits a prose-lint rule can never carry the label even though it is documentation content by any reasonable reading. Concretely: #65239 adds KubeRay style rules and edits `doc/source/ray-contribute/writing-style.md`. Its [premerge build](https://buildkite.com/ray-project/premerge/builds/71732) has exactly one failing job, `lint: validate docs-go scope`. Every other check passes. - **The API-consistency checker's own source** (`ci/ray_ci/doc/`) is the tooling behind the `doc: check API doc consistency` step. Same shape: #65340 changes only that directory, and the label's guard is the sole red job on its [premerge build](https://buildkite.com/ray-project/premerge/builds/71727). In both cases the author's options today are to drop the label and wait on per-library example suites the PR cannot possibly affect, or to split a coherent change across two PRs. ## What changed Widen the guard's in-scope set from "under `doc/`" to "under `doc/`, the Vale prose-lint configuration (`.vale.ini`, `.vale/`), or the API-consistency checker (`ci/ray_ci/doc/`)". Both fail-closed paths (no merge-base, empty diff) are unchanged, and the `BUILD`-file exclusion now applies uniformly across the whole in-scope set rather than just `doc/`. Also updates the two places that state the predicate in prose, so they don't drift from the script: the `docs-go` section of `doc/source/ray-contribute/ci.md`, and `doc/.claude/CLAUDE.md`. ## Why this is safe The guard exists so `docs-go` can skip the 12 per-library docs example and llm test steps only on a PR that could not break them. The two additions clear that bar on different grounds, which is worth stating separately rather than blurring into one rule. **The Vale configuration** clears it on content: - **It defines no bazel target.** The separate `BUILD`-file exclusion is the mechanism that protects test targets, and it stays intact. - **It holds no executable Ray code**, so no doctest or example can change behavior because of it. - **The check that consumes it already runs unconditionally.** `lint: documentation_style` sits in the `lint-small-prose` matrix in `.buildkite/lint.rayci.yml` carrying `always`, which `always.rules.txt` emits for every changed file. Vale therefore runs on every pull request whether or not the label is present. - **No premerge step is traded away.** `test.rules.txt` already routes `.vale.ini` and `.vale/` to `doc` alone, in the rendering-and-validation-only block. That tag reaches `doc: build`, which carries `skip-on-premerge`. **The checker source** is executable CI code, so the reasoning above does not apply to it. It clears the bar on tag routing: - **`test.rules.txt` routes `ci/ray_ci/doc/` to `doc_api tools` and nothing else**, ahead of the broad `ci/ray_ci/` rule, and first match wins. - **Every step the label skips carries a library tag instead** — `core_python`, `data`, `llm`, `train`, `tune`, `rllib_directly`, `serve`, and the `*_doc` tags. A change confined to this directory never emits a tag that selects one of them. Since the label's `if:` can only suppress an already-emitted step, there is nothing for it to take away. - **Measured on the same commit, with and without the label.** #65340 was built twice: [71727](https://buildkite.com/ray-project/premerge/builds/71727) carried `["go", "docs-go"]` and [71736](https://buildkite.com/ray-project/premerge/builds/71736) carried `["go"]`. Both emitted the same 33 jobs, and diffing the two job-name sets yields no difference in either direction. The label's only effect on such a PR is whether this guard itself is emitted: it ran and failed in the first build, and was `broken` (never emitted) in the second. That is the claim above, observed rather than derived. - **The checks that do cover the directory are ungated.** The `doc_api` API checks and the `tools` job running this directory's six `ci_unit` py_test targets both run with the label present. Build 71727 is the direct evidence: it carried `docs-go` and ran `doc: check API annotations`, `doc: check API doc consistency`, and all six `//ci/ray_ci/doc:*` targets, all green. - **`BUILD` files stay excluded**, so a change to this directory's test targets still fails the guard. #65340 is exactly that case: it adds a `py_test` src, so it would still not qualify for the label after this change. That is the intended outcome. Each list is deliberately narrow. For Vale it covers the prose rules, not the CI wiring that runs them: `ci/lint/check-documentation-style.sh` and the Vale hook in `.pre-commit-config.yaml` stay out of scope, because a change to either one alters what actually runs. For the checker it covers `ci/ray_ci/doc/` only, not the shared `ci/ray_ci/` tooling that every bazel test step runs through. ## Two corrections on the same surface - **The script's header comment claimed the label skips the API consistency checks.** It doesn't. `doc.rayci.yml` leaves them deliberately ungated, precisely because an API reference page edit is the content-only change they must cover, and build 71727 confirms both ran under the label. `ci.md` already described this correctly, so only the script was wrong. - **The failure message advised an action that cannot work.** It said "Remove the 'docs-go' label so the appropriate tests run," but removing the label cannot produce a corrected build on the same commit. A Buildkite rebuild replays the label set from the build it was rebuilt from, and the pipeline sets `skip_pull_request_builds_for_existing_commits`, so the `unlabeled` event on an already-built commit produces no build at all. Verified on #65340: `docs-go` was removed at 19:59:30Z, build 71727 was created at 20:00:03Z as a UI rebuild, and its payload still carried `["go", "docs-go"]`. The message and both prose surfaces now say to remove the label *and push a new commit*. ## Checks - [x] I've signed off every commit (`git commit --signoff`). - [x] I've made sure the tests are passing. - Testing Strategy - [x] Manual tests `shellcheck` is clean. The guard was exercised end to end against a controlled base in a scratch repository, 15 cases — the 7 from the Vale-only version, unchanged, plus 8 for the new path: | Changed files | Expected | Result | | --- | --- | --- | | `.vale.ini` + `.vale/styles/**` + a `doc/` page (the #65239 shape) | pass | pass | | `.vale/styles/**` alone | pass | pass | | a `doc/` page alone (behavior before this change) | pass | pass | | `.vale/styles/**` + a file under `python/ray/` | fail | fail, names the Python file | | `.vale/BUILD.bazel` | fail | fail, names it as a `BUILD` file | | `ci/lint/check-documentation-style.sh` | fail | fail | | `.pre-commit-config.yaml` | fail | fail | | `ci/ray_ci/doc/api.py` alone | pass | pass | | `ci/ray_ci/doc/api.py` + a `doc/` page | pass | pass | | `ci/ray_ci/doc/mock/_internal/__init__.py` | pass | pass | | `ci/ray_ci/doc/BUILD.bazel` (the #65340 shape) | fail | fail, names it as a `BUILD` file | | `ci/ray_ci/doc/api.py` + a file under `python/ray/` | fail | fail, names the Python file | | `ci/ray_ci/tester.py` (shared tooling, not the checker) | fail | fail | | `ci/ray_ci/docker/**` (sibling path) | fail | fail | | `doc/BUILD.bazel` | fail | fail, unchanged behavior | Note that this PR itself edits `ci/lint/`, so it deliberately does not carry the `docs-go` label. The label's effect on #65239 is the real confirmation, and I'll rebase that PR onto this once it lands. ## Related #64775 reserved the `doc` tag for documentation validation. The `docs-go` label and this guard arrived with the content-only escape hatch that followed. #65340 is the checker-source change that motivated the second path. --------- Signed-off-by: Douglas Strodtman <[email protected]>
## Why are these changes needed? The YAML under `doc/redirects/` is the source of truth for the docs.ray.io Read the Docs redirect configuration, managed with [rtd-redirects](https://github.com/anyscale/rtd-redirects). Today a PR that edits only redirect YAML runs no check at all, so a malformed or unreachable redirect can merge unnoticed. Nothing routes redirect YAML anywhere. `.yaml` isn't covered by the leading prose-and-image skip rule, nor by the `doc/*.py`/`doc/*.ipynb`/`doc/*/BUILD.bazel` catch-all, so it falls through to the broad `doc/` pass rule at the bottom of the doc section and emits no tag at all. Confirmed against the rule engine on master: `doc/redirects/current.yaml` emits `set()`. This adds a lightweight, credential-free premerge gate for `doc/redirects/*.yaml` that validates the redirects and prints the redirect-level diff. The change is purely additive: it gives redirect YAML a check where it previously had none, and no other path's selection changes. ## What changed - **`.buildkite/test.rules.txt`** — declare a `doc_redirects` test tag and route `doc/redirects/*.yaml` to it. The rule sits ahead of every `doc/` rule, which matters because the final `doc/` pass rule is what currently swallows these files. The rule emits `doc_redirects` alone, deliberately not `doc` or `doc_api`. A redirect edit can't change the documented API surface, and the check needs neither a rendered documentation build nor a compiled Ray: it parses the YAML and diffs it against the base ref. - **`.buildkite/test.rules.txt`** — route `.buildkite/doc.rayci.yml` to `doc_redirects` as well, on its own rule rather than by extending the autodoc-machinery block, so a `conf.py` edit doesn't start running the redirect check. An edit to a step definition has to be able to select the step it edits, which is the same reason that file already emits `doc_api`. This also covers the `anyscale-rtd-redirects` version pin, which lives in the redirect step's commands, so a version bump re-runs the check. - **`.buildkite/test.rules.test.txt`** — three cases: `doc/redirects/current.yaml: doc_redirects`, `doc/redirects/README.md:` asserting the prose beside it stays unrouted, and `.buildkite/doc.rayci.yml: doc doc_api doc_redirects`. The last one revises an assertion that already existed on master, since that file's tag set genuinely changes here. - **`.buildkite/doc.rayci.yml`** — add a `forge`-based step (no doc image) that installs the pinned `anyscale-rtd-redirects==0.2.0` from PyPI and runs: ``` rtd-redirects validate doc/redirects/current.yaml rtd-redirects diff-file --file doc/redirects/current.yaml --base FETCH_HEAD --head HEAD --repo . ``` The step diffs against `FETCH_HEAD` after fetching the PR's base branch, rather than against `origin/<base>`: a clone with a restricted refspec may never create a local remote-tracking ref, and `doc/test_no_new_rst.py` already solves the same problem the same way. The base branch resolves at runtime from `$${BUILDKITE_PULL_REQUEST_BASE_BRANCH:-master}`, escaped so the shell expands it rather than Buildkite interpolating it at pipeline-upload time, matching the `$${...}` convention used across the other pipeline files. The step also fails closed if `doc/redirects/` grows a YAML file the commands don't name. The tag selects on a glob, but multiple redirect files compose in the order given and a shell glob can't express that order, so the guard forces the compose-order decision to be made explicitly instead of letting a new file select the step and then go unvalidated. ## Verification Verified with Ray's rule parser (`ci/pipeline/determine_tests_to_run.py`), the same first-match-wins engine rayci uses: - `check_rules()` parses clean, and all 126 cases in `test.rules.test.txt` replay green. That file is enforced by the `test-rules` CI step, and rayci asserts exact set equality, so a passing case proves the path emits exactly those tags and nothing else. - A sweep of all 10,333 tracked files against master shows **exactly two deltas** — `doc/redirects/current.yaml` gaining `doc_redirects`, and `.buildkite/doc.rayci.yml` gaining it alongside its existing `doc doc_api` — and **zero tag losses** on any path. Every pre-existing assertion in `test.rules.test.txt` is preserved except the `doc.rayci.yml` one this PR deliberately revises. - Ran the step's commands locally in a clean venv with `anyscale-rtd-redirects==0.2.0` against the current `doc/redirects/current.yaml`: `validate` reports 0 errors (49 chain warnings, informational), and `diff-file --base FETCH_HEAD` reports the redirect-level diff and exits 0 with no Read the Docs credentials. - Exercised the drift guard both ways: it passes with only `current.yaml` present and exits non-zero when a second `doc/redirects/*.yaml` appears. Because `.buildkite/doc.rayci.yml` now emits `doc_redirects`, **this PR selects the new step and runs it**. Replaying this PR's own changed files through the rule engine gives a tag union of `doc`, `doc_api`, `doc_redirects`, and `tools`, so the step's commands are exercised in CI here rather than only on some later PR that happens to edit redirect YAML. It runs against an unchanged `current.yaml`, so `diff-file` reports an empty redirect diff and exits 0, which is exactly the smoke test that catches a typo in the step definition. ## Update: rebased onto the doc-tag reorg Rebased after #64775 and #64812 landed, which reorganized the doc tags: doc example tests moved to per-library `<lib>_doc` tags, and `doc` was split so the autodoc machinery emits `doc doc_api` while the rendering-only surface emits `doc`. This branch's four commits (one an upstream merge) are collapsed into one. Two conflicts in `test.rules.txt` (the tag declaration line, and the rule insertion point) and one in `test.rules.test.txt` (three expectations the reorg had since updated) were resolved in favor of master, then the `doc_redirects` rule and cases re-applied on top. The rebase also invalidated this PR's original rationale, so the rule and step comments have been rewritten. The earlier framing was that `doc_redirects` keeps redirect YAML from pulling in docbuild, the API checks, and the per-team doc tests. That's no longer accurate on any of the three: the per-team tests are selected by `<lib>_doc`, the two API checks carry `doc_api` plus the library tags and no longer carry bare `doc`, and the only remaining step carrying bare `doc` is `doc: build`, which is `skip-on-premerge`. Since redirect YAML emits nothing at all on master, this rule was never preventing over-triggering. It's additive, and the comments now say so. ## Update: the step now selects itself Cursor Bugbot caught that the redirect step wasn't reachable from an edit to its own definition: `.buildkite/doc.rayci.yml` emitted `doc doc_api` but never `doc_redirects`, so changing the redirect step's commands wouldn't have run the redirect step. That contradicted the rule's own stated reason for emitting `doc_api`, and this PR demonstrated the gap: its previous revision noted that the new step didn't execute here. Fixed by giving `.buildkite/doc.rayci.yml` its own rule emitting `doc doc_api doc_redirects`. It's a separate rule rather than an extra tag on the autodoc-machinery block, because that block also covers `conf.py`, `api_autogen.py`, and `doc/source/_ext/`, and a `conf.py` edit has no business running the redirect check. The first attempt at this appended the tag to the shared block and the full-repo sweep caught it immediately: seven machinery files picked up `doc_redirects`. AI assistance (Claude Code) was used to draft the CI step, the rebase conflict resolution, and this description. Every changed line was reviewed by hand, and the verification above was run as described. This isn't duplicating existing work: no other open PR adds redirect validation to premerge, and the `doc_redirects` tag doesn't exist on master. ## Update: uv, and a recursive fail-closed guard Two review follow-ups. **Install with `uv`** (Elliot's suggestion). `ci/docker/forge.Dockerfile` already installs uv to `/usr/local/bin` and uses it for the image's Python, so the step needs no extra setup. It's `uv tool install` rather than `uv pip install --system` for a PATH reason: the previous revision's premerge log shows `pip install` fell back to a user install, so the `rtd-redirects` entry point resolved from `~/.local/bin`. `uv tool install` writes executables to that same directory, so PATH resolution is unchanged. `uv pip install --system` would target the uv-managed interpreter and put the entry point in that env's `bin`, which isn't on PATH. **The fail-closed guard now recurses.** Cursor Bugbot caught that the guard's single-level shell glob didn't cover a nested redirect file, and it was right. The rule engine matches with `fnmatch`, whose `*` crosses `/`, so `doc/redirects/nested/foo.yaml` emits `doc_redirects` and selects this step, while `ls doc/redirects/*.yaml` never saw it and the guard passed. Replacing the glob with `find` closes the gap. Exercised three ways locally: passes with only `current.yaml`, exits non-zero for a nested file and for a sibling file. A `.yml` file stays out of scope. The tag rule matches `*.yaml` only, so `doc/redirects/current.yml` emits no tags and never selects the step, putting it beyond the guard's reach. That matches the pre-PR baseline for every redirect file rather than regressing anything, and `rtd-redirects` uses `.yaml`. Re-verified after the change: rules parse clean and all 126 cases in `test.rules.test.txt` replay green (the rule files are untouched by this revision). ## Related issue number N/A ## Checks - [x] I've signed off every commit (`-s`), because all commits are squashed into one when merged. - [x] I've run `scripts/format.sh` to lint the changes in this PR. (Via `pre-commit`; the applicable hooks pass.) - [x] I've made sure the tests are passing. - Testing Strategy - [x] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: Douglas Strodtman <[email protected]>
…per library (ray-project#64775) ## Reviewer summary **What this does.** The per-team `X: doc tests` steps are library example and doctest suites that live under `doc/`. They exercise library code, not documentation quality. Today every executable doc asset emits the blanket `doc` tag and all six teams' steps are tagged `doc`, so a one-library doc change starts every team's step. This gives each step a dedicated `<lib>_doc` tag, routes `doc/source/<lib>/**` to the owning library's tag, renames the steps to `X: docs example tests`, and leaves `doc` for documentation validation (the build and the Vale/config infra). The library tag stays on each step, so a library **code** change runs its doc example tests exactly as before. **What's verified.** | Claim | Evidence | |---|---| | Each path emits exactly the intended tag, and no other | `test-rules` green on this PR. That's the pinned `rayci` binary replaying all 103 `test.rules.test.txt` assertions (up from 57 on master) with **exact set equality**, so each case also proves the blanket `doc` tag does *not* come along. | | The emitted tags resolve to the intended steps, and only those | Generated the real pipeline locally with the pinned `rayci v0.46.0` release binary for a one-file Serve doc-example change, before and after this branch. Output below. | | The renamed steps still run and pass | All five plus the GPU and dask siblings green on this PR, selected via the library tags this change preserves. | | Every executable target under `doc/` routes to a step that can actually select it | Swept all 948 (file, target) claims against the per-team `team:` / `--only-tags` / `--except-tags` filters. One deliberate exception (`doc/test_myst_doc.py`, below) and two pre-existing gaps that this change doesn't create. | | The rename doesn't reset step identity | rayci derives step IDs positionally (`fmt.Sprintf("g%d_s%d", i, j)`, `converter.go`), not from the label. The generated pipelines confirm it: `g16_s12`, `g16_s21`, `g6_s22`, `g13_s26` are identical before and after. | **What I need from a reviewer.** 1. **One question I can't answer from inside the repo.** `ci/build/get_build_info.py` sets `config.env` to `"Buildkite " + BUILDKITE_LABEL`, and `ci/build/upload_build_info.sh` uploads it on postmerge pipelines on `master` only. Does anything downstream of that `metadata.json` treat `config.env` as an identity or grouping key? If it's descriptive, renaming five steps is free. If something groups on it, those five steps' postmerge history splits at the merge commit. Flaky-test selection and target selection both key on `team` (unchanged here) and test identity is the bazel target name (`f"{system}:{name}"` in `release/ray_release/test.py`), so I believe `config.env` is the only place the label escapes. 1. **Confirm the API-check behavior change below is acceptable.** 1. **Confirm the catch-all owner.** Executable doc assets in directories with no per-team step route to the core step: roughly 25 files, being 18 `doc/source/templates/*/start.ipynb` plus a handful under `doc/source/cluster/doc_code/`, `doc/source/ray-contribute/doc_code/`, and `doc/source/_templates/`. The templates majority may be retired or externally managed, in which case a skip rule is the better answer than core ownership. **Known behavior change worth your eyes.** Because `doc/source/<lib>/doc_code/` and `examples/` now emit `<lib>_doc` instead of `doc`, the two API-surface checks (`doc: check API annotations`, `doc: check API doc consistency`) stop running on library doc-example changes. They carry the blanket `doc` tag among their library tags, so today a `doc_code` edit incidentally triggers a premerge `make -C doc/ html`. I think that's correct: those checks guard the documented public API surface, which a doc example can't change, and the example itself is still executed by the owning library's step while the render is gated by Read the Docs. But it is a premerge signal that disappears, so it should be a decision rather than a side effect. Raised on ray-project#64812, which routes the API **reference** pages to a dedicated `doc_api` tag for the related case. **Out of scope, tracked separately.** `.buildkite/others.rayci.yml:13` declares a sixth step labeled `doc tests`, running `//python/ray/... //doc/... none --only-tags doctest` and tagged `python`, a tag no rule in `test.rules.txt` emits. Generating the full-fan-out pipeline shows it does get emitted (`doc tests [g14_s1]`), so it is live. After this rename it becomes the only step in the repo still called "doc tests." This PR doesn't touch `others.rayci.yml` and the fix is independent. --- ## What this changes 1. **Dedicated per-library tag.** Each step gets a `<lib>_doc` tag (`core_doc`, `data_doc`, `ml_doc`, `rllib_doc`, `serve_doc`) and drops the blanket `doc` tag. The library tag stays. 1. **Path routing.** `test.rules.txt` routes `doc/source/<lib>/**` to that library's tag, so a doc change runs only the owning library's example tests. LLM doc assets already route to `llm` and keep doing so. 1. **`doc` reserved for validation.** It now stays only on the documentation build and the Vale/config infra. 1. **Rename** to `X: docs example tests`, since a failure in these steps means library code or an example broke, not that the docs are wrong. 1. **Build-file rule fix.** `test.rules.txt` matched `doc/BUILD` and `doc/*/BUILD`, but the files are `BUILD.bazel`, so editing a file that *defines* the doc test targets ran no doc tests premerge. It now matches the `.bazel` files and routes them to the same per-library steps. The root `doc/BUILD.bazel` defines every library's targets, so it routes to all of them. ### Scoping exceptions, and why each exists Several paths sit under a library doc directory but can't be meaningfully tested by that library's example step, so they're routed explicitly rather than by directory: - **Static images skip entirely.** Image extensions sit on the leading skip rule, ahead of the per-library rules, so a `.png` or `.svg` edit triggers nothing. 310 tracked image files. `.yaml` and `.sh` stay routed, since unlike an image they can change what a test does. - **Sphinx build machinery routes to `doc`.** `conf.py` imports `custom_directives`, `api_autogen`, `api_mock_imports`, and `template_collections`; none was listed in the validation-infra rule, so all fell to the `doc/*.py` catch-all and emitted `core_doc`, running Ray Core's doctests for a docs-build-machinery edit. Those four plus `preprocess_github_markdown` and the doc-root build helpers now route to `doc`. They're enumerated one per line on purpose: `*` is fnmatch here and crosses `/`, so a `doc/source/*.py` pattern would also swallow every example script under `doc/source/<lib>/doc_code/`. There's a comment on the rule saying so. - **Gallery configs route to `doc`.** `doc/source/{data,serve,train}/examples.yml` are parsed by `custom_directives.py` (`EXAMPLE_GALLERY_CONFIGS`) to generate the gallery pages. They hold no executable code and can't change what any example does. Narrowed to a three-path exception rather than a blanket `.yml` skip, because a sibling `.yml` under a library doc directory can be a config an example consumes. - **`doc/.claude/` triggers nothing.** Agent files never participate in the Sphinx build and define no test targets, but `doc/.claude/skills/sphinx-fix/sphinx_fix.py` matched the `doc/*.py` catch-all. The Read the Docs build guard already excludes this exact path for the same reason, so the two guards now agree. Pre-existing rather than a regression from this PR: on master the file emits the blanket `doc` tag, which reaches all five per-team steps. - **Four `team:ml` notebooks under `ray-core/` route to `ml_doc`.** `plot_hyperparameter`, `batch_prediction`, `plot_parameter_server`, and `plot_pong_example` live under `doc/source/ray-core/examples/` but their targets are tagged `team:ml`, and the team argument to `//ci/ray_ci:test_in_docker` filters targets by `team:<team>` (`_get_all_test_query`, `ci/ray_ci/tester.py`). Routing them to `core_doc` would run a step that tests everything under `ray-core/` except the file that changed. Re-tagging the four `team:core` in `doc/BUILD.bazel` is the alternative fix and would let the rule lines go away. - **`highly_parallel.ipynb` routes to `doc`.** Its `py_test` carries a `highly_parallel` tag that the ml docs example step excludes, and the notebook glob in `doc/source/ray-core/examples/BUILD.bazel` excludes it too, as a release test needing a live multi-node cluster. The remaining ml `//doc/...` steps select `gpu` / `train_v2_gpu` and the target has neither, so no premerge step executes it. Routing to `doc` means the build renders it (`nb_execution_mode` defaults to `off`, so render-and-lint only), which is the only validation premerge offers here. - **`doc/external/` routes to `ml_doc`.** Its `test_external_hashes` target is tagged `team:ml`; it had fallen through the `doc/*.py` catch-all to `core_doc`, where the core step's `team:core` query never sees it. - **The `llms.txt` files route to `doc`.** ray-project#64458 adds `doc/test_llms_txt.py` and `doc/source/llms_txt_summary.txt` with no `test.rules.txt` change. Left alone the test would land on the `doc/*.py` catch-all and emit `core_doc`, running Ray Core's doctests for a test its own docstring describes as hermetic, while never running the step that executes it. Rules for absent paths are inert, so there's no ordering dependency: this PR doesn't touch `doc.rayci.yml`, ray-project#64458 doesn't touch `test.rules.txt`, and whichever lands first the other merges correctly scoped. - **Declined:** fanning `doc/test_myst_doc.py` out to all five `<lib>_doc` tags. It backs 19 targets across every team, but it's shared infrastructure, so a break surfaces in core as readily as anywhere. One library's worth of execution is a sufficient smoke signal and the post-merge build covers the rest. The rule carries a comment recording that trade and when to revisit it. ### Effect on a doc-only PR (no `docs-go`) | Change | Before | After | |---|---|---| | A Serve doc example | every team's `doc tests` step | `serve: docs example tests` and its GPU sibling | | A Data doc example | every team's `doc tests` step | `data: docs example tests`, plus the dask and GPU siblings | | An image under a library doc dir | that library's example step | nothing | | A Sphinx build module (`custom_directives.py` etc.) | `core: docs example tests` | `doc: build` only (post-merge) | | A gallery config (`examples.yml`) | that library's example step | `doc: build` only (post-merge) | | Editing `doc/BUILD.bazel` | nothing (rule was dead) | the doc example steps it defines | | The two `doc: check API*` checks | ran, via the blanket `doc` tag | don't run (see reviewer summary) | The GPU and dask siblings carry `<lib>_doc` too, and tag matching is a non-empty intersection, so they're selected alongside the main step. That's unchanged behavior: they carried the blanket `doc` tag before, so a doc change already started them. No new GPU cost. ## Verification **Rule conformance, under the authoritative evaluator.** `test-rules` is green on this PR. It replays all 103 `test.rules.test.txt` assertions through the pinned `rayci` binary, and `runTestRules` compares the full computed tag set per path, so every case is also a negative assertion that no other tag fires. **Tag-to-step resolution, generated locally.** The tag set isn't the step set: rayci filters steps by tag, then `markDeps` pulls in everything reachable through `depends_on` regardless of that step's own tags. To confirm the composition rather than infer it, I ran the pinned `rayci v0.46.0` release binary against a one-file Serve doc-example change, on master and on this branch: ``` before (base=master) changed files: [doc/source/serve/doc_code/app_builder.py] selected tags: always doc lint doc-related steps emitted: core: doc tests [g6_s22] ml: doc tests [g13_s26] data: doc tests [g7_s21] rllib: doc tests [g15_s8] data: dask doc tests [g7_s22] serve: doc tests [g16_s12] data: doc gpu tests [g7_s23] serve: doc gpu tests [g16_s21] doc: check API annotations [g9_s3] doc: check API doc consistency [g9_s4] after (this branch) changed files: [doc/source/serve/doc_code/app_builder.py] selected tags: always lint serve_doc doc-related steps emitted: serve: docs example tests [g16_s12] serve: docs example gpu tests [g16_s21] ``` Six teams' example steps collapse to the owning team's two, and the step IDs are unchanged across the rename. **Routing versus coverage.** Correct routing isn't sufficient: the step that starts still has to select the target. `ci/ray_ci/tester.py` filters by `attr(tags, 'team:<team>')`, then intersects `--only-tags` and subtracts `--except-tags`, so a change can route perfectly, start the right-looking step, and be invisible to every command in it. I swept all 948 (file, target) claims under `doc/` against the per-team filters. After the exceptions above, the only deliberate team mismatch left is `doc/test_myst_doc.py`. Two pre-existing gaps fell out, neither created by this change: - **GPU-tagged ml and core doc examples have no owning step** — six `team:ml` notebooks tagged `gpu`, five `team:core` `doc_code` modules tagged `multi_gpu`, and one `post_wheel_build` module. `data` and `serve` each have a GPU doc-example step; ml and core never got one, so the only steps that would run these are gated on `train_gpu` and `cgraphs_direct_transport`, which no doc path emits. No `doc`-tagged step ran them before the split either. This needs a REEf and library-team decision rather than a rules change. - **Prose doctests aren't triggered by prose edits.** The `doc/BUILD.bazel` `doctest` targets over `doc/source/**/*.{md,rst}` are reachable only from the `others.rayci.yml` step gated on `python`, while prose paths hit the leading skip rule. Roughly 700 files. I consider this correct as-is: given current coverage the Read the Docs render build is the gate a prose change needs. **Also swept** all 1,628 tracked `doc/` files against the previous rules to confirm exactly which paths changed routing and that nothing else moved. ## Change log Consolidated above; kept here so the review history stays legible. - `6a1310d3b5` — the split: per-library tags, path routing, rename, `BUILD.bazel` rule fix. - `c6302c8a21`, `b1d03629cf` — first bot-review pass: static images skip; Sphinx build modules route to `doc`. - `99c3af2c28` — pre-route the `llms.txt` extension test and summary ahead of ray-project#64458. - `3795c6161b` — skip `doc/.claude/`; route the `team:ml` `ray-core` notebooks to `ml_doc`. - `e88e8a4b52` — remove a stray `TEMP(do-not-merge)` marker that reached master with ray-project#65040. Inert, and independent of this PR's thesis; happy to split it out. - `f8347baf54` — second bot-review pass: gallery configs to `doc`; correct `highly_parallel.ipynb` to `doc`. - `6a050a0511` — route `doc/external/` to `ml_doc` so the hash guard still runs. ## AI assistance This change was drafted with AI assistance (Claude Code) and reviewed by me. --------- Signed-off-by: Douglas Strodtman <[email protected]> Signed-off-by: 400Ping <[email protected]>
…ce checks (ray-project#64812) ## The problem Two premerge checks in `.buildkite/doc.rayci.yml` cross-check every `@PublicAPI` symbol against the autosummary pages that document it: - `doc: check API annotations` - `doc: check API doc consistency` They currently run on the wrong set of changes, in both directions. **They miss changes they should catch.** API reference pages are `.rst` and `.md`, so the leading prose-and-image skip rule in `test.rules.txt` matches them first. Editing `doc/source/data/api/api.rst` changes the documented public API surface and triggers **no premerge step at all**. **They run on changes that can't affect the API surface.** Both steps carry the blanket `doc` tag. Since ray-project#64775 reserved `doc` for documentation validation, that tag now covers two unlike things: the autodoc machinery that decides what the API reference *contains*, and rendering config that can't change it. So a Vale vocabulary tweak pays for a `docbuild` plus both checks. ## The fix Add a `doc_api` tag, and route to it everything that can change the documented API surface or how it's computed. Then take the blanket `doc` tag off the two steps. | A change to | today | with this PR | |---|---|---| | An API reference page | **skip** | run | | The checker's own source (`ci/ray_ci/doc/`) | **skip** | run | | `conf.py`, `api_autogen.py`, `api_mock_imports.py`, `_ext/` | run | run | | Docs dependency locks (`deplocks/docs/*.lock`) | run | run | | Library Python source | run | run | | `.vale.ini`, Vale vocabularies | run | **skip** | | `rtd_doctor.py`, `template_collections.py` | run | **skip** | | `.readthedocs.yaml`, gallery configs | run | **skip** | | Narrative prose, images | skip | skip | ## What's in the diff Three commits, 7 files. 1. **`a0b545cc3e`** declares `doc_api` and routes the six per-team API reference directories to it, ahead of the skip rule. Also splits the doc-build infra block in two: the autodoc machinery emits `doc doc_api`, the rendering-only half emits `doc` alone. Then drops the bare `doc` tag from both check steps. 2. **`e0d520381d`** adds two drift guards in `//ci/pipeline:test_doc_api_rules_sync`. Both `doc_api` lists are hand-maintained and fail *silently* when they drift — a missing entry means those paths quietly stop being checked. One guard keeps the page list aligned with `API_PATH_PREFIXES` in `doc/source/_ext/api_sidebar.py`. The other requires every local module `conf.py` imports to be routed to `doc_api` or named as an explicit rendering-only exception. 3. **`f3db137384`** routes `api_sidebar.py` to `tools` as well, so the first guard actually runs. It was one-directional before: `test.rules.txt` emits `tools`, so the guard fired on a rules-side edit, but `api_sidebar.py` didn't, so growing `API_PATH_PREFIXES` without the matching rule never executed it — the likelier mistake, and exactly the drift the guard exists to catch. Also removes four duplicated assertions. Three details worth knowing, since each looks like an oversight otherwise: - **`ci/ray_ci/doc/` keeps `tools` alongside `doc_api`.** It declares six `ci_unit` `py_test` targets and `tools` is what selects the job that runs them, so dropping it would mean editing the checker never runs the checker's own unit tests. - **`doc.rayci.yml` also emits `doc_api`,** so editing a check's step definition exercises the check it defines. - **`doc/source/ray-observability/reference/` is routed even though it sits outside `doc/source/*/api/`.** Ray Core's `api/index.rst` toctrees into its `api.rst`, so it's part of the Core API-surface walk. ## Testing `test.rules.test.txt` gains cases for the API pages (including a nested leaf page, to pin recursive directory matching), the checker source, each machinery path, and negative cases asserting the rendering half still emits `doc` alone. **These are the real gate:** the `test-rules` step runs them through rayci's parser as exact set equality, so a passing case proves a path emits precisely those tags and nothing else. Locally, against the in-repo reference engine (`ci/pipeline/determine_tests_to_run.py`): - `check_rules()` passes; **115 of 115** replay cases pass. - Across all 10,213 tracked files the routing change is **purely additive: 95 files gain tags, none lose any.** - No executable asset (`.py`, `.ipynb`) lives under the routed API directories, so no library docs-example step loses coverage. ``` python -m pytest ci/pipeline/test_doc_api_rules_sync.py ``` ## Two notes for reviewers **One behavior change to sanity-check.** Neither check carries an `if:` guard now, including the `docs-go` one they had before. A content-only PR labeled `docs-go` that touches an API reference page will run both checks plus their `docbuild` dependency, where it previously skipped them. That's intended — `docs-go` exists to skip per-team doc *example execution*, and an API reference edit is exactly the content-only change these checks must still cover — but it's a real cost change for that workflow. `docs-go` keeps its role everywhere else: 12 per-team doc example steps across `core`, `data`, `llm`, `ml`, `rllib`, `serve`, and `linux_aarch64`, plus the `lint: validate docs-go scope` step that enforces the label is only used on doc-only PRs. **This PR changed shape, so earlier comments describe an older design.** It began as a `docs-api-go` PR label that would re-enable the checks on a `docs-go` PR. That's removed: tag selection and Buildkite `if:` are separate passes, and `if:` can only suppress a step the tags already emitted, so with the routing correct the label could only ever subtract. Dropping the `if:` achieves the same thing with no label to create or remember. Consequently the earlier Gemini review and the 2026-08-04 comment above both reference a `docs-api-go` label that no longer exists. Everything else in that comment still stands, including its decision that `doc_code/` and `examples/` should *not* grow into `doc_api`. 🤖 Written with assistance from Claude Code. --------- Signed-off-by: Douglas Strodtman <[email protected]> Signed-off-by: 400Ping <[email protected]>
…cipe (ray-project#65285) ## Why this change `doc/source/ray-contribute/ci.md` explains what CI runs on a PR, but stops at `microcheck` and the `go` label. It says nothing about what runs when the PR changes documentation, which is the case the page's likely reader is in. This adds that, and folds in a recipe for reproducing the API consistency check locally. ### What's new **"Documentation CI checks"** covers, in the order a contributor meets them: - The Read the Docs render gate, including that `fail_on_warning: true` makes any Sphinx warning a build failure, and when the preview build skips. - The two API surface checks, and the `doc_api` tag that lets an API reference page edit reach them even though it's a documentation change. - The per-library `<library>: docs example tests` steps, with a table mapping path to step to tag, plus the Ray Core fallback and the Ray LLM exception. - That a prose-only or image-only change runs no library test steps at all. - The `docs-go` label and the `lint: validate docs-go scope` guard that bounds it. - The two post-merge-only steps, `doc: build` and `doc: linkcheck`. **"Running the API consistency check locally"** documents the three phases of `api_policy_check`, what the `docbuild` image does and doesn't install (the deep-learning backends are mocked even in CI), and a `uv` recipe that gets close enough for iteration. It also updates one example commit message under the `microcheck` section that named the old `serve doc tests` step label. **`doc/.claude/CLAUDE.md`** carried the same staleness, so it's fixed in the same PR. It still said the `doc` tag "covers content under `doc/`", which stopped being true when ray-project#64775 landed. It now describes the three-way split (`doc` for build and validation infra, `<lib>_doc` for executable doc assets, `doc_api` for the API reference surface), records that prose and images trigger nothing, and documents the `docs-go` label and its scope guard. Two smaller drifts are corrected alongside: the docs deplock rule emits `doc_api` now too, and the "tag it `doc`" advice pointed at a tag that no longer selects content steps. This file is an agent instruction file rather than published documentation, so it's worth saying why it rides along here instead of going out separately. `AGENTS.md` requires a dedicated PR for changes to itself, which this isn't. `doc/.claude/` is on the skip rule in `test.rules.txt` and excluded from the Read the Docs build guard, so including it changes this PR's trigger set by nothing. And it's the same factual correction as the page, from the same source reading — splitting them would mean verifying the same CI configuration twice and risking the two descriptions drifting apart again. ## Not a duplicate This supersedes two of my own open PRs and replaces both: - ray-project#64842 added a documentation CI overview. It was written before ray-project#64775 landed and describes the pre-rework model, where a single `doc` tag selected the per-team doc test steps. That's no longer how routing works, so landing it as-is would have documented the wrong thing. - ray-project#64450 added the local API-check section. Its content is carried over here essentially unchanged. Both branched from the same pre-ray-project#64775 commit and added an identically titled section, so they also conflicted with each other. Combining them is cheaper to review than rebasing two PRs that overlap. I'm not aware of another open PR touching this page. Checked with `gh pr list --repo ray-project/ray --state open --search "ray-contribute ci.md"`. ## Verification Every factual claim was checked against `master` at `695a8814ea` rather than carried over from the superseded PRs: - Step labels, tags, and `if:` guards read from `.buildkite/doc.rayci.yml`, `core.rayci.yml`, `data.rayci.yml`, `ml.rayci.yml`, `rllib.rayci.yml`, `serve.rayci.yml`, and `lint.rayci.yml`. - Path-to-tag routing read from `.buildkite/test.rules.txt`. - The render gate behavior read from `.readthedocs.yaml` (`fail_on_warning: true`, the `post_checkout` skip guard) and `doc/Makefile`. - The mocked-backend claim checked against `ci/docker/doc.build.Dockerfile`, which stages the `ray-core` and `ray-dashboard` artifacts and installs only the docs lock, and `doc/source/api_mock_imports.py`, which lists `torch`, `transformers`, and `tensorflow`. This corrects ray-project#64842, which claimed the base images supply those libraries for real. - `doc: build`'s upload behavior read from `ci/ray_ci/doc/cmd_build.py` (postmerge, `master` only). - The `docs/readthedocs.com:anyscale-ray` check name confirmed from the status checks on an open PR. Commands run: ``` vale --config=.vale.ini doc/source/ray-contribute/ci.md python doc/test_no_new_rst.py pre-commit run --files doc/source/ray-contribute/ci.md ``` `test_no_new_rst.py` passes. `pre-commit` reports no applicable hooks for a Markdown file under `doc/source/`. Vale surfaces no new findings in the added text beyond spelling hits on project vocabulary (`Buildkite`, `premerge`, `docbuild`, `autodoc`, `autosummary`, `toctree`); note that CI's `documentation_style` lint scopes Vale to `doc/source/data` and `doc/source/ray-overview/examples`, so this page isn't in its path set. The same source reading backs the `doc/.claude/CLAUDE.md` edit; it asserts nothing the page doesn't. Rendering verified by parsing the page with `myst-parser` using the repo's `myst_heading_anchors = 4`: the table, the `{warning}` directive, and the heading hierarchy all parse, with no skipped heading levels. Both cross-references (`writing-code-snippets.md`, `docs.md#building-the-ray-documentation`) point at existing `.md` sources and an existing heading. The Read the Docs preview on this PR is the real render check. ## AI assistance AI assistance (Claude Code) was used to draft this change and to cross-check the claims against the CI configuration. I've reviewed every line. --------- Signed-off-by: Douglas Strodtman <[email protected]> Signed-off-by: 400Ping <[email protected]>
…ep (ray-project#65289) ## Why this change The trailing catch-all in `.buildkite/test.rules.txt` routes any remaining `.py` or `.ipynb` under `doc/` to `core_doc`. For a few directories that starts Ray Core's docs example step for files the step cannot run, because no bazel target covers them: - `doc/BUILD.bazel` names `source/templates/` exactly once, and it's a doctest *exclusion*. - Nothing covers `doc/source/cluster/doc_code/`, `doc/source/ray-contribute/doc_code/`, or `doc/source/_templates/`. So the step spins up, runs Core's own targets, and never touches the file that changed. Cost without signal. This is a follow-on to ray-project#64775, which introduced the per-library `<lib>_doc` tags and left this population on the catch-all deliberately, pending a check of what was actually there. ## What it does Splits the population by what the documentation build actually reads. **Routed to `doc` (build and validation only).** Sources a rendered page pulls in with `literalinclude`. Nothing executes them, but Sphinx reads them, so a rename or delete breaks the including page and the build is the only premerge check that can catch it. Same reasoning ray-project#64775 applied to `highly_parallel.ipynb`. - `doc/source/cluster/doc_code/` — included by four `cluster/vms/user-guides/community/` pages - `doc/source/ray-contribute/doc_code/` — included 3x by `writing-code-snippets.md` - `doc/source/templates/05_dreambooth_finetuning/` — included ~12x by `train/examples/pytorch/dreambooth_finetuning.rst` **Skipped.** `exclude_patterns` in `doc/source/conf.py` drops `templates/*` from the build outright, so Sphinx never reads any of it. `01`–`03` have no reference anywhere in the repo; `04` is cited only as a GitHub URL from `train/deepspeed.rst`, `train/huggingface-accelerate.rst`, and the Train examples gallery, none of which a build step resolves. `_templates/template.ipynb` is boilerplate contributors copy, linked as a GitHub URL from `ray-contribute/docs.md`. - `doc/source/templates/` (01 through 04) - `doc/source/_templates/` Images and prose under the `doc`-routed directories are unaffected: the leading prose-and-image skip still matches them first, as everywhere else in the tree. The dreambooth page's `.. image::` targets therefore stay skipped, consistent with every other doc image. Widening that is a separate decision and belongs in that rule. ## Blast radius Dry-ran `ci/pipeline/determine_tests_to_run.py` over **all 10,255 tracked files**, before and after: - **33 paths change routing. All are under `doc/`. Zero outside.** - 14 move `core_doc` → `doc` (the `literalinclude` sources) - 11 move `core_doc` → nothing (templates 01–04, `_templates`) - 8 move nothing → `doc` (non-`.py` include inputs such as `slurm-basic.sh`, `ray-skein.yaml`, `dreambooth_run.sh`, which the catch-all's `.py`/`.ipynb` patterns never reached) Net: 25 files stop starting a docs example step that couldn't run them; 8 gain the documentation build, which is the cheap step and the one that can catch a broken include. These are directory rules, matching how `doc/external/` is handled. That means four non-included assets under `05` (its Dockerfile, two compute configs, `requirements.txt`) start the build too. Deliberate trade — enumerating individual include targets would rot the moment someone adds a `literalinclude`. ## Tests Added 8 cases to `.buildkite/test.rules.test.txt`, including two regression guards: that the leading prose-and-image skip still wins *inside* a `doc`-routed directory, and that `doc/test_myst_doc.py` stays on `core_doc` so the catch-all keeps working for its real purpose. ``` $ python ci/pipeline/determine_tests_to_run.py # replayed over every fixture case fixture cases: 124 evaluated: 124 mismatches: 0 ``` All 124 cases pass, the 116 pre-existing ones included. `pre-commit run --files .buildkite/test.rules.txt .buildkite/test.rules.test.txt` passes. The authoritative tag computation is the external `rayci` `test-rules` step, not this in-repo parser, so premerge on this PR is the real confirmation. ## Not a duplicate No open PR touches `.buildkite/test.rules.txt` (`gh pr list --search "test.rules.txt in:title,body"` returns four unrelated PRs). This continues ray-project#64775, which is merged. ## Follow-up, deliberately not in this PR `doc/source/templates/README.md` documents a contribution workflow that can't be followed: it points at `templates.yaml`, `testing/validate.py`, `testing/release/`, and `//doc:workspace_templates`, none of which exist. Templates `01`–`03` look like orphaned 2.6-era artifacts and are probably deletable, but `04` and `05` are not, since published pages link to or inline them. That's content cleanup with its own reviewers, and external links to those GitHub paths may exist, so it wants a maintainer's call separately. --- AI assistance was used to research and draft this change. Opening as a draft for my own review pass before requesting maintainer review. Signed-off-by: Douglas Strodtman <[email protected]> Signed-off-by: 400Ping <[email protected]>
…project#65333) ## Why this change `.buildkite/others.rayci.yml` has a step labeled `doc tests`, tagged `python`. **`python` is declared in no `.rules.txt` file and emitted by no rule.** It isn't in the tag-declaration block of `test.rules.txt` or `always.rules.txt`, and no rule emits it. In `raycicmd/step_filter.go`, `acceptTagHit` returns early only when `runAll` is set; the `noTagMeansAlways` escape doesn't apply because the step *does* carry a tag, so it falls through to `step.hasTagInMap(f.tags)` and misses. On non-pull-request builds `needRunAllTags` returns `["*"]`, `runAll` is set, and the step runs. So the step is postmerge-only, but by accident rather than by intent. Nothing in the file says so, and the behavior rests on a tag that reads like it means something. Confirmed against real builds: - Premerge [71703](https://buildkite.com/ray-project/premerge/builds/71703) — 231 jobs, the broadest recent build, with all five per-library docs example steps present. A job named `doc tests` is **absent**. - Postmerge [19099](https://buildkite.com/ray-project/postmerge/builds/19099) — 923 jobs. `doc tests [g14_s1]` is **present** and passed. It's also the last step in the repo still called `doc tests`, after ray-project#64775 renamed the per-library steps to `<library>: docs example tests`. `git grep 'label:.*doc test'` returned exactly this one line. That's a naming collision with five steps that do something else: those execute a library's documentation examples, while this one runs `//doc:doctest`, the catch-all doctest target for documentation prose that no library owns (tagged `team:none`). The per-library steps each filter on their own `team:<lib>`, so this is the only step that reaches it. ## What this changes Tags and label only. **No behavior change** — the step runs exactly where it ran before. - **`skip-on-premerge`** states the existing postmerge-only behavior explicitly, instead of leaving it to an unmatched tag. Matches `doc: build` and `doc: linkcheck` in `doc.rayci.yml`, and the postmerge-only minimal-tests step in `core.rayci.yml`, which uses the same pattern with a comment. - **`doc`** is the build-and-validation tag, which is what this step is. It does **not** re-enable the step on premerge: skip tags are rejected in the filter's first pass (`hit = !reject(step) && accept(step)`) before tag selection runs. That's why `doc: build` carries `doc`, a rule-emitted tag, and is still postmerge-only. - **`oss`** matches the sibling doc steps. - **`python`** is dropped. It stays on `core_minimal_tests_postmerge` in `core.rayci.yml`, where it's harmless because that step also carries real tags and an explicit `skip-on-premerge`. - The label becomes **`doc: doctest`**, after the target it runs, matching the `doc:` prefix the other doc steps use. Renaming is safe for microcheck step-id selection because ids are positional (`g<group>_s<step>`) and the step keeps its position in its group. Reordering would be the risky operation; this isn't one. ## Testing **Emitted-pipeline differential using the pinned rayci binary** (`v0.46.0`, from the repo's own `.rayciversion`), rather than inferring from tags. Probe path `.readthedocs.yaml`, chosen because it emits `doc` — the tag being added — so this is the case most likely to expose an accidental premerge trigger. Both runs report `selected tags: always doc lint` and emit the same 6 steps: ``` wanda: forge :test_tube: test-rules [g5_s0] :lint-roller: lint: {{matrix}} [g11_s0] :lint-roller: lint: {{matrix}} [g11_s1] :lint-roller: pre-commit pydoclint [g11_s2] :lint-roller: lint: validate docs-go scope [g11_s3] ``` Diffing the two full pipeline YAMLs, the only differences are the probe commit SHAs in `BUILDKITE_ARTIFACT_UPLOAD_DESTINATION`, which are an artifact of how the probe commit is generated. Everything else is byte-identical, and `doc: doctest` appears in neither pipeline. So with `doc` emitted, the step stays off premerge before and after. **Postmerge preservation.** `doc: build [g9_s2]` and `doc: linkcheck [g9_s5]` both carry `skip-on-premerge` and both appear on postmerge build 19099, so the added skip tag doesn't remove a step from postmerge. **Filter simulation** across four scenarios (prose-only premerge, broad code premerge, docs-infra premerge, and postmerge run-all): identical selection before and after in all four. **Lint.** `pre-commit run --files .buildkite/others.rayci.yml` passes. YAML parses, and the step's `depends_on`, `instance_type`, and commands are untouched. ## Not a duplicate `gh pr list --repo ray-project/ray --state open` searched for `others.rayci.yml`, `"doc tests"`, and `doctest` in title and body — no open PR touches this step or this file. ## Follow-ups deliberately not in this PR While measuring this step I found two things that are about the *target*, not its routing, so they need different reviewers and their own change: - **`//doc:doctest` currently collects zero doctests.** Of the 204 files in its glob, the 131 `.md` files contain no `>>>` prompt, which is the only form pytest collects. The one file in the glob that has a doctest is `ray-references/glossary.rst`, and the pytest arg is `--doctest-glob=*.md`, so `.rst` isn't collected. The three other prose files in the tree carrying `>>>` are all in the target's own exclude list. Its measured cost is ~8m wall clock for 57.9s of bazel work. - **`bazel/pytest_wrapper.py` maps `NO_TESTS_COLLECTED` to `OK`**, so a target that collects nothing passes green. That applies to every `doctest()` target in the repo, so any of them could silently stop collecting and stay green. Happy to open those separately, or to fold the size correction bazel already suggests (`Test execution time (57.9s ...) outside of range for LONG tests`) into whichever change resolves the collection question, since the right size depends on what the target ends up collecting. ## AI assistance AI assistance (Claude Code) was used to research and draft this change. I reviewed every changed line and ran the verification commands above locally. Signed-off-by: Douglas Strodtman <[email protected]> Signed-off-by: 400Ping <[email protected]>
…documentation content in the docs-go scope guard (ray-project#65342) ## Why this change is needed `ci/lint/validate_docs_go_scope.sh` fails any pull request carrying the `docs-go` label if a changed file lives outside `doc/`. Two kinds of documentation work live outside `doc/` and are therefore locked out of the label today: - **Ray's Vale configuration** (`.vale.ini`, `.vale/`) sits at the repository root, so a PR that adds or edits a prose-lint rule can never carry the label even though it is documentation content by any reasonable reading. Concretely: ray-project#65239 adds KubeRay style rules and edits `doc/source/ray-contribute/writing-style.md`. Its [premerge build](https://buildkite.com/ray-project/premerge/builds/71732) has exactly one failing job, `lint: validate docs-go scope`. Every other check passes. - **The API-consistency checker's own source** (`ci/ray_ci/doc/`) is the tooling behind the `doc: check API doc consistency` step. Same shape: ray-project#65340 changes only that directory, and the label's guard is the sole red job on its [premerge build](https://buildkite.com/ray-project/premerge/builds/71727). In both cases the author's options today are to drop the label and wait on per-library example suites the PR cannot possibly affect, or to split a coherent change across two PRs. ## What changed Widen the guard's in-scope set from "under `doc/`" to "under `doc/`, the Vale prose-lint configuration (`.vale.ini`, `.vale/`), or the API-consistency checker (`ci/ray_ci/doc/`)". Both fail-closed paths (no merge-base, empty diff) are unchanged, and the `BUILD`-file exclusion now applies uniformly across the whole in-scope set rather than just `doc/`. Also updates the two places that state the predicate in prose, so they don't drift from the script: the `docs-go` section of `doc/source/ray-contribute/ci.md`, and `doc/.claude/CLAUDE.md`. ## Why this is safe The guard exists so `docs-go` can skip the 12 per-library docs example and llm test steps only on a PR that could not break them. The two additions clear that bar on different grounds, which is worth stating separately rather than blurring into one rule. **The Vale configuration** clears it on content: - **It defines no bazel target.** The separate `BUILD`-file exclusion is the mechanism that protects test targets, and it stays intact. - **It holds no executable Ray code**, so no doctest or example can change behavior because of it. - **The check that consumes it already runs unconditionally.** `lint: documentation_style` sits in the `lint-small-prose` matrix in `.buildkite/lint.rayci.yml` carrying `always`, which `always.rules.txt` emits for every changed file. Vale therefore runs on every pull request whether or not the label is present. - **No premerge step is traded away.** `test.rules.txt` already routes `.vale.ini` and `.vale/` to `doc` alone, in the rendering-and-validation-only block. That tag reaches `doc: build`, which carries `skip-on-premerge`. **The checker source** is executable CI code, so the reasoning above does not apply to it. It clears the bar on tag routing: - **`test.rules.txt` routes `ci/ray_ci/doc/` to `doc_api tools` and nothing else**, ahead of the broad `ci/ray_ci/` rule, and first match wins. - **Every step the label skips carries a library tag instead** — `core_python`, `data`, `llm`, `train`, `tune`, `rllib_directly`, `serve`, and the `*_doc` tags. A change confined to this directory never emits a tag that selects one of them. Since the label's `if:` can only suppress an already-emitted step, there is nothing for it to take away. - **Measured on the same commit, with and without the label.** ray-project#65340 was built twice: [71727](https://buildkite.com/ray-project/premerge/builds/71727) carried `["go", "docs-go"]` and [71736](https://buildkite.com/ray-project/premerge/builds/71736) carried `["go"]`. Both emitted the same 33 jobs, and diffing the two job-name sets yields no difference in either direction. The label's only effect on such a PR is whether this guard itself is emitted: it ran and failed in the first build, and was `broken` (never emitted) in the second. That is the claim above, observed rather than derived. - **The checks that do cover the directory are ungated.** The `doc_api` API checks and the `tools` job running this directory's six `ci_unit` py_test targets both run with the label present. Build 71727 is the direct evidence: it carried `docs-go` and ran `doc: check API annotations`, `doc: check API doc consistency`, and all six `//ci/ray_ci/doc:*` targets, all green. - **`BUILD` files stay excluded**, so a change to this directory's test targets still fails the guard. ray-project#65340 is exactly that case: it adds a `py_test` src, so it would still not qualify for the label after this change. That is the intended outcome. Each list is deliberately narrow. For Vale it covers the prose rules, not the CI wiring that runs them: `ci/lint/check-documentation-style.sh` and the Vale hook in `.pre-commit-config.yaml` stay out of scope, because a change to either one alters what actually runs. For the checker it covers `ci/ray_ci/doc/` only, not the shared `ci/ray_ci/` tooling that every bazel test step runs through. ## Two corrections on the same surface - **The script's header comment claimed the label skips the API consistency checks.** It doesn't. `doc.rayci.yml` leaves them deliberately ungated, precisely because an API reference page edit is the content-only change they must cover, and build 71727 confirms both ran under the label. `ci.md` already described this correctly, so only the script was wrong. - **The failure message advised an action that cannot work.** It said "Remove the 'docs-go' label so the appropriate tests run," but removing the label cannot produce a corrected build on the same commit. A Buildkite rebuild replays the label set from the build it was rebuilt from, and the pipeline sets `skip_pull_request_builds_for_existing_commits`, so the `unlabeled` event on an already-built commit produces no build at all. Verified on ray-project#65340: `docs-go` was removed at 19:59:30Z, build 71727 was created at 20:00:03Z as a UI rebuild, and its payload still carried `["go", "docs-go"]`. The message and both prose surfaces now say to remove the label *and push a new commit*. ## Checks - [x] I've signed off every commit (`git commit --signoff`). - [x] I've made sure the tests are passing. - Testing Strategy - [x] Manual tests `shellcheck` is clean. The guard was exercised end to end against a controlled base in a scratch repository, 15 cases — the 7 from the Vale-only version, unchanged, plus 8 for the new path: | Changed files | Expected | Result | | --- | --- | --- | | `.vale.ini` + `.vale/styles/**` + a `doc/` page (the ray-project#65239 shape) | pass | pass | | `.vale/styles/**` alone | pass | pass | | a `doc/` page alone (behavior before this change) | pass | pass | | `.vale/styles/**` + a file under `python/ray/` | fail | fail, names the Python file | | `.vale/BUILD.bazel` | fail | fail, names it as a `BUILD` file | | `ci/lint/check-documentation-style.sh` | fail | fail | | `.pre-commit-config.yaml` | fail | fail | | `ci/ray_ci/doc/api.py` alone | pass | pass | | `ci/ray_ci/doc/api.py` + a `doc/` page | pass | pass | | `ci/ray_ci/doc/mock/_internal/__init__.py` | pass | pass | | `ci/ray_ci/doc/BUILD.bazel` (the ray-project#65340 shape) | fail | fail, names it as a `BUILD` file | | `ci/ray_ci/doc/api.py` + a file under `python/ray/` | fail | fail, names the Python file | | `ci/ray_ci/tester.py` (shared tooling, not the checker) | fail | fail | | `ci/ray_ci/docker/**` (sibling path) | fail | fail | | `doc/BUILD.bazel` | fail | fail, unchanged behavior | Note that this PR itself edits `ci/lint/`, so it deliberately does not carry the `docs-go` label. The label's effect on ray-project#65239 is the real confirmation, and I'll rebase that PR onto this once it lands. ## Related ray-project#64775 reserved the `doc` tag for documentation validation. The `docs-go` label and this guard arrived with the content-only escape hatch that followed. ray-project#65340 is the checker-source change that motivated the second path. --------- Signed-off-by: Douglas Strodtman <[email protected]> Signed-off-by: 400Ping <[email protected]>
…ect#64413) ## Why are these changes needed? The YAML under `doc/redirects/` is the source of truth for the docs.ray.io Read the Docs redirect configuration, managed with [rtd-redirects](https://github.com/anyscale/rtd-redirects). Today a PR that edits only redirect YAML runs no check at all, so a malformed or unreachable redirect can merge unnoticed. Nothing routes redirect YAML anywhere. `.yaml` isn't covered by the leading prose-and-image skip rule, nor by the `doc/*.py`/`doc/*.ipynb`/`doc/*/BUILD.bazel` catch-all, so it falls through to the broad `doc/` pass rule at the bottom of the doc section and emits no tag at all. Confirmed against the rule engine on master: `doc/redirects/current.yaml` emits `set()`. This adds a lightweight, credential-free premerge gate for `doc/redirects/*.yaml` that validates the redirects and prints the redirect-level diff. The change is purely additive: it gives redirect YAML a check where it previously had none, and no other path's selection changes. ## What changed - **`.buildkite/test.rules.txt`** — declare a `doc_redirects` test tag and route `doc/redirects/*.yaml` to it. The rule sits ahead of every `doc/` rule, which matters because the final `doc/` pass rule is what currently swallows these files. The rule emits `doc_redirects` alone, deliberately not `doc` or `doc_api`. A redirect edit can't change the documented API surface, and the check needs neither a rendered documentation build nor a compiled Ray: it parses the YAML and diffs it against the base ref. - **`.buildkite/test.rules.txt`** — route `.buildkite/doc.rayci.yml` to `doc_redirects` as well, on its own rule rather than by extending the autodoc-machinery block, so a `conf.py` edit doesn't start running the redirect check. An edit to a step definition has to be able to select the step it edits, which is the same reason that file already emits `doc_api`. This also covers the `anyscale-rtd-redirects` version pin, which lives in the redirect step's commands, so a version bump re-runs the check. - **`.buildkite/test.rules.test.txt`** — three cases: `doc/redirects/current.yaml: doc_redirects`, `doc/redirects/README.md:` asserting the prose beside it stays unrouted, and `.buildkite/doc.rayci.yml: doc doc_api doc_redirects`. The last one revises an assertion that already existed on master, since that file's tag set genuinely changes here. - **`.buildkite/doc.rayci.yml`** — add a `forge`-based step (no doc image) that installs the pinned `anyscale-rtd-redirects==0.2.0` from PyPI and runs: ``` rtd-redirects validate doc/redirects/current.yaml rtd-redirects diff-file --file doc/redirects/current.yaml --base FETCH_HEAD --head HEAD --repo . ``` The step diffs against `FETCH_HEAD` after fetching the PR's base branch, rather than against `origin/<base>`: a clone with a restricted refspec may never create a local remote-tracking ref, and `doc/test_no_new_rst.py` already solves the same problem the same way. The base branch resolves at runtime from `$${BUILDKITE_PULL_REQUEST_BASE_BRANCH:-master}`, escaped so the shell expands it rather than Buildkite interpolating it at pipeline-upload time, matching the `$${...}` convention used across the other pipeline files. The step also fails closed if `doc/redirects/` grows a YAML file the commands don't name. The tag selects on a glob, but multiple redirect files compose in the order given and a shell glob can't express that order, so the guard forces the compose-order decision to be made explicitly instead of letting a new file select the step and then go unvalidated. ## Verification Verified with Ray's rule parser (`ci/pipeline/determine_tests_to_run.py`), the same first-match-wins engine rayci uses: - `check_rules()` parses clean, and all 126 cases in `test.rules.test.txt` replay green. That file is enforced by the `test-rules` CI step, and rayci asserts exact set equality, so a passing case proves the path emits exactly those tags and nothing else. - A sweep of all 10,333 tracked files against master shows **exactly two deltas** — `doc/redirects/current.yaml` gaining `doc_redirects`, and `.buildkite/doc.rayci.yml` gaining it alongside its existing `doc doc_api` — and **zero tag losses** on any path. Every pre-existing assertion in `test.rules.test.txt` is preserved except the `doc.rayci.yml` one this PR deliberately revises. - Ran the step's commands locally in a clean venv with `anyscale-rtd-redirects==0.2.0` against the current `doc/redirects/current.yaml`: `validate` reports 0 errors (49 chain warnings, informational), and `diff-file --base FETCH_HEAD` reports the redirect-level diff and exits 0 with no Read the Docs credentials. - Exercised the drift guard both ways: it passes with only `current.yaml` present and exits non-zero when a second `doc/redirects/*.yaml` appears. Because `.buildkite/doc.rayci.yml` now emits `doc_redirects`, **this PR selects the new step and runs it**. Replaying this PR's own changed files through the rule engine gives a tag union of `doc`, `doc_api`, `doc_redirects`, and `tools`, so the step's commands are exercised in CI here rather than only on some later PR that happens to edit redirect YAML. It runs against an unchanged `current.yaml`, so `diff-file` reports an empty redirect diff and exits 0, which is exactly the smoke test that catches a typo in the step definition. ## Update: rebased onto the doc-tag reorg Rebased after ray-project#64775 and ray-project#64812 landed, which reorganized the doc tags: doc example tests moved to per-library `<lib>_doc` tags, and `doc` was split so the autodoc machinery emits `doc doc_api` while the rendering-only surface emits `doc`. This branch's four commits (one an upstream merge) are collapsed into one. Two conflicts in `test.rules.txt` (the tag declaration line, and the rule insertion point) and one in `test.rules.test.txt` (three expectations the reorg had since updated) were resolved in favor of master, then the `doc_redirects` rule and cases re-applied on top. The rebase also invalidated this PR's original rationale, so the rule and step comments have been rewritten. The earlier framing was that `doc_redirects` keeps redirect YAML from pulling in docbuild, the API checks, and the per-team doc tests. That's no longer accurate on any of the three: the per-team tests are selected by `<lib>_doc`, the two API checks carry `doc_api` plus the library tags and no longer carry bare `doc`, and the only remaining step carrying bare `doc` is `doc: build`, which is `skip-on-premerge`. Since redirect YAML emits nothing at all on master, this rule was never preventing over-triggering. It's additive, and the comments now say so. ## Update: the step now selects itself Cursor Bugbot caught that the redirect step wasn't reachable from an edit to its own definition: `.buildkite/doc.rayci.yml` emitted `doc doc_api` but never `doc_redirects`, so changing the redirect step's commands wouldn't have run the redirect step. That contradicted the rule's own stated reason for emitting `doc_api`, and this PR demonstrated the gap: its previous revision noted that the new step didn't execute here. Fixed by giving `.buildkite/doc.rayci.yml` its own rule emitting `doc doc_api doc_redirects`. It's a separate rule rather than an extra tag on the autodoc-machinery block, because that block also covers `conf.py`, `api_autogen.py`, and `doc/source/_ext/`, and a `conf.py` edit has no business running the redirect check. The first attempt at this appended the tag to the shared block and the full-repo sweep caught it immediately: seven machinery files picked up `doc_redirects`. AI assistance (Claude Code) was used to draft the CI step, the rebase conflict resolution, and this description. Every changed line was reviewed by hand, and the verification above was run as described. This isn't duplicating existing work: no other open PR adds redirect validation to premerge, and the `doc_redirects` tag doesn't exist on master. ## Update: uv, and a recursive fail-closed guard Two review follow-ups. **Install with `uv`** (Elliot's suggestion). `ci/docker/forge.Dockerfile` already installs uv to `/usr/local/bin` and uses it for the image's Python, so the step needs no extra setup. It's `uv tool install` rather than `uv pip install --system` for a PATH reason: the previous revision's premerge log shows `pip install` fell back to a user install, so the `rtd-redirects` entry point resolved from `~/.local/bin`. `uv tool install` writes executables to that same directory, so PATH resolution is unchanged. `uv pip install --system` would target the uv-managed interpreter and put the entry point in that env's `bin`, which isn't on PATH. **The fail-closed guard now recurses.** Cursor Bugbot caught that the guard's single-level shell glob didn't cover a nested redirect file, and it was right. The rule engine matches with `fnmatch`, whose `*` crosses `/`, so `doc/redirects/nested/foo.yaml` emits `doc_redirects` and selects this step, while `ls doc/redirects/*.yaml` never saw it and the guard passed. Replacing the glob with `find` closes the gap. Exercised three ways locally: passes with only `current.yaml`, exits non-zero for a nested file and for a sibling file. A `.yml` file stays out of scope. The tag rule matches `*.yaml` only, so `doc/redirects/current.yml` emits no tags and never selects the step, putting it beyond the guard's reach. That matches the pre-PR baseline for every redirect file rather than regressing anything, and `rtd-redirects` uses `.yaml`. Re-verified after the change: rules parse clean and all 126 cases in `test.rules.test.txt` replay green (the rule files are untouched by this revision). ## Related issue number N/A ## Checks - [x] I've signed off every commit (`-s`), because all commits are squashed into one when merged. - [x] I've run `scripts/format.sh` to lint the changes in this PR. (Via `pre-commit`; the applicable hooks pass.) - [x] I've made sure the tests are passing. - Testing Strategy - [x] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: Douglas Strodtman <[email protected]> Signed-off-by: 400Ping <[email protected]>
…per library (ray-project#64775) ## Reviewer summary **What this does.** The per-team `X: doc tests` steps are library example and doctest suites that live under `doc/`. They exercise library code, not documentation quality. Today every executable doc asset emits the blanket `doc` tag and all six teams' steps are tagged `doc`, so a one-library doc change starts every team's step. This gives each step a dedicated `<lib>_doc` tag, routes `doc/source/<lib>/**` to the owning library's tag, renames the steps to `X: docs example tests`, and leaves `doc` for documentation validation (the build and the Vale/config infra). The library tag stays on each step, so a library **code** change runs its doc example tests exactly as before. **What's verified.** | Claim | Evidence | |---|---| | Each path emits exactly the intended tag, and no other | `test-rules` green on this PR. That's the pinned `rayci` binary replaying all 103 `test.rules.test.txt` assertions (up from 57 on master) with **exact set equality**, so each case also proves the blanket `doc` tag does *not* come along. | | The emitted tags resolve to the intended steps, and only those | Generated the real pipeline locally with the pinned `rayci v0.46.0` release binary for a one-file Serve doc-example change, before and after this branch. Output below. | | The renamed steps still run and pass | All five plus the GPU and dask siblings green on this PR, selected via the library tags this change preserves. | | Every executable target under `doc/` routes to a step that can actually select it | Swept all 948 (file, target) claims against the per-team `team:` / `--only-tags` / `--except-tags` filters. One deliberate exception (`doc/test_myst_doc.py`, below) and two pre-existing gaps that this change doesn't create. | | The rename doesn't reset step identity | rayci derives step IDs positionally (`fmt.Sprintf("g%d_s%d", i, j)`, `converter.go`), not from the label. The generated pipelines confirm it: `g16_s12`, `g16_s21`, `g6_s22`, `g13_s26` are identical before and after. | **What I need from a reviewer.** 1. **One question I can't answer from inside the repo.** `ci/build/get_build_info.py` sets `config.env` to `"Buildkite " + BUILDKITE_LABEL`, and `ci/build/upload_build_info.sh` uploads it on postmerge pipelines on `master` only. Does anything downstream of that `metadata.json` treat `config.env` as an identity or grouping key? If it's descriptive, renaming five steps is free. If something groups on it, those five steps' postmerge history splits at the merge commit. Flaky-test selection and target selection both key on `team` (unchanged here) and test identity is the bazel target name (`f"{system}:{name}"` in `release/ray_release/test.py`), so I believe `config.env` is the only place the label escapes. 1. **Confirm the API-check behavior change below is acceptable.** 1. **Confirm the catch-all owner.** Executable doc assets in directories with no per-team step route to the core step: roughly 25 files, being 18 `doc/source/templates/*/start.ipynb` plus a handful under `doc/source/cluster/doc_code/`, `doc/source/ray-contribute/doc_code/`, and `doc/source/_templates/`. The templates majority may be retired or externally managed, in which case a skip rule is the better answer than core ownership. **Known behavior change worth your eyes.** Because `doc/source/<lib>/doc_code/` and `examples/` now emit `<lib>_doc` instead of `doc`, the two API-surface checks (`doc: check API annotations`, `doc: check API doc consistency`) stop running on library doc-example changes. They carry the blanket `doc` tag among their library tags, so today a `doc_code` edit incidentally triggers a premerge `make -C doc/ html`. I think that's correct: those checks guard the documented public API surface, which a doc example can't change, and the example itself is still executed by the owning library's step while the render is gated by Read the Docs. But it is a premerge signal that disappears, so it should be a decision rather than a side effect. Raised on ray-project#64812, which routes the API **reference** pages to a dedicated `doc_api` tag for the related case. **Out of scope, tracked separately.** `.buildkite/others.rayci.yml:13` declares a sixth step labeled `doc tests`, running `//python/ray/... //doc/... none --only-tags doctest` and tagged `python`, a tag no rule in `test.rules.txt` emits. Generating the full-fan-out pipeline shows it does get emitted (`doc tests [g14_s1]`), so it is live. After this rename it becomes the only step in the repo still called "doc tests." This PR doesn't touch `others.rayci.yml` and the fix is independent. --- ## What this changes 1. **Dedicated per-library tag.** Each step gets a `<lib>_doc` tag (`core_doc`, `data_doc`, `ml_doc`, `rllib_doc`, `serve_doc`) and drops the blanket `doc` tag. The library tag stays. 1. **Path routing.** `test.rules.txt` routes `doc/source/<lib>/**` to that library's tag, so a doc change runs only the owning library's example tests. LLM doc assets already route to `llm` and keep doing so. 1. **`doc` reserved for validation.** It now stays only on the documentation build and the Vale/config infra. 1. **Rename** to `X: docs example tests`, since a failure in these steps means library code or an example broke, not that the docs are wrong. 1. **Build-file rule fix.** `test.rules.txt` matched `doc/BUILD` and `doc/*/BUILD`, but the files are `BUILD.bazel`, so editing a file that *defines* the doc test targets ran no doc tests premerge. It now matches the `.bazel` files and routes them to the same per-library steps. The root `doc/BUILD.bazel` defines every library's targets, so it routes to all of them. ### Scoping exceptions, and why each exists Several paths sit under a library doc directory but can't be meaningfully tested by that library's example step, so they're routed explicitly rather than by directory: - **Static images skip entirely.** Image extensions sit on the leading skip rule, ahead of the per-library rules, so a `.png` or `.svg` edit triggers nothing. 310 tracked image files. `.yaml` and `.sh` stay routed, since unlike an image they can change what a test does. - **Sphinx build machinery routes to `doc`.** `conf.py` imports `custom_directives`, `api_autogen`, `api_mock_imports`, and `template_collections`; none was listed in the validation-infra rule, so all fell to the `doc/*.py` catch-all and emitted `core_doc`, running Ray Core's doctests for a docs-build-machinery edit. Those four plus `preprocess_github_markdown` and the doc-root build helpers now route to `doc`. They're enumerated one per line on purpose: `*` is fnmatch here and crosses `/`, so a `doc/source/*.py` pattern would also swallow every example script under `doc/source/<lib>/doc_code/`. There's a comment on the rule saying so. - **Gallery configs route to `doc`.** `doc/source/{data,serve,train}/examples.yml` are parsed by `custom_directives.py` (`EXAMPLE_GALLERY_CONFIGS`) to generate the gallery pages. They hold no executable code and can't change what any example does. Narrowed to a three-path exception rather than a blanket `.yml` skip, because a sibling `.yml` under a library doc directory can be a config an example consumes. - **`doc/.claude/` triggers nothing.** Agent files never participate in the Sphinx build and define no test targets, but `doc/.claude/skills/sphinx-fix/sphinx_fix.py` matched the `doc/*.py` catch-all. The Read the Docs build guard already excludes this exact path for the same reason, so the two guards now agree. Pre-existing rather than a regression from this PR: on master the file emits the blanket `doc` tag, which reaches all five per-team steps. - **Four `team:ml` notebooks under `ray-core/` route to `ml_doc`.** `plot_hyperparameter`, `batch_prediction`, `plot_parameter_server`, and `plot_pong_example` live under `doc/source/ray-core/examples/` but their targets are tagged `team:ml`, and the team argument to `//ci/ray_ci:test_in_docker` filters targets by `team:<team>` (`_get_all_test_query`, `ci/ray_ci/tester.py`). Routing them to `core_doc` would run a step that tests everything under `ray-core/` except the file that changed. Re-tagging the four `team:core` in `doc/BUILD.bazel` is the alternative fix and would let the rule lines go away. - **`highly_parallel.ipynb` routes to `doc`.** Its `py_test` carries a `highly_parallel` tag that the ml docs example step excludes, and the notebook glob in `doc/source/ray-core/examples/BUILD.bazel` excludes it too, as a release test needing a live multi-node cluster. The remaining ml `//doc/...` steps select `gpu` / `train_v2_gpu` and the target has neither, so no premerge step executes it. Routing to `doc` means the build renders it (`nb_execution_mode` defaults to `off`, so render-and-lint only), which is the only validation premerge offers here. - **`doc/external/` routes to `ml_doc`.** Its `test_external_hashes` target is tagged `team:ml`; it had fallen through the `doc/*.py` catch-all to `core_doc`, where the core step's `team:core` query never sees it. - **The `llms.txt` files route to `doc`.** ray-project#64458 adds `doc/test_llms_txt.py` and `doc/source/llms_txt_summary.txt` with no `test.rules.txt` change. Left alone the test would land on the `doc/*.py` catch-all and emit `core_doc`, running Ray Core's doctests for a test its own docstring describes as hermetic, while never running the step that executes it. Rules for absent paths are inert, so there's no ordering dependency: this PR doesn't touch `doc.rayci.yml`, ray-project#64458 doesn't touch `test.rules.txt`, and whichever lands first the other merges correctly scoped. - **Declined:** fanning `doc/test_myst_doc.py` out to all five `<lib>_doc` tags. It backs 19 targets across every team, but it's shared infrastructure, so a break surfaces in core as readily as anywhere. One library's worth of execution is a sufficient smoke signal and the post-merge build covers the rest. The rule carries a comment recording that trade and when to revisit it. ### Effect on a doc-only PR (no `docs-go`) | Change | Before | After | |---|---|---| | A Serve doc example | every team's `doc tests` step | `serve: docs example tests` and its GPU sibling | | A Data doc example | every team's `doc tests` step | `data: docs example tests`, plus the dask and GPU siblings | | An image under a library doc dir | that library's example step | nothing | | A Sphinx build module (`custom_directives.py` etc.) | `core: docs example tests` | `doc: build` only (post-merge) | | A gallery config (`examples.yml`) | that library's example step | `doc: build` only (post-merge) | | Editing `doc/BUILD.bazel` | nothing (rule was dead) | the doc example steps it defines | | The two `doc: check API*` checks | ran, via the blanket `doc` tag | don't run (see reviewer summary) | The GPU and dask siblings carry `<lib>_doc` too, and tag matching is a non-empty intersection, so they're selected alongside the main step. That's unchanged behavior: they carried the blanket `doc` tag before, so a doc change already started them. No new GPU cost. ## Verification **Rule conformance, under the authoritative evaluator.** `test-rules` is green on this PR. It replays all 103 `test.rules.test.txt` assertions through the pinned `rayci` binary, and `runTestRules` compares the full computed tag set per path, so every case is also a negative assertion that no other tag fires. **Tag-to-step resolution, generated locally.** The tag set isn't the step set: rayci filters steps by tag, then `markDeps` pulls in everything reachable through `depends_on` regardless of that step's own tags. To confirm the composition rather than infer it, I ran the pinned `rayci v0.46.0` release binary against a one-file Serve doc-example change, on master and on this branch: ``` before (base=master) changed files: [doc/source/serve/doc_code/app_builder.py] selected tags: always doc lint doc-related steps emitted: core: doc tests [g6_s22] ml: doc tests [g13_s26] data: doc tests [g7_s21] rllib: doc tests [g15_s8] data: dask doc tests [g7_s22] serve: doc tests [g16_s12] data: doc gpu tests [g7_s23] serve: doc gpu tests [g16_s21] doc: check API annotations [g9_s3] doc: check API doc consistency [g9_s4] after (this branch) changed files: [doc/source/serve/doc_code/app_builder.py] selected tags: always lint serve_doc doc-related steps emitted: serve: docs example tests [g16_s12] serve: docs example gpu tests [g16_s21] ``` Six teams' example steps collapse to the owning team's two, and the step IDs are unchanged across the rename. **Routing versus coverage.** Correct routing isn't sufficient: the step that starts still has to select the target. `ci/ray_ci/tester.py` filters by `attr(tags, 'team:<team>')`, then intersects `--only-tags` and subtracts `--except-tags`, so a change can route perfectly, start the right-looking step, and be invisible to every command in it. I swept all 948 (file, target) claims under `doc/` against the per-team filters. After the exceptions above, the only deliberate team mismatch left is `doc/test_myst_doc.py`. Two pre-existing gaps fell out, neither created by this change: - **GPU-tagged ml and core doc examples have no owning step** — six `team:ml` notebooks tagged `gpu`, five `team:core` `doc_code` modules tagged `multi_gpu`, and one `post_wheel_build` module. `data` and `serve` each have a GPU doc-example step; ml and core never got one, so the only steps that would run these are gated on `train_gpu` and `cgraphs_direct_transport`, which no doc path emits. No `doc`-tagged step ran them before the split either. This needs a REEf and library-team decision rather than a rules change. - **Prose doctests aren't triggered by prose edits.** The `doc/BUILD.bazel` `doctest` targets over `doc/source/**/*.{md,rst}` are reachable only from the `others.rayci.yml` step gated on `python`, while prose paths hit the leading skip rule. Roughly 700 files. I consider this correct as-is: given current coverage the Read the Docs render build is the gate a prose change needs. **Also swept** all 1,628 tracked `doc/` files against the previous rules to confirm exactly which paths changed routing and that nothing else moved. ## Change log Consolidated above; kept here so the review history stays legible. - `6a1310d3b5` — the split: per-library tags, path routing, rename, `BUILD.bazel` rule fix. - `c6302c8a21`, `b1d03629cf` — first bot-review pass: static images skip; Sphinx build modules route to `doc`. - `99c3af2c28` — pre-route the `llms.txt` extension test and summary ahead of ray-project#64458. - `3795c6161b` — skip `doc/.claude/`; route the `team:ml` `ray-core` notebooks to `ml_doc`. - `e88e8a4b52` — remove a stray `TEMP(do-not-merge)` marker that reached master with ray-project#65040. Inert, and independent of this PR's thesis; happy to split it out. - `f8347baf54` — second bot-review pass: gallery configs to `doc`; correct `highly_parallel.ipynb` to `doc`. - `6a050a0511` — route `doc/external/` to `ml_doc` so the hash guard still runs. ## AI assistance This change was drafted with AI assistance (Claude Code) and reviewed by me. --------- Signed-off-by: Douglas Strodtman <[email protected]>
…ce checks (ray-project#64812) ## The problem Two premerge checks in `.buildkite/doc.rayci.yml` cross-check every `@PublicAPI` symbol against the autosummary pages that document it: - `doc: check API annotations` - `doc: check API doc consistency` They currently run on the wrong set of changes, in both directions. **They miss changes they should catch.** API reference pages are `.rst` and `.md`, so the leading prose-and-image skip rule in `test.rules.txt` matches them first. Editing `doc/source/data/api/api.rst` changes the documented public API surface and triggers **no premerge step at all**. **They run on changes that can't affect the API surface.** Both steps carry the blanket `doc` tag. Since ray-project#64775 reserved `doc` for documentation validation, that tag now covers two unlike things: the autodoc machinery that decides what the API reference *contains*, and rendering config that can't change it. So a Vale vocabulary tweak pays for a `docbuild` plus both checks. ## The fix Add a `doc_api` tag, and route to it everything that can change the documented API surface or how it's computed. Then take the blanket `doc` tag off the two steps. | A change to | today | with this PR | |---|---|---| | An API reference page | **skip** | run | | The checker's own source (`ci/ray_ci/doc/`) | **skip** | run | | `conf.py`, `api_autogen.py`, `api_mock_imports.py`, `_ext/` | run | run | | Docs dependency locks (`deplocks/docs/*.lock`) | run | run | | Library Python source | run | run | | `.vale.ini`, Vale vocabularies | run | **skip** | | `rtd_doctor.py`, `template_collections.py` | run | **skip** | | `.readthedocs.yaml`, gallery configs | run | **skip** | | Narrative prose, images | skip | skip | ## What's in the diff Three commits, 7 files. 1. **`a0b545cc3e`** declares `doc_api` and routes the six per-team API reference directories to it, ahead of the skip rule. Also splits the doc-build infra block in two: the autodoc machinery emits `doc doc_api`, the rendering-only half emits `doc` alone. Then drops the bare `doc` tag from both check steps. 2. **`e0d520381d`** adds two drift guards in `//ci/pipeline:test_doc_api_rules_sync`. Both `doc_api` lists are hand-maintained and fail *silently* when they drift — a missing entry means those paths quietly stop being checked. One guard keeps the page list aligned with `API_PATH_PREFIXES` in `doc/source/_ext/api_sidebar.py`. The other requires every local module `conf.py` imports to be routed to `doc_api` or named as an explicit rendering-only exception. 3. **`f3db137384`** routes `api_sidebar.py` to `tools` as well, so the first guard actually runs. It was one-directional before: `test.rules.txt` emits `tools`, so the guard fired on a rules-side edit, but `api_sidebar.py` didn't, so growing `API_PATH_PREFIXES` without the matching rule never executed it — the likelier mistake, and exactly the drift the guard exists to catch. Also removes four duplicated assertions. Three details worth knowing, since each looks like an oversight otherwise: - **`ci/ray_ci/doc/` keeps `tools` alongside `doc_api`.** It declares six `ci_unit` `py_test` targets and `tools` is what selects the job that runs them, so dropping it would mean editing the checker never runs the checker's own unit tests. - **`doc.rayci.yml` also emits `doc_api`,** so editing a check's step definition exercises the check it defines. - **`doc/source/ray-observability/reference/` is routed even though it sits outside `doc/source/*/api/`.** Ray Core's `api/index.rst` toctrees into its `api.rst`, so it's part of the Core API-surface walk. ## Testing `test.rules.test.txt` gains cases for the API pages (including a nested leaf page, to pin recursive directory matching), the checker source, each machinery path, and negative cases asserting the rendering half still emits `doc` alone. **These are the real gate:** the `test-rules` step runs them through rayci's parser as exact set equality, so a passing case proves a path emits precisely those tags and nothing else. Locally, against the in-repo reference engine (`ci/pipeline/determine_tests_to_run.py`): - `check_rules()` passes; **115 of 115** replay cases pass. - Across all 10,213 tracked files the routing change is **purely additive: 95 files gain tags, none lose any.** - No executable asset (`.py`, `.ipynb`) lives under the routed API directories, so no library docs-example step loses coverage. ``` python -m pytest ci/pipeline/test_doc_api_rules_sync.py ``` ## Two notes for reviewers **One behavior change to sanity-check.** Neither check carries an `if:` guard now, including the `docs-go` one they had before. A content-only PR labeled `docs-go` that touches an API reference page will run both checks plus their `docbuild` dependency, where it previously skipped them. That's intended — `docs-go` exists to skip per-team doc *example execution*, and an API reference edit is exactly the content-only change these checks must still cover — but it's a real cost change for that workflow. `docs-go` keeps its role everywhere else: 12 per-team doc example steps across `core`, `data`, `llm`, `ml`, `rllib`, `serve`, and `linux_aarch64`, plus the `lint: validate docs-go scope` step that enforces the label is only used on doc-only PRs. **This PR changed shape, so earlier comments describe an older design.** It began as a `docs-api-go` PR label that would re-enable the checks on a `docs-go` PR. That's removed: tag selection and Buildkite `if:` are separate passes, and `if:` can only suppress a step the tags already emitted, so with the routing correct the label could only ever subtract. Dropping the `if:` achieves the same thing with no label to create or remember. Consequently the earlier Gemini review and the 2026-08-04 comment above both reference a `docs-api-go` label that no longer exists. Everything else in that comment still stands, including its decision that `doc_code/` and `examples/` should *not* grow into `doc_api`. 🤖 Written with assistance from Claude Code. --------- Signed-off-by: Douglas Strodtman <[email protected]>
…cipe (ray-project#65285) ## Why this change `doc/source/ray-contribute/ci.md` explains what CI runs on a PR, but stops at `microcheck` and the `go` label. It says nothing about what runs when the PR changes documentation, which is the case the page's likely reader is in. This adds that, and folds in a recipe for reproducing the API consistency check locally. ### What's new **"Documentation CI checks"** covers, in the order a contributor meets them: - The Read the Docs render gate, including that `fail_on_warning: true` makes any Sphinx warning a build failure, and when the preview build skips. - The two API surface checks, and the `doc_api` tag that lets an API reference page edit reach them even though it's a documentation change. - The per-library `<library>: docs example tests` steps, with a table mapping path to step to tag, plus the Ray Core fallback and the Ray LLM exception. - That a prose-only or image-only change runs no library test steps at all. - The `docs-go` label and the `lint: validate docs-go scope` guard that bounds it. - The two post-merge-only steps, `doc: build` and `doc: linkcheck`. **"Running the API consistency check locally"** documents the three phases of `api_policy_check`, what the `docbuild` image does and doesn't install (the deep-learning backends are mocked even in CI), and a `uv` recipe that gets close enough for iteration. It also updates one example commit message under the `microcheck` section that named the old `serve doc tests` step label. **`doc/.claude/CLAUDE.md`** carried the same staleness, so it's fixed in the same PR. It still said the `doc` tag "covers content under `doc/`", which stopped being true when ray-project#64775 landed. It now describes the three-way split (`doc` for build and validation infra, `<lib>_doc` for executable doc assets, `doc_api` for the API reference surface), records that prose and images trigger nothing, and documents the `docs-go` label and its scope guard. Two smaller drifts are corrected alongside: the docs deplock rule emits `doc_api` now too, and the "tag it `doc`" advice pointed at a tag that no longer selects content steps. This file is an agent instruction file rather than published documentation, so it's worth saying why it rides along here instead of going out separately. `AGENTS.md` requires a dedicated PR for changes to itself, which this isn't. `doc/.claude/` is on the skip rule in `test.rules.txt` and excluded from the Read the Docs build guard, so including it changes this PR's trigger set by nothing. And it's the same factual correction as the page, from the same source reading — splitting them would mean verifying the same CI configuration twice and risking the two descriptions drifting apart again. ## Not a duplicate This supersedes two of my own open PRs and replaces both: - ray-project#64842 added a documentation CI overview. It was written before ray-project#64775 landed and describes the pre-rework model, where a single `doc` tag selected the per-team doc test steps. That's no longer how routing works, so landing it as-is would have documented the wrong thing. - ray-project#64450 added the local API-check section. Its content is carried over here essentially unchanged. Both branched from the same pre-ray-project#64775 commit and added an identically titled section, so they also conflicted with each other. Combining them is cheaper to review than rebasing two PRs that overlap. I'm not aware of another open PR touching this page. Checked with `gh pr list --repo ray-project/ray --state open --search "ray-contribute ci.md"`. ## Verification Every factual claim was checked against `master` at `695a8814ea` rather than carried over from the superseded PRs: - Step labels, tags, and `if:` guards read from `.buildkite/doc.rayci.yml`, `core.rayci.yml`, `data.rayci.yml`, `ml.rayci.yml`, `rllib.rayci.yml`, `serve.rayci.yml`, and `lint.rayci.yml`. - Path-to-tag routing read from `.buildkite/test.rules.txt`. - The render gate behavior read from `.readthedocs.yaml` (`fail_on_warning: true`, the `post_checkout` skip guard) and `doc/Makefile`. - The mocked-backend claim checked against `ci/docker/doc.build.Dockerfile`, which stages the `ray-core` and `ray-dashboard` artifacts and installs only the docs lock, and `doc/source/api_mock_imports.py`, which lists `torch`, `transformers`, and `tensorflow`. This corrects ray-project#64842, which claimed the base images supply those libraries for real. - `doc: build`'s upload behavior read from `ci/ray_ci/doc/cmd_build.py` (postmerge, `master` only). - The `docs/readthedocs.com:anyscale-ray` check name confirmed from the status checks on an open PR. Commands run: ``` vale --config=.vale.ini doc/source/ray-contribute/ci.md python doc/test_no_new_rst.py pre-commit run --files doc/source/ray-contribute/ci.md ``` `test_no_new_rst.py` passes. `pre-commit` reports no applicable hooks for a Markdown file under `doc/source/`. Vale surfaces no new findings in the added text beyond spelling hits on project vocabulary (`Buildkite`, `premerge`, `docbuild`, `autodoc`, `autosummary`, `toctree`); note that CI's `documentation_style` lint scopes Vale to `doc/source/data` and `doc/source/ray-overview/examples`, so this page isn't in its path set. The same source reading backs the `doc/.claude/CLAUDE.md` edit; it asserts nothing the page doesn't. Rendering verified by parsing the page with `myst-parser` using the repo's `myst_heading_anchors = 4`: the table, the `{warning}` directive, and the heading hierarchy all parse, with no skipped heading levels. Both cross-references (`writing-code-snippets.md`, `docs.md#building-the-ray-documentation`) point at existing `.md` sources and an existing heading. The Read the Docs preview on this PR is the real render check. ## AI assistance AI assistance (Claude Code) was used to draft this change and to cross-check the claims against the CI configuration. I've reviewed every line. --------- Signed-off-by: Douglas Strodtman <[email protected]>
…ep (ray-project#65289) ## Why this change The trailing catch-all in `.buildkite/test.rules.txt` routes any remaining `.py` or `.ipynb` under `doc/` to `core_doc`. For a few directories that starts Ray Core's docs example step for files the step cannot run, because no bazel target covers them: - `doc/BUILD.bazel` names `source/templates/` exactly once, and it's a doctest *exclusion*. - Nothing covers `doc/source/cluster/doc_code/`, `doc/source/ray-contribute/doc_code/`, or `doc/source/_templates/`. So the step spins up, runs Core's own targets, and never touches the file that changed. Cost without signal. This is a follow-on to ray-project#64775, which introduced the per-library `<lib>_doc` tags and left this population on the catch-all deliberately, pending a check of what was actually there. ## What it does Splits the population by what the documentation build actually reads. **Routed to `doc` (build and validation only).** Sources a rendered page pulls in with `literalinclude`. Nothing executes them, but Sphinx reads them, so a rename or delete breaks the including page and the build is the only premerge check that can catch it. Same reasoning ray-project#64775 applied to `highly_parallel.ipynb`. - `doc/source/cluster/doc_code/` — included by four `cluster/vms/user-guides/community/` pages - `doc/source/ray-contribute/doc_code/` — included 3x by `writing-code-snippets.md` - `doc/source/templates/05_dreambooth_finetuning/` — included ~12x by `train/examples/pytorch/dreambooth_finetuning.rst` **Skipped.** `exclude_patterns` in `doc/source/conf.py` drops `templates/*` from the build outright, so Sphinx never reads any of it. `01`–`03` have no reference anywhere in the repo; `04` is cited only as a GitHub URL from `train/deepspeed.rst`, `train/huggingface-accelerate.rst`, and the Train examples gallery, none of which a build step resolves. `_templates/template.ipynb` is boilerplate contributors copy, linked as a GitHub URL from `ray-contribute/docs.md`. - `doc/source/templates/` (01 through 04) - `doc/source/_templates/` Images and prose under the `doc`-routed directories are unaffected: the leading prose-and-image skip still matches them first, as everywhere else in the tree. The dreambooth page's `.. image::` targets therefore stay skipped, consistent with every other doc image. Widening that is a separate decision and belongs in that rule. ## Blast radius Dry-ran `ci/pipeline/determine_tests_to_run.py` over **all 10,255 tracked files**, before and after: - **33 paths change routing. All are under `doc/`. Zero outside.** - 14 move `core_doc` → `doc` (the `literalinclude` sources) - 11 move `core_doc` → nothing (templates 01–04, `_templates`) - 8 move nothing → `doc` (non-`.py` include inputs such as `slurm-basic.sh`, `ray-skein.yaml`, `dreambooth_run.sh`, which the catch-all's `.py`/`.ipynb` patterns never reached) Net: 25 files stop starting a docs example step that couldn't run them; 8 gain the documentation build, which is the cheap step and the one that can catch a broken include. These are directory rules, matching how `doc/external/` is handled. That means four non-included assets under `05` (its Dockerfile, two compute configs, `requirements.txt`) start the build too. Deliberate trade — enumerating individual include targets would rot the moment someone adds a `literalinclude`. ## Tests Added 8 cases to `.buildkite/test.rules.test.txt`, including two regression guards: that the leading prose-and-image skip still wins *inside* a `doc`-routed directory, and that `doc/test_myst_doc.py` stays on `core_doc` so the catch-all keeps working for its real purpose. ``` $ python ci/pipeline/determine_tests_to_run.py # replayed over every fixture case fixture cases: 124 evaluated: 124 mismatches: 0 ``` All 124 cases pass, the 116 pre-existing ones included. `pre-commit run --files .buildkite/test.rules.txt .buildkite/test.rules.test.txt` passes. The authoritative tag computation is the external `rayci` `test-rules` step, not this in-repo parser, so premerge on this PR is the real confirmation. ## Not a duplicate No open PR touches `.buildkite/test.rules.txt` (`gh pr list --search "test.rules.txt in:title,body"` returns four unrelated PRs). This continues ray-project#64775, which is merged. ## Follow-up, deliberately not in this PR `doc/source/templates/README.md` documents a contribution workflow that can't be followed: it points at `templates.yaml`, `testing/validate.py`, `testing/release/`, and `//doc:workspace_templates`, none of which exist. Templates `01`–`03` look like orphaned 2.6-era artifacts and are probably deletable, but `04` and `05` are not, since published pages link to or inline them. That's content cleanup with its own reviewers, and external links to those GitHub paths may exist, so it wants a maintainer's call separately. --- AI assistance was used to research and draft this change. Opening as a draft for my own review pass before requesting maintainer review. Signed-off-by: Douglas Strodtman <[email protected]>
…project#65333) ## Why this change `.buildkite/others.rayci.yml` has a step labeled `doc tests`, tagged `python`. **`python` is declared in no `.rules.txt` file and emitted by no rule.** It isn't in the tag-declaration block of `test.rules.txt` or `always.rules.txt`, and no rule emits it. In `raycicmd/step_filter.go`, `acceptTagHit` returns early only when `runAll` is set; the `noTagMeansAlways` escape doesn't apply because the step *does* carry a tag, so it falls through to `step.hasTagInMap(f.tags)` and misses. On non-pull-request builds `needRunAllTags` returns `["*"]`, `runAll` is set, and the step runs. So the step is postmerge-only, but by accident rather than by intent. Nothing in the file says so, and the behavior rests on a tag that reads like it means something. Confirmed against real builds: - Premerge [71703](https://buildkite.com/ray-project/premerge/builds/71703) — 231 jobs, the broadest recent build, with all five per-library docs example steps present. A job named `doc tests` is **absent**. - Postmerge [19099](https://buildkite.com/ray-project/postmerge/builds/19099) — 923 jobs. `doc tests [g14_s1]` is **present** and passed. It's also the last step in the repo still called `doc tests`, after ray-project#64775 renamed the per-library steps to `<library>: docs example tests`. `git grep 'label:.*doc test'` returned exactly this one line. That's a naming collision with five steps that do something else: those execute a library's documentation examples, while this one runs `//doc:doctest`, the catch-all doctest target for documentation prose that no library owns (tagged `team:none`). The per-library steps each filter on their own `team:<lib>`, so this is the only step that reaches it. ## What this changes Tags and label only. **No behavior change** — the step runs exactly where it ran before. - **`skip-on-premerge`** states the existing postmerge-only behavior explicitly, instead of leaving it to an unmatched tag. Matches `doc: build` and `doc: linkcheck` in `doc.rayci.yml`, and the postmerge-only minimal-tests step in `core.rayci.yml`, which uses the same pattern with a comment. - **`doc`** is the build-and-validation tag, which is what this step is. It does **not** re-enable the step on premerge: skip tags are rejected in the filter's first pass (`hit = !reject(step) && accept(step)`) before tag selection runs. That's why `doc: build` carries `doc`, a rule-emitted tag, and is still postmerge-only. - **`oss`** matches the sibling doc steps. - **`python`** is dropped. It stays on `core_minimal_tests_postmerge` in `core.rayci.yml`, where it's harmless because that step also carries real tags and an explicit `skip-on-premerge`. - The label becomes **`doc: doctest`**, after the target it runs, matching the `doc:` prefix the other doc steps use. Renaming is safe for microcheck step-id selection because ids are positional (`g<group>_s<step>`) and the step keeps its position in its group. Reordering would be the risky operation; this isn't one. ## Testing **Emitted-pipeline differential using the pinned rayci binary** (`v0.46.0`, from the repo's own `.rayciversion`), rather than inferring from tags. Probe path `.readthedocs.yaml`, chosen because it emits `doc` — the tag being added — so this is the case most likely to expose an accidental premerge trigger. Both runs report `selected tags: always doc lint` and emit the same 6 steps: ``` wanda: forge :test_tube: test-rules [g5_s0] :lint-roller: lint: {{matrix}} [g11_s0] :lint-roller: lint: {{matrix}} [g11_s1] :lint-roller: pre-commit pydoclint [g11_s2] :lint-roller: lint: validate docs-go scope [g11_s3] ``` Diffing the two full pipeline YAMLs, the only differences are the probe commit SHAs in `BUILDKITE_ARTIFACT_UPLOAD_DESTINATION`, which are an artifact of how the probe commit is generated. Everything else is byte-identical, and `doc: doctest` appears in neither pipeline. So with `doc` emitted, the step stays off premerge before and after. **Postmerge preservation.** `doc: build [g9_s2]` and `doc: linkcheck [g9_s5]` both carry `skip-on-premerge` and both appear on postmerge build 19099, so the added skip tag doesn't remove a step from postmerge. **Filter simulation** across four scenarios (prose-only premerge, broad code premerge, docs-infra premerge, and postmerge run-all): identical selection before and after in all four. **Lint.** `pre-commit run --files .buildkite/others.rayci.yml` passes. YAML parses, and the step's `depends_on`, `instance_type`, and commands are untouched. ## Not a duplicate `gh pr list --repo ray-project/ray --state open` searched for `others.rayci.yml`, `"doc tests"`, and `doctest` in title and body — no open PR touches this step or this file. ## Follow-ups deliberately not in this PR While measuring this step I found two things that are about the *target*, not its routing, so they need different reviewers and their own change: - **`//doc:doctest` currently collects zero doctests.** Of the 204 files in its glob, the 131 `.md` files contain no `>>>` prompt, which is the only form pytest collects. The one file in the glob that has a doctest is `ray-references/glossary.rst`, and the pytest arg is `--doctest-glob=*.md`, so `.rst` isn't collected. The three other prose files in the tree carrying `>>>` are all in the target's own exclude list. Its measured cost is ~8m wall clock for 57.9s of bazel work. - **`bazel/pytest_wrapper.py` maps `NO_TESTS_COLLECTED` to `OK`**, so a target that collects nothing passes green. That applies to every `doctest()` target in the repo, so any of them could silently stop collecting and stay green. Happy to open those separately, or to fold the size correction bazel already suggests (`Test execution time (57.9s ...) outside of range for LONG tests`) into whichever change resolves the collection question, since the right size depends on what the target ends up collecting. ## AI assistance AI assistance (Claude Code) was used to research and draft this change. I reviewed every changed line and ran the verification commands above locally. Signed-off-by: Douglas Strodtman <[email protected]>
…documentation content in the docs-go scope guard (ray-project#65342) ## Why this change is needed `ci/lint/validate_docs_go_scope.sh` fails any pull request carrying the `docs-go` label if a changed file lives outside `doc/`. Two kinds of documentation work live outside `doc/` and are therefore locked out of the label today: - **Ray's Vale configuration** (`.vale.ini`, `.vale/`) sits at the repository root, so a PR that adds or edits a prose-lint rule can never carry the label even though it is documentation content by any reasonable reading. Concretely: ray-project#65239 adds KubeRay style rules and edits `doc/source/ray-contribute/writing-style.md`. Its [premerge build](https://buildkite.com/ray-project/premerge/builds/71732) has exactly one failing job, `lint: validate docs-go scope`. Every other check passes. - **The API-consistency checker's own source** (`ci/ray_ci/doc/`) is the tooling behind the `doc: check API doc consistency` step. Same shape: ray-project#65340 changes only that directory, and the label's guard is the sole red job on its [premerge build](https://buildkite.com/ray-project/premerge/builds/71727). In both cases the author's options today are to drop the label and wait on per-library example suites the PR cannot possibly affect, or to split a coherent change across two PRs. ## What changed Widen the guard's in-scope set from "under `doc/`" to "under `doc/`, the Vale prose-lint configuration (`.vale.ini`, `.vale/`), or the API-consistency checker (`ci/ray_ci/doc/`)". Both fail-closed paths (no merge-base, empty diff) are unchanged, and the `BUILD`-file exclusion now applies uniformly across the whole in-scope set rather than just `doc/`. Also updates the two places that state the predicate in prose, so they don't drift from the script: the `docs-go` section of `doc/source/ray-contribute/ci.md`, and `doc/.claude/CLAUDE.md`. ## Why this is safe The guard exists so `docs-go` can skip the 12 per-library docs example and llm test steps only on a PR that could not break them. The two additions clear that bar on different grounds, which is worth stating separately rather than blurring into one rule. **The Vale configuration** clears it on content: - **It defines no bazel target.** The separate `BUILD`-file exclusion is the mechanism that protects test targets, and it stays intact. - **It holds no executable Ray code**, so no doctest or example can change behavior because of it. - **The check that consumes it already runs unconditionally.** `lint: documentation_style` sits in the `lint-small-prose` matrix in `.buildkite/lint.rayci.yml` carrying `always`, which `always.rules.txt` emits for every changed file. Vale therefore runs on every pull request whether or not the label is present. - **No premerge step is traded away.** `test.rules.txt` already routes `.vale.ini` and `.vale/` to `doc` alone, in the rendering-and-validation-only block. That tag reaches `doc: build`, which carries `skip-on-premerge`. **The checker source** is executable CI code, so the reasoning above does not apply to it. It clears the bar on tag routing: - **`test.rules.txt` routes `ci/ray_ci/doc/` to `doc_api tools` and nothing else**, ahead of the broad `ci/ray_ci/` rule, and first match wins. - **Every step the label skips carries a library tag instead** — `core_python`, `data`, `llm`, `train`, `tune`, `rllib_directly`, `serve`, and the `*_doc` tags. A change confined to this directory never emits a tag that selects one of them. Since the label's `if:` can only suppress an already-emitted step, there is nothing for it to take away. - **Measured on the same commit, with and without the label.** ray-project#65340 was built twice: [71727](https://buildkite.com/ray-project/premerge/builds/71727) carried `["go", "docs-go"]` and [71736](https://buildkite.com/ray-project/premerge/builds/71736) carried `["go"]`. Both emitted the same 33 jobs, and diffing the two job-name sets yields no difference in either direction. The label's only effect on such a PR is whether this guard itself is emitted: it ran and failed in the first build, and was `broken` (never emitted) in the second. That is the claim above, observed rather than derived. - **The checks that do cover the directory are ungated.** The `doc_api` API checks and the `tools` job running this directory's six `ci_unit` py_test targets both run with the label present. Build 71727 is the direct evidence: it carried `docs-go` and ran `doc: check API annotations`, `doc: check API doc consistency`, and all six `//ci/ray_ci/doc:*` targets, all green. - **`BUILD` files stay excluded**, so a change to this directory's test targets still fails the guard. ray-project#65340 is exactly that case: it adds a `py_test` src, so it would still not qualify for the label after this change. That is the intended outcome. Each list is deliberately narrow. For Vale it covers the prose rules, not the CI wiring that runs them: `ci/lint/check-documentation-style.sh` and the Vale hook in `.pre-commit-config.yaml` stay out of scope, because a change to either one alters what actually runs. For the checker it covers `ci/ray_ci/doc/` only, not the shared `ci/ray_ci/` tooling that every bazel test step runs through. ## Two corrections on the same surface - **The script's header comment claimed the label skips the API consistency checks.** It doesn't. `doc.rayci.yml` leaves them deliberately ungated, precisely because an API reference page edit is the content-only change they must cover, and build 71727 confirms both ran under the label. `ci.md` already described this correctly, so only the script was wrong. - **The failure message advised an action that cannot work.** It said "Remove the 'docs-go' label so the appropriate tests run," but removing the label cannot produce a corrected build on the same commit. A Buildkite rebuild replays the label set from the build it was rebuilt from, and the pipeline sets `skip_pull_request_builds_for_existing_commits`, so the `unlabeled` event on an already-built commit produces no build at all. Verified on ray-project#65340: `docs-go` was removed at 19:59:30Z, build 71727 was created at 20:00:03Z as a UI rebuild, and its payload still carried `["go", "docs-go"]`. The message and both prose surfaces now say to remove the label *and push a new commit*. ## Checks - [x] I've signed off every commit (`git commit --signoff`). - [x] I've made sure the tests are passing. - Testing Strategy - [x] Manual tests `shellcheck` is clean. The guard was exercised end to end against a controlled base in a scratch repository, 15 cases — the 7 from the Vale-only version, unchanged, plus 8 for the new path: | Changed files | Expected | Result | | --- | --- | --- | | `.vale.ini` + `.vale/styles/**` + a `doc/` page (the ray-project#65239 shape) | pass | pass | | `.vale/styles/**` alone | pass | pass | | a `doc/` page alone (behavior before this change) | pass | pass | | `.vale/styles/**` + a file under `python/ray/` | fail | fail, names the Python file | | `.vale/BUILD.bazel` | fail | fail, names it as a `BUILD` file | | `ci/lint/check-documentation-style.sh` | fail | fail | | `.pre-commit-config.yaml` | fail | fail | | `ci/ray_ci/doc/api.py` alone | pass | pass | | `ci/ray_ci/doc/api.py` + a `doc/` page | pass | pass | | `ci/ray_ci/doc/mock/_internal/__init__.py` | pass | pass | | `ci/ray_ci/doc/BUILD.bazel` (the ray-project#65340 shape) | fail | fail, names it as a `BUILD` file | | `ci/ray_ci/doc/api.py` + a file under `python/ray/` | fail | fail, names the Python file | | `ci/ray_ci/tester.py` (shared tooling, not the checker) | fail | fail | | `ci/ray_ci/docker/**` (sibling path) | fail | fail | | `doc/BUILD.bazel` | fail | fail, unchanged behavior | Note that this PR itself edits `ci/lint/`, so it deliberately does not carry the `docs-go` label. The label's effect on ray-project#65239 is the real confirmation, and I'll rebase that PR onto this once it lands. ## Related ray-project#64775 reserved the `doc` tag for documentation validation. The `docs-go` label and this guard arrived with the content-only escape hatch that followed. ray-project#65340 is the checker-source change that motivated the second path. --------- Signed-off-by: Douglas Strodtman <[email protected]>
…ect#64413) ## Why are these changes needed? The YAML under `doc/redirects/` is the source of truth for the docs.ray.io Read the Docs redirect configuration, managed with [rtd-redirects](https://github.com/anyscale/rtd-redirects). Today a PR that edits only redirect YAML runs no check at all, so a malformed or unreachable redirect can merge unnoticed. Nothing routes redirect YAML anywhere. `.yaml` isn't covered by the leading prose-and-image skip rule, nor by the `doc/*.py`/`doc/*.ipynb`/`doc/*/BUILD.bazel` catch-all, so it falls through to the broad `doc/` pass rule at the bottom of the doc section and emits no tag at all. Confirmed against the rule engine on master: `doc/redirects/current.yaml` emits `set()`. This adds a lightweight, credential-free premerge gate for `doc/redirects/*.yaml` that validates the redirects and prints the redirect-level diff. The change is purely additive: it gives redirect YAML a check where it previously had none, and no other path's selection changes. ## What changed - **`.buildkite/test.rules.txt`** — declare a `doc_redirects` test tag and route `doc/redirects/*.yaml` to it. The rule sits ahead of every `doc/` rule, which matters because the final `doc/` pass rule is what currently swallows these files. The rule emits `doc_redirects` alone, deliberately not `doc` or `doc_api`. A redirect edit can't change the documented API surface, and the check needs neither a rendered documentation build nor a compiled Ray: it parses the YAML and diffs it against the base ref. - **`.buildkite/test.rules.txt`** — route `.buildkite/doc.rayci.yml` to `doc_redirects` as well, on its own rule rather than by extending the autodoc-machinery block, so a `conf.py` edit doesn't start running the redirect check. An edit to a step definition has to be able to select the step it edits, which is the same reason that file already emits `doc_api`. This also covers the `anyscale-rtd-redirects` version pin, which lives in the redirect step's commands, so a version bump re-runs the check. - **`.buildkite/test.rules.test.txt`** — three cases: `doc/redirects/current.yaml: doc_redirects`, `doc/redirects/README.md:` asserting the prose beside it stays unrouted, and `.buildkite/doc.rayci.yml: doc doc_api doc_redirects`. The last one revises an assertion that already existed on master, since that file's tag set genuinely changes here. - **`.buildkite/doc.rayci.yml`** — add a `forge`-based step (no doc image) that installs the pinned `anyscale-rtd-redirects==0.2.0` from PyPI and runs: ``` rtd-redirects validate doc/redirects/current.yaml rtd-redirects diff-file --file doc/redirects/current.yaml --base FETCH_HEAD --head HEAD --repo . ``` The step diffs against `FETCH_HEAD` after fetching the PR's base branch, rather than against `origin/<base>`: a clone with a restricted refspec may never create a local remote-tracking ref, and `doc/test_no_new_rst.py` already solves the same problem the same way. The base branch resolves at runtime from `$${BUILDKITE_PULL_REQUEST_BASE_BRANCH:-master}`, escaped so the shell expands it rather than Buildkite interpolating it at pipeline-upload time, matching the `$${...}` convention used across the other pipeline files. The step also fails closed if `doc/redirects/` grows a YAML file the commands don't name. The tag selects on a glob, but multiple redirect files compose in the order given and a shell glob can't express that order, so the guard forces the compose-order decision to be made explicitly instead of letting a new file select the step and then go unvalidated. ## Verification Verified with Ray's rule parser (`ci/pipeline/determine_tests_to_run.py`), the same first-match-wins engine rayci uses: - `check_rules()` parses clean, and all 126 cases in `test.rules.test.txt` replay green. That file is enforced by the `test-rules` CI step, and rayci asserts exact set equality, so a passing case proves the path emits exactly those tags and nothing else. - A sweep of all 10,333 tracked files against master shows **exactly two deltas** — `doc/redirects/current.yaml` gaining `doc_redirects`, and `.buildkite/doc.rayci.yml` gaining it alongside its existing `doc doc_api` — and **zero tag losses** on any path. Every pre-existing assertion in `test.rules.test.txt` is preserved except the `doc.rayci.yml` one this PR deliberately revises. - Ran the step's commands locally in a clean venv with `anyscale-rtd-redirects==0.2.0` against the current `doc/redirects/current.yaml`: `validate` reports 0 errors (49 chain warnings, informational), and `diff-file --base FETCH_HEAD` reports the redirect-level diff and exits 0 with no Read the Docs credentials. - Exercised the drift guard both ways: it passes with only `current.yaml` present and exits non-zero when a second `doc/redirects/*.yaml` appears. Because `.buildkite/doc.rayci.yml` now emits `doc_redirects`, **this PR selects the new step and runs it**. Replaying this PR's own changed files through the rule engine gives a tag union of `doc`, `doc_api`, `doc_redirects`, and `tools`, so the step's commands are exercised in CI here rather than only on some later PR that happens to edit redirect YAML. It runs against an unchanged `current.yaml`, so `diff-file` reports an empty redirect diff and exits 0, which is exactly the smoke test that catches a typo in the step definition. ## Update: rebased onto the doc-tag reorg Rebased after ray-project#64775 and ray-project#64812 landed, which reorganized the doc tags: doc example tests moved to per-library `<lib>_doc` tags, and `doc` was split so the autodoc machinery emits `doc doc_api` while the rendering-only surface emits `doc`. This branch's four commits (one an upstream merge) are collapsed into one. Two conflicts in `test.rules.txt` (the tag declaration line, and the rule insertion point) and one in `test.rules.test.txt` (three expectations the reorg had since updated) were resolved in favor of master, then the `doc_redirects` rule and cases re-applied on top. The rebase also invalidated this PR's original rationale, so the rule and step comments have been rewritten. The earlier framing was that `doc_redirects` keeps redirect YAML from pulling in docbuild, the API checks, and the per-team doc tests. That's no longer accurate on any of the three: the per-team tests are selected by `<lib>_doc`, the two API checks carry `doc_api` plus the library tags and no longer carry bare `doc`, and the only remaining step carrying bare `doc` is `doc: build`, which is `skip-on-premerge`. Since redirect YAML emits nothing at all on master, this rule was never preventing over-triggering. It's additive, and the comments now say so. ## Update: the step now selects itself Cursor Bugbot caught that the redirect step wasn't reachable from an edit to its own definition: `.buildkite/doc.rayci.yml` emitted `doc doc_api` but never `doc_redirects`, so changing the redirect step's commands wouldn't have run the redirect step. That contradicted the rule's own stated reason for emitting `doc_api`, and this PR demonstrated the gap: its previous revision noted that the new step didn't execute here. Fixed by giving `.buildkite/doc.rayci.yml` its own rule emitting `doc doc_api doc_redirects`. It's a separate rule rather than an extra tag on the autodoc-machinery block, because that block also covers `conf.py`, `api_autogen.py`, and `doc/source/_ext/`, and a `conf.py` edit has no business running the redirect check. The first attempt at this appended the tag to the shared block and the full-repo sweep caught it immediately: seven machinery files picked up `doc_redirects`. AI assistance (Claude Code) was used to draft the CI step, the rebase conflict resolution, and this description. Every changed line was reviewed by hand, and the verification above was run as described. This isn't duplicating existing work: no other open PR adds redirect validation to premerge, and the `doc_redirects` tag doesn't exist on master. ## Update: uv, and a recursive fail-closed guard Two review follow-ups. **Install with `uv`** (Elliot's suggestion). `ci/docker/forge.Dockerfile` already installs uv to `/usr/local/bin` and uses it for the image's Python, so the step needs no extra setup. It's `uv tool install` rather than `uv pip install --system` for a PATH reason: the previous revision's premerge log shows `pip install` fell back to a user install, so the `rtd-redirects` entry point resolved from `~/.local/bin`. `uv tool install` writes executables to that same directory, so PATH resolution is unchanged. `uv pip install --system` would target the uv-managed interpreter and put the entry point in that env's `bin`, which isn't on PATH. **The fail-closed guard now recurses.** Cursor Bugbot caught that the guard's single-level shell glob didn't cover a nested redirect file, and it was right. The rule engine matches with `fnmatch`, whose `*` crosses `/`, so `doc/redirects/nested/foo.yaml` emits `doc_redirects` and selects this step, while `ls doc/redirects/*.yaml` never saw it and the guard passed. Replacing the glob with `find` closes the gap. Exercised three ways locally: passes with only `current.yaml`, exits non-zero for a nested file and for a sibling file. A `.yml` file stays out of scope. The tag rule matches `*.yaml` only, so `doc/redirects/current.yml` emits no tags and never selects the step, putting it beyond the guard's reach. That matches the pre-PR baseline for every redirect file rather than regressing anything, and `rtd-redirects` uses `.yaml`. Re-verified after the change: rules parse clean and all 126 cases in `test.rules.test.txt` replay green (the rule files are untouched by this revision). ## Related issue number N/A ## Checks - [x] I've signed off every commit (`-s`), because all commits are squashed into one when merged. - [x] I've run `scripts/format.sh` to lint the changes in this PR. (Via `pre-commit`; the applicable hooks pass.) - [x] I've made sure the tests are passing. - Testing Strategy - [x] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: Douglas Strodtman <[email protected]>
Reviewer summary
What this does. The per-team
X: doc testssteps are library example and doctest suites that live underdoc/. They exercise library code, not documentation quality. Today every executable doc asset emits the blanketdoctag and all six teams' steps are taggeddoc, so a one-library doc change starts every team's step. This gives each step a dedicated<lib>_doctag, routesdoc/source/<lib>/**to the owning library's tag, renames the steps toX: docs example tests, and leavesdocfor documentation validation (the build and the Vale/config infra). The library tag stays on each step, so a library code change runs its doc example tests exactly as before.What's verified.
test-rulesgreen on this PR. That's the pinnedraycibinary replaying all 103test.rules.test.txtassertions (up from 57 on master) with exact set equality, so each case also proves the blanketdoctag does not come along.rayci v0.46.0release binary for a one-file Serve doc-example change, before and after this branch. Output below.doc/routes to a step that can actually select itteam:/--only-tags/--except-tagsfilters. One deliberate exception (doc/test_myst_doc.py, below) and two pre-existing gaps that this change doesn't create.fmt.Sprintf("g%d_s%d", i, j),converter.go), not from the label. The generated pipelines confirm it:g16_s12,g16_s21,g6_s22,g13_s26are identical before and after.What I need from a reviewer.
ci/build/get_build_info.pysetsconfig.envto"Buildkite " + BUILDKITE_LABEL, andci/build/upload_build_info.shuploads it on postmerge pipelines onmasteronly. Does anything downstream of thatmetadata.jsontreatconfig.envas an identity or grouping key? If it's descriptive, renaming five steps is free. If something groups on it, those five steps' postmerge history splits at the merge commit. Flaky-test selection and target selection both key onteam(unchanged here) and test identity is the bazel target name (f"{system}:{name}"inrelease/ray_release/test.py), so I believeconfig.envis the only place the label escapes.doc/source/templates/*/start.ipynbplus a handful underdoc/source/cluster/doc_code/,doc/source/ray-contribute/doc_code/, anddoc/source/_templates/. The templates majority may be retired or externally managed, in which case a skip rule is the better answer than core ownership.Known behavior change worth your eyes. Because
doc/source/<lib>/doc_code/andexamples/now emit<lib>_docinstead ofdoc, the two API-surface checks (doc: check API annotations,doc: check API doc consistency) stop running on library doc-example changes. They carry the blanketdoctag among their library tags, so today adoc_codeedit incidentally triggers a premergemake -C doc/ html. I think that's correct: those checks guard the documented public API surface, which a doc example can't change, and the example itself is still executed by the owning library's step while the render is gated by Read the Docs. But it is a premerge signal that disappears, so it should be a decision rather than a side effect. Raised on #64812, which routes the API reference pages to a dedicateddoc_apitag for the related case.Out of scope, tracked separately.
.buildkite/others.rayci.yml:13declares a sixth step labeleddoc tests, running//python/ray/... //doc/... none --only-tags doctestand taggedpython, a tag no rule intest.rules.txtemits. Generating the full-fan-out pipeline shows it does get emitted (doc tests [g14_s1]), so it is live. After this rename it becomes the only step in the repo still called "doc tests." This PR doesn't touchothers.rayci.ymland the fix is independent.What this changes
<lib>_doctag (core_doc,data_doc,ml_doc,rllib_doc,serve_doc) and drops the blanketdoctag. The library tag stays.test.rules.txtroutesdoc/source/<lib>/**to that library's tag, so a doc change runs only the owning library's example tests. LLM doc assets already route tollmand keep doing so.docreserved for validation. It now stays only on the documentation build and the Vale/config infra.X: docs example tests, since a failure in these steps means library code or an example broke, not that the docs are wrong.test.rules.txtmatcheddoc/BUILDanddoc/*/BUILD, but the files areBUILD.bazel, so editing a file that defines the doc test targets ran no doc tests premerge. It now matches the.bazelfiles and routes them to the same per-library steps. The rootdoc/BUILD.bazeldefines every library's targets, so it routes to all of them.Scoping exceptions, and why each exists
Several paths sit under a library doc directory but can't be meaningfully tested by that library's example step, so they're routed explicitly rather than by directory:
.pngor.svgedit triggers nothing. 310 tracked image files..yamland.shstay routed, since unlike an image they can change what a test does.doc.conf.pyimportscustom_directives,api_autogen,api_mock_imports, andtemplate_collections; none was listed in the validation-infra rule, so all fell to thedoc/*.pycatch-all and emittedcore_doc, running Ray Core's doctests for a docs-build-machinery edit. Those four pluspreprocess_github_markdownand the doc-root build helpers now route todoc. They're enumerated one per line on purpose:*is fnmatch here and crosses/, so adoc/source/*.pypattern would also swallow every example script underdoc/source/<lib>/doc_code/. There's a comment on the rule saying so.doc.doc/source/{data,serve,train}/examples.ymlare parsed bycustom_directives.py(EXAMPLE_GALLERY_CONFIGS) to generate the gallery pages. They hold no executable code and can't change what any example does. Narrowed to a three-path exception rather than a blanket.ymlskip, because a sibling.ymlunder a library doc directory can be a config an example consumes.doc/.claude/triggers nothing. Agent files never participate in the Sphinx build and define no test targets, butdoc/.claude/skills/sphinx-fix/sphinx_fix.pymatched thedoc/*.pycatch-all. The Read the Docs build guard already excludes this exact path for the same reason, so the two guards now agree. Pre-existing rather than a regression from this PR: on master the file emits the blanketdoctag, which reaches all five per-team steps.team:mlnotebooks underray-core/route toml_doc.plot_hyperparameter,batch_prediction,plot_parameter_server, andplot_pong_examplelive underdoc/source/ray-core/examples/but their targets are taggedteam:ml, and the team argument to//ci/ray_ci:test_in_dockerfilters targets byteam:<team>(_get_all_test_query,ci/ray_ci/tester.py). Routing them tocore_docwould run a step that tests everything underray-core/except the file that changed. Re-tagging the fourteam:coreindoc/BUILD.bazelis the alternative fix and would let the rule lines go away.highly_parallel.ipynbroutes todoc. Itspy_testcarries ahighly_paralleltag that the ml docs example step excludes, and the notebook glob indoc/source/ray-core/examples/BUILD.bazelexcludes it too, as a release test needing a live multi-node cluster. The remaining ml//doc/...steps selectgpu/train_v2_gpuand the target has neither, so no premerge step executes it. Routing todocmeans the build renders it (nb_execution_modedefaults tooff, so render-and-lint only), which is the only validation premerge offers here.doc/external/routes toml_doc. Itstest_external_hashestarget is taggedteam:ml; it had fallen through thedoc/*.pycatch-all tocore_doc, where the core step'steam:corequery never sees it.llms.txtfiles route todoc. [doc] Add in-repo llms.txt generator, replacing sphinx-llms-txt #64458 addsdoc/test_llms_txt.pyanddoc/source/llms_txt_summary.txtwith notest.rules.txtchange. Left alone the test would land on thedoc/*.pycatch-all and emitcore_doc, running Ray Core's doctests for a test its own docstring describes as hermetic, while never running the step that executes it. Rules for absent paths are inert, so there's no ordering dependency: this PR doesn't touchdoc.rayci.yml, [doc] Add in-repo llms.txt generator, replacing sphinx-llms-txt #64458 doesn't touchtest.rules.txt, and whichever lands first the other merges correctly scoped.doc/test_myst_doc.pyout to all five<lib>_doctags. It backs 19 targets across every team, but it's shared infrastructure, so a break surfaces in core as readily as anywhere. One library's worth of execution is a sufficient smoke signal and the post-merge build covers the rest. The rule carries a comment recording that trade and when to revisit it.Effect on a doc-only PR (no
docs-go)doc testsstepserve: docs example testsand its GPU siblingdoc testsstepdata: docs example tests, plus the dask and GPU siblingscustom_directives.pyetc.)core: docs example testsdoc: buildonly (post-merge)examples.yml)doc: buildonly (post-merge)doc/BUILD.bazeldoc: check API*checksdoctagThe GPU and dask siblings carry
<lib>_doctoo, and tag matching is a non-empty intersection, so they're selected alongside the main step. That's unchanged behavior: they carried the blanketdoctag before, so a doc change already started them. No new GPU cost.Verification
Rule conformance, under the authoritative evaluator.
test-rulesis green on this PR. It replays all 103test.rules.test.txtassertions through the pinnedraycibinary, andrunTestRulescompares the full computed tag set per path, so every case is also a negative assertion that no other tag fires.Tag-to-step resolution, generated locally. The tag set isn't the step set: rayci filters steps by tag, then
markDepspulls in everything reachable throughdepends_onregardless of that step's own tags. To confirm the composition rather than infer it, I ran the pinnedrayci v0.46.0release binary against a one-file Serve doc-example change, on master and on this branch:Six teams' example steps collapse to the owning team's two, and the step IDs are unchanged across the rename.
Routing versus coverage. Correct routing isn't sufficient: the step that starts still has to select the target.
ci/ray_ci/tester.pyfilters byattr(tags, 'team:<team>'), then intersects--only-tagsand subtracts--except-tags, so a change can route perfectly, start the right-looking step, and be invisible to every command in it. I swept all 948 (file, target) claims underdoc/against the per-team filters. After the exceptions above, the only deliberate team mismatch left isdoc/test_myst_doc.py. Two pre-existing gaps fell out, neither created by this change:team:mlnotebooks taggedgpu, fiveteam:coredoc_codemodules taggedmulti_gpu, and onepost_wheel_buildmodule.dataandserveeach have a GPU doc-example step; ml and core never got one, so the only steps that would run these are gated ontrain_gpuandcgraphs_direct_transport, which no doc path emits. Nodoc-tagged step ran them before the split either. This needs a REEf and library-team decision rather than a rules change.doc/BUILD.bazeldoctesttargets overdoc/source/**/*.{md,rst}are reachable only from theothers.rayci.ymlstep gated onpython, while prose paths hit the leading skip rule. Roughly 700 files. I consider this correct as-is: given current coverage the Read the Docs render build is the gate a prose change needs.Also swept all 1,628 tracked
doc/files against the previous rules to confirm exactly which paths changed routing and that nothing else moved.Change log
Consolidated above; kept here so the review history stays legible.
6a1310d3b5— the split: per-library tags, path routing, rename,BUILD.bazelrule fix.c6302c8a21,b1d03629cf— first bot-review pass: static images skip; Sphinx build modules route todoc.99c3af2c28— pre-route thellms.txtextension test and summary ahead of [doc] Add in-repo llms.txt generator, replacing sphinx-llms-txt #64458.3795c6161b— skipdoc/.claude/; route theteam:mlray-corenotebooks toml_doc.e88e8a4b52— remove a strayTEMP(do-not-merge)marker that reached master with [ci/doc] Walk ray.data.llm as its own head module instead of allowlisting it #65040. Inert, and independent of this PR's thesis; happy to split it out.f8347baf54— second bot-review pass: gallery configs todoc; correcthighly_parallel.ipynbtodoc.6a050a0511— routedoc/external/toml_docso the hash guard still runs.AI assistance
This change was drafted with AI assistance (Claude Code) and reviewed by me.