Repository navigation
[ci/doc] Walk ray.data.llm as its own head module instead of allowlisting it - #65040
Merged
Merged
Conversation
The code<->docs API consistency check only sees APIs that its module walk reaches, and the walk only follows submodules a parent `__init__` actually imports. A public, `@PublicAPI`-annotated subpackage that its parent does not import is invisible to the check, so its APIs can silently rot undocumented. `ray.serve.llm` and `ray.data.llm` are both such surfaces today: they are documented and annotated, but no walk reaches them. - Add `ray.serve.llm` to the serve `head_modules` so its public surface is walked. It is import-safe in the docbuild image (transformers is a soft `try_import`, vLLM is only imported lazily). - Add a cross-team guard that enumerates one level of subpackages under every configured head module and fails when an annotated subpackage is neither reached by any walk nor knowingly excluded. A reviewed allowlist records the intentional exclusions and why. - Allowlist `ray.data.llm`: it eagerly imports the vLLM/SGLang engine processor configs, which do a hard `import transformers` at module load, and transformers is absent from the docbuild image, so it cannot be imported by this check. Its surface stays documented in `doc/source/data/api/llm.rst`. - Track reachable module names on `Module` so the guard can tell "walked" from "merely name-prefixed" (`ray.data.llm` is prefixed by `ray.data` yet never imported). - Unit-test the guard's decision core and helpers against the mock module. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
…ting it Alternative to allowlisting ray.data.llm in the coverage guard. The consistency check now runs its walks (and the coverage guard) inside _mock_uninstalled_backends, which mocks the backends absent from the docbuild image. The engine processor configs ray.data.llm imports eagerly (vLLM/SGLang -> a hard `import transformers`) therefore resolve, so ray.data.llm imports cleanly and can be a walk root like ray.serve.llm rather than an un-importable subpackage that must be excluded. - Add ray.data.llm to the data team head_modules. Its public surface is documented in doc/source/data/api/llm.rst, reachable from api.rst's toctree, so the walk checks the code surface against the real docs. - Run the cross-team guard inside _mock_uninstalled_backends so its coverage check and import probes see the same mocks as the walks. A promoted head like ray.data.llm is then counted as covered rather than flagged. - Empty UNWALKED_ANNOTATED_ALLOWLIST: both known escapees (ray.serve.llm and ray.data.llm) are now walked. Keep the list as the reviewed record for any future subpackage that genuinely cannot be a walk root. - Decouple the guard decision-core unit tests from real module names so they assert the function's behavior, not the current head/allowlist config. The decisive check is "doc: check API doc consistency" against the real docbuild image, which exercises the mocked ray.data.llm import path this approach depends on. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
…check Touch to tag this checker-only PR into the `doc` pipeline so doc_api_policy_check runs against the docbuild image. Revert before un-drafting. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
The "doc: check API doc consistency" job's first real run against the docbuild image surfaced the existing coverage gaps. Freeze them so the check passes against a known baseline. Each entry is tracked debt owed a document-or-deprecate decision by the owning library team, not a permanent exclusion; any new gap outside these lists still fails the build, so the debt can only shrink. - Guard: add the 13 unwalked annotated subpackages to UNWALKED_ANNOTATED_ALLOWLIST (10 annotated-not-walked, 3 unverifiable-import). - Data: add the 2 undocumented ray.data.llm APIs (HttpRequestStageConfig, ServeDeploymentProcessorConfig) to the data tracked_doc_debt. - Serve: add the 3 undocumented ray.serve.llm builder functions (build_dp_deployment, build_dp_openai_app, build_pd_openai_app) to the serve tracked_doc_debt. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
dstrodtman
marked this pull request as ready for review
August 3, 2026 13:40
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a new cross-team coverage guard (_check_unwalked_annotated_subpackages) to the API discrepancy checker. This guard ensures that any public, @PublicAPI-annotated subpackages that are not imported by their parent packages (and thus missed by standard module walks) are detected and flagged unless explicitly allowlisted. To support this, ray.data.llm and ray.serve.llm were added as head modules, and the module walker was updated to track reachable modules. Comprehensive unit tests were also added to verify the new guard's behavior. There are no review comments, so I have no feedback to provide.
elliot-barn
approved these changes
Aug 3, 2026
dstrodtman
added a commit
to dstrodtman/ray
that referenced
this pull request
Aug 3, 2026
A TEMP(do-not-merge) comment was added to the top of .buildkite/doc.rayci.yml to tag a checker-only PR into the `doc` pipeline, and it merged to master with ray-project#65040 instead of being reverted first. It is inert, but it tells every reader the file is mid-experiment. Remove it. Signed-off-by: Douglas Strodtman <[email protected]>
goutamvenkat-anyscale
pushed a commit
to goutamvenkat-anyscale/ray
that referenced
this pull request
Aug 3, 2026
…ting it (ray-project#65040) ## Why This is an **alternative** to ray-project#64514. Same goal — no `@PublicAPI` subpackage silently escapes the code↔docs consistency walk — but it walks `ray.data.llm` instead of allowlisting it. ray-project#64514 allowlists `ray.data.llm` on the premise that its eager `import transformers` (via the vLLM/SGLang engine processor configs) can't be imported in the docbuild image. That premise predates the `_mock_uninstalled_backends` wrapper now on `master`, which mocks exactly the backends the docbuild image lacks. Under that mock, `ray.data.llm` imports cleanly and can be a walk root like `ray.serve.llm` — so its documented surface gets checked rather than merely excluded. ## What - Add `ray.data.llm` to the data team `head_modules`. Its surface is documented in `doc/source/data/api/llm.rst`, reachable from `api.rst`'s toctree, so the walk checks the code surface against the real docs. - Run the cross-team coverage guard **inside** `_mock_uninstalled_backends` so its coverage check and import probes see the same mocks as the walks; a promoted head like `ray.data.llm` is counted as covered, not flagged. - Empty `UNWALKED_ANNOTATED_ALLOWLIST`: both known escapees (`ray.serve.llm`, `ray.data.llm`) are now walked. The list stays as the reviewed record for any future subpackage that genuinely can't be a walk root. - Decouple the guard decision-core unit tests from real module names. ## Relationship to ray-project#64514 Pick one, not both. This branch carries ray-project#64514's guard commit plus one delta commit; if this approach is preferred, the two squash into one before un-drafting. ## Checks The decisive check is **doc: check API doc consistency** — it exercises the mocked `ray.data.llm` import path this approach depends on, against the real docbuild image. Kept as a draft until that check is confirmed green. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
1 of 8 tasks
dstrodtman
added a commit
that referenced
this pull request
Aug 5, 2026
…per library (#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 #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`.** #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`, #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 #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 #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]>
Artimislyy
pushed a commit
to Artimislyy/ray
that referenced
this pull request
Aug 11, 2026
…ting it (ray-project#65040) ## Why This is an **alternative** to ray-project#64514. Same goal — no `@PublicAPI` subpackage silently escapes the code↔docs consistency walk — but it walks `ray.data.llm` instead of allowlisting it. ray-project#64514 allowlists `ray.data.llm` on the premise that its eager `import transformers` (via the vLLM/SGLang engine processor configs) can't be imported in the docbuild image. That premise predates the `_mock_uninstalled_backends` wrapper now on `master`, which mocks exactly the backends the docbuild image lacks. Under that mock, `ray.data.llm` imports cleanly and can be a walk root like `ray.serve.llm` — so its documented surface gets checked rather than merely excluded. ## What - Add `ray.data.llm` to the data team `head_modules`. Its surface is documented in `doc/source/data/api/llm.rst`, reachable from `api.rst`'s toctree, so the walk checks the code surface against the real docs. - Run the cross-team coverage guard **inside** `_mock_uninstalled_backends` so its coverage check and import probes see the same mocks as the walks; a promoted head like `ray.data.llm` is counted as covered, not flagged. - Empty `UNWALKED_ANNOTATED_ALLOWLIST`: both known escapees (`ray.serve.llm`, `ray.data.llm`) are now walked. The list stays as the reviewed record for any future subpackage that genuinely can't be a walk root. - Decouple the guard decision-core unit tests from real module names. ## Relationship to ray-project#64514 Pick one, not both. This branch carries ray-project#64514's guard commit plus one delta commit; if this approach is preferred, the two squash into one before un-drafting. ## Checks The decisive check is **doc: check API doc consistency** — it exercises the mocked `ray.data.llm` import path this approach depends on, against the real docbuild image. Kept as a draft until that check is confirmed green. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Artimislyy
pushed a commit
to Artimislyy/ray
that referenced
this pull request
Aug 11, 2026
…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]>
3 tasks done
400Ping
pushed a commit
to 400Ping/ray
that referenced
this pull request
Aug 18, 2026
…ting it (ray-project#65040) ## Why This is an **alternative** to ray-project#64514. Same goal — no `@PublicAPI` subpackage silently escapes the code↔docs consistency walk — but it walks `ray.data.llm` instead of allowlisting it. ray-project#64514 allowlists `ray.data.llm` on the premise that its eager `import transformers` (via the vLLM/SGLang engine processor configs) can't be imported in the docbuild image. That premise predates the `_mock_uninstalled_backends` wrapper now on `master`, which mocks exactly the backends the docbuild image lacks. Under that mock, `ray.data.llm` imports cleanly and can be a walk root like `ray.serve.llm` — so its documented surface gets checked rather than merely excluded. ## What - Add `ray.data.llm` to the data team `head_modules`. Its surface is documented in `doc/source/data/api/llm.rst`, reachable from `api.rst`'s toctree, so the walk checks the code surface against the real docs. - Run the cross-team coverage guard **inside** `_mock_uninstalled_backends` so its coverage check and import probes see the same mocks as the walks; a promoted head like `ray.data.llm` is counted as covered, not flagged. - Empty `UNWALKED_ANNOTATED_ALLOWLIST`: both known escapees (`ray.serve.llm`, `ray.data.llm`) are now walked. The list stays as the reviewed record for any future subpackage that genuinely can't be a walk root. - Decouple the guard decision-core unit tests from real module names. ## Relationship to ray-project#64514 Pick one, not both. This branch carries ray-project#64514's guard commit plus one delta commit; if this approach is preferred, the two squash into one before un-drafting. ## Checks The decisive check is **doc: check API doc consistency** — it exercises the mocked `ray.data.llm` import path this approach depends on, against the real docbuild image. Kept as a draft until that check is confirmed green. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: 400Ping <[email protected]>
400Ping
pushed a commit
to 400Ping/ray
that referenced
this pull request
Aug 18, 2026
…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]>
nadongjun
pushed a commit
to nadongjun/ray
that referenced
this pull request
Oct 6, 2026
…ting it (ray-project#65040) ## Why This is an **alternative** to ray-project#64514. Same goal — no `@PublicAPI` subpackage silently escapes the code↔docs consistency walk — but it walks `ray.data.llm` instead of allowlisting it. ray-project#64514 allowlists `ray.data.llm` on the premise that its eager `import transformers` (via the vLLM/SGLang engine processor configs) can't be imported in the docbuild image. That premise predates the `_mock_uninstalled_backends` wrapper now on `master`, which mocks exactly the backends the docbuild image lacks. Under that mock, `ray.data.llm` imports cleanly and can be a walk root like `ray.serve.llm` — so its documented surface gets checked rather than merely excluded. ## What - Add `ray.data.llm` to the data team `head_modules`. Its surface is documented in `doc/source/data/api/llm.rst`, reachable from `api.rst`'s toctree, so the walk checks the code surface against the real docs. - Run the cross-team coverage guard **inside** `_mock_uninstalled_backends` so its coverage check and import probes see the same mocks as the walks; a promoted head like `ray.data.llm` is counted as covered, not flagged. - Empty `UNWALKED_ANNOTATED_ALLOWLIST`: both known escapees (`ray.serve.llm`, `ray.data.llm`) are now walked. The list stays as the reviewed record for any future subpackage that genuinely can't be a walk root. - Decouple the guard decision-core unit tests from real module names. ## Relationship to ray-project#64514 Pick one, not both. This branch carries ray-project#64514's guard commit plus one delta commit; if this approach is preferred, the two squash into one before un-drafting. ## Checks The decisive check is **doc: check API doc consistency** — it exercises the mocked `ray.data.llm` import path this approach depends on, against the real docbuild image. Kept as a draft until that check is confirmed green. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
nadongjun
pushed a commit
to nadongjun/ray
that referenced
this pull request
Oct 6, 2026
…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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
This is an alternative to #64514. Same goal — no
@PublicAPIsubpackage silently escapes the code↔docs consistency walk — but it walksray.data.llminstead of allowlisting it.#64514 allowlists
ray.data.llmon the premise that its eagerimport transformers(via the vLLM/SGLang engine processor configs) can't be imported in the docbuild image. That premise predates the_mock_uninstalled_backendswrapper now onmaster, which mocks exactly the backends the docbuild image lacks. Under that mock,ray.data.llmimports cleanly and can be a walk root likeray.serve.llm— so its documented surface gets checked rather than merely excluded.What
ray.data.llmto the data teamhead_modules. Its surface is documented indoc/source/data/api/llm.rst, reachable fromapi.rst's toctree, so the walk checks the code surface against the real docs._mock_uninstalled_backendsso its coverage check and import probes see the same mocks as the walks; a promoted head likeray.data.llmis counted as covered, not flagged.UNWALKED_ANNOTATED_ALLOWLIST: both known escapees (ray.serve.llm,ray.data.llm) are now walked. The list stays as the reviewed record for any future subpackage that genuinely can't be a walk root.Relationship to #64514
Pick one, not both. This branch carries #64514's guard commit plus one delta commit; if this approach is preferred, the two squash into one before un-drafting.
Checks
The decisive check is doc: check API doc consistency — it exercises the mocked
ray.data.llmimport path this approach depends on, against the real docbuild image. Kept as a draft until that check is confirmed green.🤖 Generated with Claude Code