Skip to content

[docs] generate heading anchors for h4 headings - #65240

Merged
dstrodtman merged 1 commit into
ray-project:masterfrom
dstrodtman:doc-1437-h4-heading-anchors
Aug 6, 2026
Merged

dstrodtman merged 1 commit into
ray-project:masterfrom
dstrodtman:doc-1437-h4-heading-anchors

Conversation

@dstrodtman

Copy link
Copy Markdown
Contributor

Why are these changes needed?

myst_heading_anchors is currently 3, so MyST generates implicit anchors for h1–h3 headings only. Markdown pages that link to their own level-4 headings emit myst.xref_missing, and doc/Makefile builds with -W, so those links fail the build rather than degrading to a dead link.

This raises the setting to 4.

The motivating case is vendoring KubeRay's generated CRD API reference into the Ray docs. crd-ref-docs renders every CRD type as an h4 heading and cross-links types by anchor ([AuthMode](#authmode)), so that page cannot build under the current setting. The change is independently useful for any page that links to its own h4 headings.

Related issue number

N/A — no existing issue or open PR covers this. Checked with:

gh pr list --repo ray-project/ray --state open --search "myst_heading_anchors"
gh pr list --repo ray-project/ray --state open --search "heading anchors in:title"

Both returned no results.

Checks

Scope. One line in doc/source/conf.py. doc tag only.

Blast radius. 138 h4 headings across 34 markdown files under doc/source, producing 132 distinct new anchor slugs. Enumerated three collision classes and checked each:

Class Count Sites
h4 slug matches an explicit (target)= label in the same file 3 ray-observability/user-guides/profiling.md (×2), cluster/kubernetes/k8s-ecosystem/kueue.md
Duplicate h4 slug within one file 2 serve/tutorials/video-analysis/README.md, ray-security/token-auth.md
h4 slug shadows an existing h1–h3 anchor in the same file 1 cluster/kubernetes/user-guides/config.md

Test. Built a minimal Sphinx project reproducing all three classes with well-formed heading nesting (so myst.header level-jump warnings can't confound the result), against the pinned docs versions — sphinx 8.2.3, myst-parser 5.1.0 — with nitpicky = True and -W --keep-going. Ran it twice, changing only myst_heading_anchors:

myst_heading_anchors = 3
  WARNING: local id not found in doc 'explicit': 'profiling-result' [myst.xref_missing]
  WARNING: local id not found in doc 'dupe': 'step-1-generate-a-token' [myst.xref_missing]
  build finished with problems, 2 warnings (with warnings treated as errors).
  exit 1

myst_heading_anchors = 4
  build succeeded.
  exit 0

None of the three collision classes produces a warning. MyST resolves colliding slugs by assigning fallback ids (id1, id2) to the later heading — silently, with no duplicate-label or ambiguity warning. So the change removes build errors and introduces none.

One consequence worth recording for reviewers: because collisions resolve silently, a page with two identically-named h4 headings gets one real anchor and one opaque idN. Any in-page link to the second heading resolves to the first. That is pre-existing behavior for h1–h3 and is not introduced here, but it becomes reachable at h4.

A full make rtd build was not run locally; the docs CI build on this PR is the check for that.

AI assistance

AI assistance (Claude Code) was used for the collision analysis, the control experiment, and drafting this description. I reviewed the one-line change and the test methodology and can defend both.

Raise myst_heading_anchors from 3 to 4 so MyST generates implicit
anchors for level-4 headings.

Markdown pages that link to their own h4 headings currently emit
myst.xref_missing, which the docs build turns into an error via -W.
Generating anchors one level deeper resolves those links.

Verified against sphinx 8.2.3 / myst-parser 5.1.0 (the pinned docs
versions): with anchors=3 a link to an h4 fails the build; with
anchors=4 it succeeds. No duplicate-label or ambiguity warnings are
introduced -- MyST silently assigns fallback ids to colliding slugs.

Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman
dstrodtman requested review from a team as code owners August 5, 2026 20:36

@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 Sphinx configuration in doc/source/conf.py by increasing the myst_heading_anchors depth from 3 to 4. There are no review comments, and I have no additional feedback to provide.

@dstrodtman dstrodtman added go add ONLY when ready to merge, run all tests docs-go RtD-only checks for docs-only changes. Doesn't run full library doc-test suites. labels Aug 5, 2026

@ronny-anyscale ronny-anyscale 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.

pop

@ray-gardener ray-gardener Bot added docs An issue or change related to documentation core Issues that should be addressed in Ray Core labels Aug 6, 2026
@dstrodtman
dstrodtman merged commit f606a9f into ray-project:master Aug 6, 2026
6 checks passed
Artimislyy pushed a commit to Artimislyy/ray that referenced this pull request Aug 11, 2026
## Why are these changes needed?

`myst_heading_anchors` is currently `3`, so MyST generates implicit
anchors for h1–h3 headings only. Markdown pages that link to their own
level-4 headings emit `myst.xref_missing`, and `doc/Makefile` builds
with `-W`, so those links fail the build rather than degrading to a dead
link.

This raises the setting to `4`.

The motivating case is vendoring KubeRay's generated CRD API reference
into the Ray docs. `crd-ref-docs` renders every CRD type as an h4
heading and cross-links types by anchor (`[AuthMode](#authmode)`), so
that page cannot build under the current setting. The change is
independently useful for any page that links to its own h4 headings.

## Related issue number

N/A — no existing issue or open PR covers this. Checked with:

```
gh pr list --repo ray-project/ray --state open --search "myst_heading_anchors"
gh pr list --repo ray-project/ray --state open --search "heading anchors in:title"
```

Both returned no results.

## Checks

**Scope.** One line in `doc/source/conf.py`. `doc` tag only.

**Blast radius.** 138 h4 headings across 34 markdown files under
`doc/source`, producing 132 distinct new anchor slugs. Enumerated three
collision classes and checked each:

| Class | Count | Sites |
| --- | --- | --- |
| h4 slug matches an explicit `(target)=` label in the same file | 3 |
`ray-observability/user-guides/profiling.md` (×2),
`cluster/kubernetes/k8s-ecosystem/kueue.md` |
| Duplicate h4 slug within one file | 2 |
`serve/tutorials/video-analysis/README.md`, `ray-security/token-auth.md`
|
| h4 slug shadows an existing h1–h3 anchor in the same file | 1 |
`cluster/kubernetes/user-guides/config.md` |

**Test.** Built a minimal Sphinx project reproducing all three classes
with well-formed heading nesting (so `myst.header` level-jump warnings
can't confound the result), against the pinned docs versions — sphinx
8.2.3, myst-parser 5.1.0 — with `nitpicky = True` and `-W --keep-going`.
Ran it twice, changing only `myst_heading_anchors`:

```
myst_heading_anchors = 3
  WARNING: local id not found in doc 'explicit': 'profiling-result' [myst.xref_missing]
  WARNING: local id not found in doc 'dupe': 'step-1-generate-a-token' [myst.xref_missing]
  build finished with problems, 2 warnings (with warnings treated as errors).
  exit 1

myst_heading_anchors = 4
  build succeeded.
  exit 0
```

None of the three collision classes produces a warning. MyST resolves
colliding slugs by assigning fallback ids (`id1`, `id2`) to the later
heading — silently, with no duplicate-label or ambiguity warning. So the
change removes build errors and introduces none.

One consequence worth recording for reviewers: because collisions
resolve silently, a page with two identically-named h4 headings gets one
real anchor and one opaque `idN`. Any in-page link to the second heading
resolves to the first. That is pre-existing behavior for h1–h3 and is
not introduced here, but it becomes reachable at h4.

A full `make rtd` build was not run locally; the docs CI build on this
PR is the check for that.

## AI assistance

AI assistance (Claude Code) was used for the collision analysis, the
control experiment, and drafting this description. I reviewed the
one-line change and the test methodology and can defend both.

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

The KubeRay CRD API reference — the field-level reference for
`RayCluster`, `RayJob`, `RayService`, and `RayCronJob` — is published
only on the MkDocs site at `ray-project.github.io/kuberay`. That site
has two problems that compound each other:

- Its `mkdocs.yml` `nav:` block contains only `index.md`. The API
reference builds and serves but appears nowhere in site navigation, so
it's reachable only by direct URL, site search, or a search engine.
- Its landing page states that documentation has moved to
`ray-project/ray`.

Meanwhile `doc/source/cluster/kubernetes/references.md` here is a
~14-line stub whose entire substance is an outbound link to that page.
So Ray's documented answer for "what fields does a RayCluster support?"
is a link off-site to a nav-hidden page on a site that says it holds no
documentation. It's also the most actively updated file in the KubeRay
`docs/` tree — recent CRD features (`AuthOptions`, `GcsEmbeddedStorage`,
`NetworkPolicyRules`, `IngressOptions`, `HistoryServerOptions`,
`RayCronJob`) all extend it.

This vendors the generated reference into the Ray docs and repoints the
inbound links at it.

## What changed

| File | Change |
| --- | --- |
| `doc/source/cluster/kubernetes/references/api.md` | **New.** Vendored
generated reference, `ray.io/v1` only, from the `v1.6.2` release tag. |
| `doc/source/cluster/kubernetes/references.md` | Toctree entry; the
outbound link becomes a `{ref}`; added a note that v1alpha1 is
deprecated. |
| `doc/source/cluster/kubernetes/getting-started/rayjob-quick-start.md`
| Outbound link → `{ref}`. |
| `doc/source/cluster/kubernetes/user-guides/gcp-gke-tpu-cluster.md` |
Outbound link → the operator installation page (see below). |

Content-only: every changed file is under `doc/`, so the `docs-go`
label's scope guard (`ci/lint/validate_docs_go_scope.sh`) passes. An
earlier revision of this PR also added a `.github/CODEOWNERS` entry for
the generated file; it's dropped, both because it would have failed that
guard and because the existing `/doc/source/cluster/kubernetes/` rule
already assigns `@andrewsykim @ray-project/ray-core
@ray-project/ray-docs` — a more specific rule would have *narrowed*
ownership by dropping ray-core. The generated-file header is what deters
hand-edits.

### How the source artifact is produced

`docs/reference/api.md` in `ray-project/kuberay` is a committed build
artifact, not a hand-written page. `make api-docs` runs
`elastic/crd-ref-docs` (pinned v0.2.0) over the Go CRD types in
`ray-operator/apis/ray/`. The `ray-operator-verify-api-docs` job in
`.github/workflows/consistency-check.yaml` regenerates and diffs it on
every push and PR to `master` **and `release-*`**, failing on drift.

That CI job is what makes a vendored copy viable: freshness is already
enforced upstream, so the copy has a single well-defined source of
truth. Because the job covers `release-*` too, a release tag's `api.md`
is equally guaranteed consistent with that branch's CRD types.

### Why the `v1.6.2` release tag, not `master`

Per @andrewsykim's review, this now vendors from the latest KubeRay
release rather than from `master`. `master` carries CRD surface that no
release ships — diffing `docs/reference/api.md` at `v1.6.2` against
`master` is **+247 lines**, adding twelve types that exist in no
release:

`CollectorOptions`, `GcsEmbeddedStorage`, `GCSStorageDeletionPolicy`,
`GcsFaultToleranceBackend`, `HistoryServerOptions`, `IngressOptions`,
`IngressPathType`, `NetworkPolicyConfig`, `NetworkPolicyMode`,
`NetworkPolicyRules`, `TLSOptions`, `WorkerGroupNetworkPolicyRules`

plus field-level additions such as `priority`, `suspend`, `timeZone`,
and `command`/`args`.

The source ref is the **tag**, not the release branch head:
`release-1.6` is currently one commit ahead of `v1.6.2`. The page body
now states the KubeRay version, so the fields a reader sees are
attributable to a version they can install; the generated-file comment
records the tag and its commit SHA.

### Why `ray.io/v1` only

The upstream artifact documents both `ray.io/v1` and `ray.io/v1alpha1`.
This copy carries only v1, for two reasons.

**v1alpha1 is deprecated and on a removal runway.** It hasn't been the
storage version since v1.0 (October 2023), receives no new fields, and
kuberay-project/kuberay#5124 tracks its removal. Every CRD feature added
since December 2023 is v1-only.

**Carrying it would import a silent correctness bug.** `crd-ref-docs`
derives anchors from the type name alone, and eleven type names are
defined in both API versions (`RayClusterSpec`, `WorkerGroupSpec`,
`RayJob`, `RayService`, `AutoscalerOptions`, ...). Only the v1 heading
owns the slug, so every v1alpha1 cross-link resolves to the v1
definition — with no warning at generation time. The definitions differ
substantially (`RayClusterSpec` has 14 fields in v1, 7 in v1alpha1), so
a reader following a v1alpha1 link lands on a table advertising fields
that don't exist in that version. Filed upstream as
kuberay-project/kuberay#5091.

Dropping the section resolves the collision rather than papering over
it. The stripping step is written to become a silent no-op once upstream
drops v1alpha1 from generation.

### The gcp-gke-tpu-cluster.md link

This one pointed at the MkDocs `/deploy/helm/` page, not the API
reference. That page documents Helm *chart values*, while the sentence
introducing it is about *installing* KubeRay. It's repointed at
`kuberay-operator-installation.md`, which is the maintained page for
what the sentence actually promises. The `helm repo add kuberay
https://ray-project.github.io/kuberay-helm/` commands elsewhere in the
docs are untouched — that's the Helm chart repository, a different host
from the docs site.

## Checks

**Anchor resolution.** The vendored page has 34 h1–h4 headings producing
34 distinct slugs (zero collisions, confirming the v1-only decision
eliminates that class) and 67 in-page anchor links across 31 distinct
targets, all resolving.

**Build.** Built the page in a minimal Sphinx project against the pinned
docs versions — sphinx 8.2.3, myst-parser 5.1.0 — with
`myst_heading_anchors = 4`, `nitpicky = True`, and `-W --keep-going`:

```
build succeeded.
exit 0
```

Zero warnings. Inspected the rendered HTML: all 134 internal `href`s
have a matching `id`, and none resolves to a docutils fallback `idN`.

This page depends on #65240 (h4 heading anchors), which has merged.
`crd-ref-docs` renders every CRD type as an h4 and cross-links types by
anchor, so the page could not build under the previous
`myst_heading_anchors = 3`.

A full `make rtd` build was not run locally; the docs CI build on this
PR is the check for that.

## Follow-ups (not in this PR)

**The sync job.** It diffs the processed upstream output against the
copy committed here — not against the previous upstream version — so
it's idempotent and self-healing: an unmerged sync PR gets updated
rather than duplicated, and a hand-edit here gets corrected on the next
run. Two open design points, discussed in the review thread:

- *What triggers it.* The semantically correct signal is the KubeRay
`release` event with `types: [released]`, which fires only for
non-prerelease publishes (every `-rc.N` tag is flagged `prerelease:
true`). A `push: tags` trigger would fire at Step 3 of the release
process, before images, charts, and validation. Until the workflow can
live in a repo that receives KubeRay events, the equivalent is a
scheduled poll of `GET /repos/ray-project/kuberay/releases/latest`,
which returns the maintainer-designated latest stable and so isn't
fooled by interleaved release lines (`v1.5.2` and `v1.6.1` published 22
seconds apart).
- *Whether Ray master should also carry a dev reference* built from
KubeRay `master`, alongside the stable one. Open question for the
maintainers.

**Remaining MkDocs-only content.** Several other pages on the MkDocs
site have no equivalent in the Ray docs — the Helm chart values tables,
additional `rayStartParams` coverage (`--no-monitor` and the autoscaler
READONLY rationale, `--block`, `--address` FQDN construction), and the
image tagging and registry scheme. Being handled separately.

## Related issue number

Depends on #65240 (merged). Related upstream: kuberay-project/kuberay#5091,
kuberay-project/kuberay#5124.

## AI assistance

AI assistance (Claude Code) was used for the anchor-collision analysis,
the release-mechanics analysis, the build verification, the
post-processing script, and drafting this description. I reviewed the
vendored content and the link changes and can defend both.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
## Why are these changes needed?

`myst_heading_anchors` is currently `3`, so MyST generates implicit
anchors for h1–h3 headings only. Markdown pages that link to their own
level-4 headings emit `myst.xref_missing`, and `doc/Makefile` builds
with `-W`, so those links fail the build rather than degrading to a dead
link.

This raises the setting to `4`.

The motivating case is vendoring KubeRay's generated CRD API reference
into the Ray docs. `crd-ref-docs` renders every CRD type as an h4
heading and cross-links types by anchor (`[AuthMode](#authmode)`), so
that page cannot build under the current setting. The change is
independently useful for any page that links to its own h4 headings.

## Related issue number

N/A — no existing issue or open PR covers this. Checked with:

```
gh pr list --repo ray-project/ray --state open --search "myst_heading_anchors"
gh pr list --repo ray-project/ray --state open --search "heading anchors in:title"
```

Both returned no results.

## Checks

**Scope.** One line in `doc/source/conf.py`. `doc` tag only.

**Blast radius.** 138 h4 headings across 34 markdown files under
`doc/source`, producing 132 distinct new anchor slugs. Enumerated three
collision classes and checked each:

| Class | Count | Sites |
| --- | --- | --- |
| h4 slug matches an explicit `(target)=` label in the same file | 3 |
`ray-observability/user-guides/profiling.md` (×2),
`cluster/kubernetes/k8s-ecosystem/kueue.md` |
| Duplicate h4 slug within one file | 2 |
`serve/tutorials/video-analysis/README.md`, `ray-security/token-auth.md`
|
| h4 slug shadows an existing h1–h3 anchor in the same file | 1 |
`cluster/kubernetes/user-guides/config.md` |

**Test.** Built a minimal Sphinx project reproducing all three classes
with well-formed heading nesting (so `myst.header` level-jump warnings
can't confound the result), against the pinned docs versions — sphinx
8.2.3, myst-parser 5.1.0 — with `nitpicky = True` and `-W --keep-going`.
Ran it twice, changing only `myst_heading_anchors`:

```
myst_heading_anchors = 3
  WARNING: local id not found in doc 'explicit': 'profiling-result' [myst.xref_missing]
  WARNING: local id not found in doc 'dupe': 'step-1-generate-a-token' [myst.xref_missing]
  build finished with problems, 2 warnings (with warnings treated as errors).
  exit 1

myst_heading_anchors = 4
  build succeeded.
  exit 0
```

None of the three collision classes produces a warning. MyST resolves
colliding slugs by assigning fallback ids (`id1`, `id2`) to the later
heading — silently, with no duplicate-label or ambiguity warning. So the
change removes build errors and introduces none.

One consequence worth recording for reviewers: because collisions
resolve silently, a page with two identically-named h4 headings gets one
real anchor and one opaque `idN`. Any in-page link to the second heading
resolves to the first. That is pre-existing behavior for h1–h3 and is
not introduced here, but it becomes reachable at h4.

A full `make rtd` build was not run locally; the docs CI build on this
PR is the check for that.

## AI assistance

AI assistance (Claude Code) was used for the collision analysis, the
control experiment, and drafting this description. I reviewed the
one-line change and the test methodology and can defend both.

Signed-off-by: Douglas Strodtman <[email protected]>
Signed-off-by: 400Ping <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…oject#65428)

## Why are these changes needed?

The KubeRay CRD API reference — the field-level reference for
`RayCluster`, `RayJob`, `RayService`, and `RayCronJob` — is published
only on the MkDocs site at `ray-project.github.io/kuberay`. That site
has two problems that compound each other:

- Its `mkdocs.yml` `nav:` block contains only `index.md`. The API
reference builds and serves but appears nowhere in site navigation, so
it's reachable only by direct URL, site search, or a search engine.
- Its landing page states that documentation has moved to
`ray-project/ray`.

Meanwhile `doc/source/cluster/kubernetes/references.md` here is a
~14-line stub whose entire substance is an outbound link to that page.
So Ray's documented answer for "what fields does a RayCluster support?"
is a link off-site to a nav-hidden page on a site that says it holds no
documentation. It's also the most actively updated file in the KubeRay
`docs/` tree — recent CRD features (`AuthOptions`, `GcsEmbeddedStorage`,
`NetworkPolicyRules`, `IngressOptions`, `HistoryServerOptions`,
`RayCronJob`) all extend it.

This vendors the generated reference into the Ray docs and repoints the
inbound links at it.

## What changed

| File | Change |
| --- | --- |
| `doc/source/cluster/kubernetes/references/api.md` | **New.** Vendored
generated reference, `ray.io/v1` only, from the `v1.6.2` release tag. |
| `doc/source/cluster/kubernetes/references.md` | Toctree entry; the
outbound link becomes a `{ref}`; added a note that v1alpha1 is
deprecated. |
| `doc/source/cluster/kubernetes/getting-started/rayjob-quick-start.md`
| Outbound link → `{ref}`. |
| `doc/source/cluster/kubernetes/user-guides/gcp-gke-tpu-cluster.md` |
Outbound link → the operator installation page (see below). |

Content-only: every changed file is under `doc/`, so the `docs-go`
label's scope guard (`ci/lint/validate_docs_go_scope.sh`) passes. An
earlier revision of this PR also added a `.github/CODEOWNERS` entry for
the generated file; it's dropped, both because it would have failed that
guard and because the existing `/doc/source/cluster/kubernetes/` rule
already assigns `@andrewsykim @ray-project/ray-core
@ray-project/ray-docs` — a more specific rule would have *narrowed*
ownership by dropping ray-core. The generated-file header is what deters
hand-edits.

### How the source artifact is produced

`docs/reference/api.md` in `ray-project/kuberay` is a committed build
artifact, not a hand-written page. `make api-docs` runs
`elastic/crd-ref-docs` (pinned v0.2.0) over the Go CRD types in
`ray-operator/apis/ray/`. The `ray-operator-verify-api-docs` job in
`.github/workflows/consistency-check.yaml` regenerates and diffs it on
every push and PR to `master` **and `release-*`**, failing on drift.

That CI job is what makes a vendored copy viable: freshness is already
enforced upstream, so the copy has a single well-defined source of
truth. Because the job covers `release-*` too, a release tag's `api.md`
is equally guaranteed consistent with that branch's CRD types.

### Why the `v1.6.2` release tag, not `master`

Per @andrewsykim's review, this now vendors from the latest KubeRay
release rather than from `master`. `master` carries CRD surface that no
release ships — diffing `docs/reference/api.md` at `v1.6.2` against
`master` is **+247 lines**, adding twelve types that exist in no
release:

`CollectorOptions`, `GcsEmbeddedStorage`, `GCSStorageDeletionPolicy`,
`GcsFaultToleranceBackend`, `HistoryServerOptions`, `IngressOptions`,
`IngressPathType`, `NetworkPolicyConfig`, `NetworkPolicyMode`,
`NetworkPolicyRules`, `TLSOptions`, `WorkerGroupNetworkPolicyRules`

plus field-level additions such as `priority`, `suspend`, `timeZone`,
and `command`/`args`.

The source ref is the **tag**, not the release branch head:
`release-1.6` is currently one commit ahead of `v1.6.2`. The page body
now states the KubeRay version, so the fields a reader sees are
attributable to a version they can install; the generated-file comment
records the tag and its commit SHA.

### Why `ray.io/v1` only

The upstream artifact documents both `ray.io/v1` and `ray.io/v1alpha1`.
This copy carries only v1, for two reasons.

**v1alpha1 is deprecated and on a removal runway.** It hasn't been the
storage version since v1.0 (October 2023), receives no new fields, and
kuberay-project/kuberay#5124 tracks its removal. Every CRD feature added
since December 2023 is v1-only.

**Carrying it would import a silent correctness bug.** `crd-ref-docs`
derives anchors from the type name alone, and eleven type names are
defined in both API versions (`RayClusterSpec`, `WorkerGroupSpec`,
`RayJob`, `RayService`, `AutoscalerOptions`, ...). Only the v1 heading
owns the slug, so every v1alpha1 cross-link resolves to the v1
definition — with no warning at generation time. The definitions differ
substantially (`RayClusterSpec` has 14 fields in v1, 7 in v1alpha1), so
a reader following a v1alpha1 link lands on a table advertising fields
that don't exist in that version. Filed upstream as
kuberay-project/kuberay#5091.

Dropping the section resolves the collision rather than papering over
it. The stripping step is written to become a silent no-op once upstream
drops v1alpha1 from generation.

### The gcp-gke-tpu-cluster.md link

This one pointed at the MkDocs `/deploy/helm/` page, not the API
reference. That page documents Helm *chart values*, while the sentence
introducing it is about *installing* KubeRay. It's repointed at
`kuberay-operator-installation.md`, which is the maintained page for
what the sentence actually promises. The `helm repo add kuberay
https://ray-project.github.io/kuberay-helm/` commands elsewhere in the
docs are untouched — that's the Helm chart repository, a different host
from the docs site.

## Checks

**Anchor resolution.** The vendored page has 34 h1–h4 headings producing
34 distinct slugs (zero collisions, confirming the v1-only decision
eliminates that class) and 67 in-page anchor links across 31 distinct
targets, all resolving.

**Build.** Built the page in a minimal Sphinx project against the pinned
docs versions — sphinx 8.2.3, myst-parser 5.1.0 — with
`myst_heading_anchors = 4`, `nitpicky = True`, and `-W --keep-going`:

```
build succeeded.
exit 0
```

Zero warnings. Inspected the rendered HTML: all 134 internal `href`s
have a matching `id`, and none resolves to a docutils fallback `idN`.

This page depends on ray-project#65240 (h4 heading anchors), which has merged.
`crd-ref-docs` renders every CRD type as an h4 and cross-links types by
anchor, so the page could not build under the previous
`myst_heading_anchors = 3`.

A full `make rtd` build was not run locally; the docs CI build on this
PR is the check for that.

## Follow-ups (not in this PR)

**The sync job.** It diffs the processed upstream output against the
copy committed here — not against the previous upstream version — so
it's idempotent and self-healing: an unmerged sync PR gets updated
rather than duplicated, and a hand-edit here gets corrected on the next
run. Two open design points, discussed in the review thread:

- *What triggers it.* The semantically correct signal is the KubeRay
`release` event with `types: [released]`, which fires only for
non-prerelease publishes (every `-rc.N` tag is flagged `prerelease:
true`). A `push: tags` trigger would fire at Step 3 of the release
process, before images, charts, and validation. Until the workflow can
live in a repo that receives KubeRay events, the equivalent is a
scheduled poll of `GET /repos/ray-project/kuberay/releases/latest`,
which returns the maintainer-designated latest stable and so isn't
fooled by interleaved release lines (`v1.5.2` and `v1.6.1` published 22
seconds apart).
- *Whether Ray master should also carry a dev reference* built from
KubeRay `master`, alongside the stable one. Open question for the
maintainers.

**Remaining MkDocs-only content.** Several other pages on the MkDocs
site have no equivalent in the Ray docs — the Helm chart values tables,
additional `rayStartParams` coverage (`--no-monitor` and the autoscaler
READONLY rationale, `--block`, `--address` FQDN construction), and the
image tagging and registry scheme. Being handled separately.

## Related issue number

Depends on ray-project#65240 (merged). Related upstream: kuberay-project/kuberay#5091,
kuberay-project/kuberay#5124.

## AI assistance

AI assistance (Claude Code) was used for the anchor-collision analysis,
the release-mechanics analysis, the build verification, the
post-processing script, and drafting this description. I reviewed the
vendored content and the link changes and can defend both.

---------

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
## Why are these changes needed?

`myst_heading_anchors` is currently `3`, so MyST generates implicit
anchors for h1–h3 headings only. Markdown pages that link to their own
level-4 headings emit `myst.xref_missing`, and `doc/Makefile` builds
with `-W`, so those links fail the build rather than degrading to a dead
link.

This raises the setting to `4`.

The motivating case is vendoring KubeRay's generated CRD API reference
into the Ray docs. `crd-ref-docs` renders every CRD type as an h4
heading and cross-links types by anchor (`[AuthMode](#authmode)`), so
that page cannot build under the current setting. The change is
independently useful for any page that links to its own h4 headings.

## Related issue number

N/A — no existing issue or open PR covers this. Checked with:

```
gh pr list --repo ray-project/ray --state open --search "myst_heading_anchors"
gh pr list --repo ray-project/ray --state open --search "heading anchors in:title"
```

Both returned no results.

## Checks

**Scope.** One line in `doc/source/conf.py`. `doc` tag only.

**Blast radius.** 138 h4 headings across 34 markdown files under
`doc/source`, producing 132 distinct new anchor slugs. Enumerated three
collision classes and checked each:

| Class | Count | Sites |
| --- | --- | --- |
| h4 slug matches an explicit `(target)=` label in the same file | 3 |
`ray-observability/user-guides/profiling.md` (×2),
`cluster/kubernetes/k8s-ecosystem/kueue.md` |
| Duplicate h4 slug within one file | 2 |
`serve/tutorials/video-analysis/README.md`, `ray-security/token-auth.md`
|
| h4 slug shadows an existing h1–h3 anchor in the same file | 1 |
`cluster/kubernetes/user-guides/config.md` |

**Test.** Built a minimal Sphinx project reproducing all three classes
with well-formed heading nesting (so `myst.header` level-jump warnings
can't confound the result), against the pinned docs versions — sphinx
8.2.3, myst-parser 5.1.0 — with `nitpicky = True` and `-W --keep-going`.
Ran it twice, changing only `myst_heading_anchors`:

```
myst_heading_anchors = 3
  WARNING: local id not found in doc 'explicit': 'profiling-result' [myst.xref_missing]
  WARNING: local id not found in doc 'dupe': 'step-1-generate-a-token' [myst.xref_missing]
  build finished with problems, 2 warnings (with warnings treated as errors).
  exit 1

myst_heading_anchors = 4
  build succeeded.
  exit 0
```

None of the three collision classes produces a warning. MyST resolves
colliding slugs by assigning fallback ids (`id1`, `id2`) to the later
heading — silently, with no duplicate-label or ambiguity warning. So the
change removes build errors and introduces none.

One consequence worth recording for reviewers: because collisions
resolve silently, a page with two identically-named h4 headings gets one
real anchor and one opaque `idN`. Any in-page link to the second heading
resolves to the first. That is pre-existing behavior for h1–h3 and is
not introduced here, but it becomes reachable at h4.

A full `make rtd` build was not run locally; the docs CI build on this
PR is the check for that.

## AI assistance

AI assistance (Claude Code) was used for the collision analysis, the
control experiment, and drafting this description. I reviewed the
one-line change and the test methodology and can defend both.

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

## Why are these changes needed?

The KubeRay CRD API reference — the field-level reference for
`RayCluster`, `RayJob`, `RayService`, and `RayCronJob` — is published
only on the MkDocs site at `ray-project.github.io/kuberay`. That site
has two problems that compound each other:

- Its `mkdocs.yml` `nav:` block contains only `index.md`. The API
reference builds and serves but appears nowhere in site navigation, so
it's reachable only by direct URL, site search, or a search engine.
- Its landing page states that documentation has moved to
`ray-project/ray`.

Meanwhile `doc/source/cluster/kubernetes/references.md` here is a
~14-line stub whose entire substance is an outbound link to that page.
So Ray's documented answer for "what fields does a RayCluster support?"
is a link off-site to a nav-hidden page on a site that says it holds no
documentation. It's also the most actively updated file in the KubeRay
`docs/` tree — recent CRD features (`AuthOptions`, `GcsEmbeddedStorage`,
`NetworkPolicyRules`, `IngressOptions`, `HistoryServerOptions`,
`RayCronJob`) all extend it.

This vendors the generated reference into the Ray docs and repoints the
inbound links at it.

## What changed

| File | Change |
| --- | --- |
| `doc/source/cluster/kubernetes/references/api.md` | **New.** Vendored
generated reference, `ray.io/v1` only, from the `v1.6.2` release tag. |
| `doc/source/cluster/kubernetes/references.md` | Toctree entry; the
outbound link becomes a `{ref}`; added a note that v1alpha1 is
deprecated. |
| `doc/source/cluster/kubernetes/getting-started/rayjob-quick-start.md`
| Outbound link → `{ref}`. |
| `doc/source/cluster/kubernetes/user-guides/gcp-gke-tpu-cluster.md` |
Outbound link → the operator installation page (see below). |

Content-only: every changed file is under `doc/`, so the `docs-go`
label's scope guard (`ci/lint/validate_docs_go_scope.sh`) passes. An
earlier revision of this PR also added a `.github/CODEOWNERS` entry for
the generated file; it's dropped, both because it would have failed that
guard and because the existing `/doc/source/cluster/kubernetes/` rule
already assigns `@andrewsykim @ray-project/ray-core
@ray-project/ray-docs` — a more specific rule would have *narrowed*
ownership by dropping ray-core. The generated-file header is what deters
hand-edits.

### How the source artifact is produced

`docs/reference/api.md` in `ray-project/kuberay` is a committed build
artifact, not a hand-written page. `make api-docs` runs
`elastic/crd-ref-docs` (pinned v0.2.0) over the Go CRD types in
`ray-operator/apis/ray/`. The `ray-operator-verify-api-docs` job in
`.github/workflows/consistency-check.yaml` regenerates and diffs it on
every push and PR to `master` **and `release-*`**, failing on drift.

That CI job is what makes a vendored copy viable: freshness is already
enforced upstream, so the copy has a single well-defined source of
truth. Because the job covers `release-*` too, a release tag's `api.md`
is equally guaranteed consistent with that branch's CRD types.

### Why the `v1.6.2` release tag, not `master`

Per @andrewsykim's review, this now vendors from the latest KubeRay
release rather than from `master`. `master` carries CRD surface that no
release ships — diffing `docs/reference/api.md` at `v1.6.2` against
`master` is **+247 lines**, adding twelve types that exist in no
release:

`CollectorOptions`, `GcsEmbeddedStorage`, `GCSStorageDeletionPolicy`,
`GcsFaultToleranceBackend`, `HistoryServerOptions`, `IngressOptions`,
`IngressPathType`, `NetworkPolicyConfig`, `NetworkPolicyMode`,
`NetworkPolicyRules`, `TLSOptions`, `WorkerGroupNetworkPolicyRules`

plus field-level additions such as `priority`, `suspend`, `timeZone`,
and `command`/`args`.

The source ref is the **tag**, not the release branch head:
`release-1.6` is currently one commit ahead of `v1.6.2`. The page body
now states the KubeRay version, so the fields a reader sees are
attributable to a version they can install; the generated-file comment
records the tag and its commit SHA.

### Why `ray.io/v1` only

The upstream artifact documents both `ray.io/v1` and `ray.io/v1alpha1`.
This copy carries only v1, for two reasons.

**v1alpha1 is deprecated and on a removal runway.** It hasn't been the
storage version since v1.0 (October 2023), receives no new fields, and
kuberay-project/kuberay#5124 tracks its removal. Every CRD feature added
since December 2023 is v1-only.

**Carrying it would import a silent correctness bug.** `crd-ref-docs`
derives anchors from the type name alone, and eleven type names are
defined in both API versions (`RayClusterSpec`, `WorkerGroupSpec`,
`RayJob`, `RayService`, `AutoscalerOptions`, ...). Only the v1 heading
owns the slug, so every v1alpha1 cross-link resolves to the v1
definition — with no warning at generation time. The definitions differ
substantially (`RayClusterSpec` has 14 fields in v1, 7 in v1alpha1), so
a reader following a v1alpha1 link lands on a table advertising fields
that don't exist in that version. Filed upstream as
kuberay-project/kuberay#5091.

Dropping the section resolves the collision rather than papering over
it. The stripping step is written to become a silent no-op once upstream
drops v1alpha1 from generation.

### The gcp-gke-tpu-cluster.md link

This one pointed at the MkDocs `/deploy/helm/` page, not the API
reference. That page documents Helm *chart values*, while the sentence
introducing it is about *installing* KubeRay. It's repointed at
`kuberay-operator-installation.md`, which is the maintained page for
what the sentence actually promises. The `helm repo add kuberay
https://ray-project.github.io/kuberay-helm/` commands elsewhere in the
docs are untouched — that's the Helm chart repository, a different host
from the docs site.

## Checks

**Anchor resolution.** The vendored page has 34 h1–h4 headings producing
34 distinct slugs (zero collisions, confirming the v1-only decision
eliminates that class) and 67 in-page anchor links across 31 distinct
targets, all resolving.

**Build.** Built the page in a minimal Sphinx project against the pinned
docs versions — sphinx 8.2.3, myst-parser 5.1.0 — with
`myst_heading_anchors = 4`, `nitpicky = True`, and `-W --keep-going`:

```
build succeeded.
exit 0
```

Zero warnings. Inspected the rendered HTML: all 134 internal `href`s
have a matching `id`, and none resolves to a docutils fallback `idN`.

This page depends on ray-project#65240 (h4 heading anchors), which has merged.
`crd-ref-docs` renders every CRD type as an h4 and cross-links types by
anchor, so the page could not build under the previous
`myst_heading_anchors = 3`.

A full `make rtd` build was not run locally; the docs CI build on this
PR is the check for that.

## Follow-ups (not in this PR)

**The sync job.** It diffs the processed upstream output against the
copy committed here — not against the previous upstream version — so
it's idempotent and self-healing: an unmerged sync PR gets updated
rather than duplicated, and a hand-edit here gets corrected on the next
run. Two open design points, discussed in the review thread:

- *What triggers it.* The semantically correct signal is the KubeRay
`release` event with `types: [released]`, which fires only for
non-prerelease publishes (every `-rc.N` tag is flagged `prerelease:
true`). A `push: tags` trigger would fire at Step 3 of the release
process, before images, charts, and validation. Until the workflow can
live in a repo that receives KubeRay events, the equivalent is a
scheduled poll of `GET /repos/ray-project/kuberay/releases/latest`,
which returns the maintainer-designated latest stable and so isn't
fooled by interleaved release lines (`v1.5.2` and `v1.6.1` published 22
seconds apart).
- *Whether Ray master should also carry a dev reference* built from
KubeRay `master`, alongside the stable one. Open question for the
maintainers.

**Remaining MkDocs-only content.** Several other pages on the MkDocs
site have no equivalent in the Ray docs — the Helm chart values tables,
additional `rayStartParams` coverage (`--no-monitor` and the autoscaler
READONLY rationale, `--block`, `--address` FQDN construction), and the
image tagging and registry scheme. Being handled separately.

## Related issue number

Depends on ray-project#65240 (merged). Related upstream: kuberay-project/kuberay#5091,
kuberay-project/kuberay#5124.

## AI assistance

AI assistance (Claude Code) was used for the anchor-collision analysis,
the release-mechanics analysis, the build verification, the
post-processing script, and drafting this description. I reviewed the
vendored content and the link changes and can defend both.

---------

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

core Issues that should be addressed in Ray Core docs An issue or change related to documentation docs-go RtD-only checks for docs-only changes. Doesn't run full library doc-test suites. go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants