Skip to content

[ci] Stop routing the intersphinx directory to the core docs example step - #65646

Merged
elliot-barn merged 1 commit into
masterfrom
doc-1582-intersphinx-ci-rule
Aug 21, 2026
Merged

elliot-barn merged 1 commit into
masterfrom
doc-1582-intersphinx-ci-rule

Conversation

@dstrodtman

Copy link
Copy Markdown
Contributor

Why are these changes needed?

Editing anything in doc/source/_intersphinx/ starts :ray: core: docs example tests, and there is nothing in that directory for the step to run.

refresh.py matches the doc/*.py catch-all near the bottom of .buildkite/test.rules.txt. Patterns there go through fnmatch, whose * crosses /, so doc/*.py claims doc/source/_intersphinx/refresh.py and emits core_doc. That selects a large instance running three test_in_docker invocations over //python/ray/... and //doc/... on corebuild-py3.10. Nothing imports that script, no bazel target names the directory, and exclude_patterns in conf.py drops _intersphinx/** from the source tree, so the step has no target there to execute. Observed on #65644, whose only .py change outside conf.py is a one-line edit to refresh.py.

The .inv snapshots have the opposite problem. They match neither the prose-and-image skip near the top nor the .py/.ipynb catch-all, so they fall through to the broad doc/ skip and emit no tag at all. They are live build inputs: intersphinx_mapping resolves each target's local _intersphinx/<name>.inv ahead of its remote URL, so a truncated or stale snapshot changes what cross-references resolve. Refreshing one, which is the routine maintenance this directory exists for, triggered no documentation build.

What this changes

One directory rule ahead of the catch-all, routing doc/source/_intersphinx/ to doc and nothing else. README.md is already claimed by the doc/*.md prose rule further up, so the rule only ever sees the snapshots and the script.

refresh.py rides along on the directory rule rather than getting its own skip. doc is cheap, the directory is small and homogeneous, and a per-file split here would rot the next time the directory grows a helper.

On premerge, doc selects doc: test llms.txt extension; doc: build and doc: linkcheck both carry skip-on-premerge. So the PR-time gate for an inventory change remains the Read the Docs -W build, which runs outside tag selection entirely. What this rule buys is postmerge documentation-build coverage where there was none.

conf.py is not implicated. It matches the autodoc-machinery block and emits doc doc_api, which is correct and cheap.

Related issue number

Diagnosed while reviewing CI on #65644.

Checks

  • I've signed off every commit (-s).
  • I've included any doc changes needed for the change. The rationale lives in the rule comment, per the convention in this file.
  • Testing strategy
    • Unit tests. Three cases added to .buildkite/test.rules.test.txt covering a snapshot, refresh.py, and the unrouted README.md. All 131 cases in that file and both //ci/pipeline:test_doc_api_rules_sync cases pass.
    • Release tests
    • Differential sweep. Evaluated both rules files before and after against every tracked file in the repo. The only tag changes are the 28 files under doc/source/_intersphinx/: refresh.py moves from core_doc to doc, and the 26 snapshots plus .gitattributes move from no tag to doc. Nothing else in the tree changes, which is the check that matters for a file that decides CI for every PR.

…step

`doc/source/_intersphinx/refresh.py` matched the `doc/*.py` catch-all in
.buildkite/test.rules.txt, whose `*` crosses `/` under fnmatch, so editing it
emitted `core_doc` and started ":ray: core: docs example tests" -- a
large-instance step running three `test_in_docker` invocations over
`//python/ray/...` and `//doc/...`. Nothing imports that script, no bazel
target names the directory, and `exclude_patterns` in conf.py drops
`_intersphinx/**` from the source tree, so the step had nothing there to
execute.

The `.inv` snapshots had the opposite problem. They matched neither the
prose-and-image skip nor the `.py`/`.ipynb` catch-all, so they fell to the
broad `doc/` skip and emitted no tag at all. They are live build inputs:
`intersphinx_mapping` resolves each target's local `_intersphinx/<name>.inv`
ahead of its remote URL, so refreshing one -- the routine maintenance this
directory exists for -- triggered no documentation build.

Add one directory rule ahead of the catch-all that routes the whole directory
to `doc` and nothing else. README.md is already claimed by the `doc/*.md`
prose rule further up, so the rule only sees the snapshots and the script.

Verified against every tracked file in the repo: the only tag changes are the
28 files under this directory. All 131 test.rules.test.txt cases and both
//ci/pipeline:test_doc_api_rules_sync cases pass.

Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman
dstrodtman requested a review from a team as a code owner August 21, 2026 15:47

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Buildkite test routing rules in .buildkite/test.rules.txt and .buildkite/test.rules.test.txt to properly handle the doc/source/_intersphinx/ directory. Specifically, it routes the directory to the doc tag, ensuring that changes to intersphinx inventory snapshots (.inv files) and the refresh.py script trigger the documentation build, while preventing refresh.py from incorrectly triggering the core docs example step. There are no review comments, so I have no feedback to provide.

@dstrodtman dstrodtman added the go add ONLY when ready to merge, run all tests label Aug 21, 2026
dstrodtman added a commit that referenced this pull request Aug 21, 2026
)

## Why are these changes needed?

`torch` is one of the four intersphinx targets that set an explicit
inventory URL instead of deriving it from `base_url`. #63038 pinned it
to `docs/2.7/objects.inv` to match `torch==2.7.0` in
`python/requirements/ml/dl-{cpu,gpu}-requirements.txt`, so
cross-references would only resolve to symbols the version Ray ships
actually has. That PR flagged the tradeoff explicitly: the URL has to
bump alongside the requirements pin.

Those requirements now pin `torch==2.9.0`. The inventory pin stayed at
2.7, so two minor versions of torch API surface stopped resolving.
`torch` resolves 96 cross-references, the fourth-highest of the 18
targets remaining after #65644, so it's the pin worth keeping current.

This repoints the pin to `docs/2.9/objects.inv` and re-runs
`_intersphinx/refresh.py torch`. The snapshot is what actually resolves
references since #64977, so bumping the URL alone would have changed
only the unused fallback. `base_url` stays at `docs/stable/`, so the
link URLs Sphinx emits don't change.

A comment now records that the pin tracks the requirements file, since
that coupling is the thing that went unmaintained.

### Verification that 2.9 doesn't drop a symbol Ray references

Bumping a pinned inventory forward can break the `-W` build if upstream
removed a symbol Ray cross-references, so I checked before pushing
rather than leaving it to CI:

- The 2.7 snapshot carried 11,851 objects, the 2.9 snapshot carries
13,139. Between them, 1,874 objects were added and 586 removed.
- 140 of the 586 removals are in the `torch.*` Python namespace. The
rest are documentation page anchors and C++ index entries.
- Of those 140, all but one sit under `torch.ao.ns._numeric_suite`, a
private module. Nothing under `python/ray` or `doc/source` references
any of them.
- The single remaining name, `torch.cuda.empty_cache`, appears three
times in the tree (`python/ray/train/torch/config.py:164` and two
example scripts), and all three are plain Python calls rather than
Sphinx cross-references. 2.9 moved the documented object to
`torch.cuda.memory.empty_cache`, which is irrelevant because nothing
cross-references it.

## Related changes

Three documentation corrections in the same directory, bundled here
rather than opened as separate trivial PRs:

- `_intersphinx/refresh.py` said four targets set an explicit inventory
URL. #65644 dropped `scipy`, leaving three.
- `_intersphinx/README.md` recorded the old `docs/2.7/` pin.
- `_intersphinx/README.md` gained a "Before you drop a target" section.
It records the reftype rules that decide whether dropping a target is
safe: third-party annotations resolve as `py:class`, which
`nitpick_ignore_regex` blanket-ignores, while `:external:` and explicit
`py:obj`/`py:func`/`py:meth`/`py:mod` references aren't covered. It also
records why `python` can never be dropped, since `parse_reftarget`
assigns `obj` rather than `class` to `None` and to `typing.*`
annotations. That reasoning came out of #65644 and is worth having where
someone editing the target list will see it.

## Related issue number

Follows #63038 (which established the pin), #64977 (which committed the
snapshots), and #65644 (which reduced the target set to 18).

Not a duplicate: no open PR or issue touches the torch intersphinx pin.
Checked `gh pr list --repo ray-project/ray --state open --search
"intersphinx"`, the same for `"torch pin objects.inv"`, and the
open-issue search for `"intersphinx torch inventory"`. The one open PR
in this area, #65646, changes CI step routing for the directory and
doesn't touch `conf.py` or the snapshots.

## Checks

- [x] I've signed off every commit (`-s`).
- [x] I've included any doc changes needed for the change.
- Testing strategy
   - [ ] Unit tests
   - [ ] Release tests
- [x] The Read the Docs `-W` build on this PR is the gate that exercises
`intersphinx_mapping`, and it's what would surface a removed symbol as a
hard failure. Locally I ran `python doc/source/_intersphinx/refresh.py
torch`, which fetched 162,579 bytes from the new URL and confirmed the
script picks the pin up out of `conf.py`. I then ran the inventory diff
described above against the previous snapshot. I did not run a full
local Sphinx build.

AI assistance was used for this change.

Signed-off-by: Douglas Strodtman <[email protected]>
@elliot-barn
elliot-barn merged commit 16baf8a into master Aug 21, 2026
6 checks passed
@elliot-barn
elliot-barn deleted the doc-1582-intersphinx-ci-rule branch August 21, 2026 17:27
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…-project#65647)

## Why are these changes needed?

`torch` is one of the four intersphinx targets that set an explicit
inventory URL instead of deriving it from `base_url`. ray-project#63038 pinned it
to `docs/2.7/objects.inv` to match `torch==2.7.0` in
`python/requirements/ml/dl-{cpu,gpu}-requirements.txt`, so
cross-references would only resolve to symbols the version Ray ships
actually has. That PR flagged the tradeoff explicitly: the URL has to
bump alongside the requirements pin.

Those requirements now pin `torch==2.9.0`. The inventory pin stayed at
2.7, so two minor versions of torch API surface stopped resolving.
`torch` resolves 96 cross-references, the fourth-highest of the 18
targets remaining after ray-project#65644, so it's the pin worth keeping current.

This repoints the pin to `docs/2.9/objects.inv` and re-runs
`_intersphinx/refresh.py torch`. The snapshot is what actually resolves
references since ray-project#64977, so bumping the URL alone would have changed
only the unused fallback. `base_url` stays at `docs/stable/`, so the
link URLs Sphinx emits don't change.

A comment now records that the pin tracks the requirements file, since
that coupling is the thing that went unmaintained.

### Verification that 2.9 doesn't drop a symbol Ray references

Bumping a pinned inventory forward can break the `-W` build if upstream
removed a symbol Ray cross-references, so I checked before pushing
rather than leaving it to CI:

- The 2.7 snapshot carried 11,851 objects, the 2.9 snapshot carries
13,139. Between them, 1,874 objects were added and 586 removed.
- 140 of the 586 removals are in the `torch.*` Python namespace. The
rest are documentation page anchors and C++ index entries.
- Of those 140, all but one sit under `torch.ao.ns._numeric_suite`, a
private module. Nothing under `python/ray` or `doc/source` references
any of them.
- The single remaining name, `torch.cuda.empty_cache`, appears three
times in the tree (`python/ray/train/torch/config.py:164` and two
example scripts), and all three are plain Python calls rather than
Sphinx cross-references. 2.9 moved the documented object to
`torch.cuda.memory.empty_cache`, which is irrelevant because nothing
cross-references it.

## Related changes

Three documentation corrections in the same directory, bundled here
rather than opened as separate trivial PRs:

- `_intersphinx/refresh.py` said four targets set an explicit inventory
URL. ray-project#65644 dropped `scipy`, leaving three.
- `_intersphinx/README.md` recorded the old `docs/2.7/` pin.
- `_intersphinx/README.md` gained a "Before you drop a target" section.
It records the reftype rules that decide whether dropping a target is
safe: third-party annotations resolve as `py:class`, which
`nitpick_ignore_regex` blanket-ignores, while `:external:` and explicit
`py:obj`/`py:func`/`py:meth`/`py:mod` references aren't covered. It also
records why `python` can never be dropped, since `parse_reftarget`
assigns `obj` rather than `class` to `None` and to `typing.*`
annotations. That reasoning came out of ray-project#65644 and is worth having where
someone editing the target list will see it.

## Related issue number

Follows ray-project#63038 (which established the pin), ray-project#64977 (which committed the
snapshots), and ray-project#65644 (which reduced the target set to 18).

Not a duplicate: no open PR or issue touches the torch intersphinx pin.
Checked `gh pr list --repo ray-project/ray --state open --search
"intersphinx"`, the same for `"torch pin objects.inv"`, and the
open-issue search for `"intersphinx torch inventory"`. The one open PR
in this area, ray-project#65646, changes CI step routing for the directory and
doesn't touch `conf.py` or the snapshots.

## Checks

- [x] I've signed off every commit (`-s`).
- [x] I've included any doc changes needed for the change.
- Testing strategy
   - [ ] Unit tests
   - [ ] Release tests
- [x] The Read the Docs `-W` build on this PR is the gate that exercises
`intersphinx_mapping`, and it's what would surface a removed symbol as a
hard failure. Locally I ran `python doc/source/_intersphinx/refresh.py
torch`, which fetched 162,579 bytes from the new URL and confirmed the
script picks the pin up out of `conf.py`. I then ran the inventory diff
described above against the previous snapshot. I did not run a full
local Sphinx build.

AI assistance was used for this change.

Signed-off-by: Douglas Strodtman <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…step (ray-project#65646)

## Why are these changes needed?

Editing anything in `doc/source/_intersphinx/` starts `:ray: core: docs
example tests`, and there is nothing in that directory for the step to
run.

`refresh.py` matches the `doc/*.py` catch-all near the bottom of
`.buildkite/test.rules.txt`. Patterns there go through `fnmatch`, whose
`*` crosses `/`, so `doc/*.py` claims
`doc/source/_intersphinx/refresh.py` and emits `core_doc`. That selects
a `large` instance running three `test_in_docker` invocations over
`//python/ray/...` and `//doc/...` on `corebuild-py3.10`. Nothing
imports that script, no bazel target names the directory, and
`exclude_patterns` in `conf.py` drops `_intersphinx/**` from the source
tree, so the step has no target there to execute. Observed on ray-project#65644,
whose only `.py` change outside `conf.py` is a one-line edit to
`refresh.py`.

The `.inv` snapshots have the opposite problem. They match neither the
prose-and-image skip near the top nor the `.py`/`.ipynb` catch-all, so
they fall through to the broad `doc/` skip and emit no tag at all. They
are live build inputs: `intersphinx_mapping` resolves each target's
local `_intersphinx/<name>.inv` ahead of its remote URL, so a truncated
or stale snapshot changes what cross-references resolve. Refreshing one,
which is the routine maintenance this directory exists for, triggered no
documentation build.

## What this changes

One directory rule ahead of the catch-all, routing
`doc/source/_intersphinx/` to `doc` and nothing else. `README.md` is
already claimed by the `doc/*.md` prose rule further up, so the rule
only ever sees the snapshots and the script.

`refresh.py` rides along on the directory rule rather than getting its
own skip. `doc` is cheap, the directory is small and homogeneous, and a
per-file split here would rot the next time the directory grows a
helper.

On premerge, `doc` selects `doc: test llms.txt extension`; `doc: build`
and `doc: linkcheck` both carry `skip-on-premerge`. So the PR-time gate
for an inventory change remains the Read the Docs `-W` build, which runs
outside tag selection entirely. What this rule buys is postmerge
documentation-build coverage where there was none.

`conf.py` is not implicated. It matches the autodoc-machinery block and
emits `doc doc_api`, which is correct and cheap.

## Related issue number

Diagnosed while reviewing CI on ray-project#65644.

## Checks

- [x] I've signed off every commit (`-s`).
- [x] I've included any doc changes needed for the change. The rationale
lives in the rule comment, per the convention in this file.
- Testing strategy
- [x] Unit tests. Three cases added to `.buildkite/test.rules.test.txt`
covering a snapshot, `refresh.py`, and the unrouted `README.md`. All 131
cases in that file and both `//ci/pipeline:test_doc_api_rules_sync`
cases pass.
   - [ ] Release tests
- [x] Differential sweep. Evaluated both rules files before and after
against every tracked file in the repo. The only tag changes are the 28
files under `doc/source/_intersphinx/`: `refresh.py` moves from
`core_doc` to `doc`, and the 26 snapshots plus `.gitattributes` move
from no tag to `doc`. Nothing else in the tree changes, which is the
check that matters for a file that decides CI for every PR.

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

Labels

go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants