Skip to content

[ci][doc] Stage release-gated redirects via doc/redirects/master.yaml - #66027

Closed
dstrodtman wants to merge 1 commit into
masterfrom
doc-1301-release-gated-redirects
Closed

dstrodtman wants to merge 1 commit into
masterfrom
doc-1301-release-gated-redirects

Conversation

@dstrodtman

Copy link
Copy Markdown
Contributor

Summary

Add doc/redirects/master.yaml alongside current.yaml so redirects for the staged next-release docs (/en/master/) can land without changing /en/latest/ until the version is promoted. The two files compose into one ordered set, master.yaml first, so its exact /en/master/ rules index ahead of current.yaml's broad page and wildcard rules and win for their URLs.

What changed

  • doc/redirects/master.yaml — new file, ships empty (redirects: []) with a commented worked example. The empty list is its resting state between release cycles.
  • .buildkite/doc.rayci.yml — the validate, diff-file, and apply steps now compose master.yaml current.yaml in order (validate --composed, --file master.yaml current.yaml). Both fail-closed guards now require exactly the {master,current}.yaml set, so a stray redirect file or a deleted master.yaml is caught.
  • doc/redirects/README.md — documents the two-file model, the compose ordering, immediate vs. release-gated redirects, and the release-day fold procedure.

The pinned anyscale-rtd-redirects==0.2.0 already supports ordered multi-file composition, so no tool bump is needed. Because master.yaml ships empty, the composed set is unchanged and the postmerge apply is a no-op against the live project until real next-release redirects are staged (diff-file reports 0 add / 0 update / 0 delete / 0 reorder).

Stacked on #66024

This targets the doc-1300-enable-redirect-apply branch, not master, because both PRs edit .buildkite/doc.rayci.yml and doc/redirects/README.md. Review and merge #66024 first; GitHub retargets this PR to master when #66024 merges.

🤖 Generated with Claude Code

@dstrodtman
dstrodtman requested review from a team as code owners September 9, 2026 17:21

@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 introduces a two-file system for managing Read the Docs redirects, splitting them into immediate redirects (current.yaml) and release-gated redirects (master.yaml). The Buildkite CI configuration (.buildkite/doc.rayci.yml) has been updated to validate, diff, and apply the composed set of redirect files in the correct order, and the documentation (doc/redirects/README.md) has been updated to reflect these changes. Feedback on the pull request suggests simplifying the shell-based file validation checks in the Buildkite configuration by using xargs to collapse multi-line outputs into space-separated strings, making the comparison less fragile and easier to read.

Comment thread .buildkite/doc.rayci.yml
- >
test "$$(find doc/redirects -name '*.yaml')" = "doc/redirects/current.yaml" ||
{ echo "doc/redirects/ holds a .yaml file this check doesn't validate; see the comment in .buildkite/doc.rayci.yml"; exit 1; }
test "$$(find doc/redirects -name '*.yaml' | sort)" = "$$(printf 'doc/redirects/current.yaml\ndoc/redirects/master.yaml\n')" ||

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.

medium

Using printf with embedded newlines and comparing multi-line strings in a shell command can be fragile and harder to read. We can simplify this check by piping the sorted output of find to xargs, which collapses the newlines into space-separated values, and then comparing against a simple space-separated string.

        test "$$(find doc/redirects -name '*.yaml' | sort | xargs)" = "doc/redirects/current.yaml doc/redirects/master.yaml" ||

Comment thread .buildkite/doc.rayci.yml
- >
test "$$(find doc/redirects -name '*.yaml')" = "doc/redirects/current.yaml" ||
{ echo "doc/redirects/ holds a .yaml file this step doesn't apply; see the comment in .buildkite/doc.rayci.yml"; exit 1; }
test "$$(find doc/redirects -name '*.yaml' | sort)" = "$$(printf 'doc/redirects/current.yaml\ndoc/redirects/master.yaml\n')" ||

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.

medium

Using printf with embedded newlines and comparing multi-line strings in a shell command can be fragile and harder to read. We can simplify this check by piping the sorted output of find to xargs, which collapses the newlines into space-separated values, and then comparing against a simple space-separated string.

        test "$$(find doc/redirects -name '*.yaml' | sort | xargs)" = "doc/redirects/current.yaml doc/redirects/master.yaml" ||

@ray-gardener ray-gardener Bot added docs An issue or change related to documentation core Issues that should be addressed in Ray Core devprod labels Sep 9, 2026
@dstrodtman
dstrodtman force-pushed the doc-1300-enable-redirect-apply branch from 75d0c8b to 2e6745c Compare September 18, 2026 16:04
@dstrodtman
dstrodtman force-pushed the doc-1301-release-gated-redirects branch from ae0d561 to 9643159 Compare September 18, 2026 16:06
Base automatically changed from doc-1300-enable-redirect-apply to master September 18, 2026 17:49
dstrodtman added a commit that referenced this pull request Sep 24, 2026
…66459)

## Why are these changes needed?

The Ray example and tutorial templates are fetched at doc build time
through `sphinx-collections` (`doc/source/template_collections.py`) and
build under `/_collections/<target>/`. #63971 deleted the stale in-tree
copies, but no redirects were added for the URLs those copies served.

Probing docs.ray.io shows where it broke:

- `releases-2.55.1` and earlier: the old path, such as
`/ray-overview/examples/e2e-rag/README.html`, returns 200. The
`/_collections/` path returns 404.
- `releases-2.56.0` and later, including `/latest` and `/master`: the
old path returns 404. The `/_collections/` path returns 200.

So since 2.56.0 became `/latest`, external links and search results
pointing at the old template pages have returned 404. Some of the old
paths fall under the legacy catch-alls (`/serve/tutorials/*`,
`/train/examples/*`, `/tune/examples/*`), which land readers on a
generic index instead of the page they wanted.

## What

This PR adds 63 `page` redirects to `doc/redirects/current.yaml`, one
per removed template URL that was actually served on 2.55.1, each
pointing at that page's `/_collections/` path:

- 40 move 1:1, so the target is `/_collections/<same path>`.
- 23 lived under a `content/` directory the sync no longer produces, so
the target drops that segment. A few single-notebook templates now build
only a `README`, so those point at the `README`:
`unstructured_data_ingestion`, `tune_pytorch_asha`, and
`model_composition_recsys`, which was renamed to
`model-composition-recsys`.

The block sits right after the Ray Data rules and ahead of every
wildcard rule, so the specific rules win over the catch-alls. `page`
rules without `force` fire only on 404, so 2.55 and earlier keep serving
their own in-tree copies.

Out of scope, and deliberately skipped:

- 9 removed paths that already returned 404 on 2.55.1, because they were
excluded from the build. These are the `llamafactory-llm-fine-tune`
pages and two `train/tutorials/content/*/README` indexes.
- 3 paths whose only 2.55.1 response was a catch-all 301, so they were
never pages.

## Related PRs

- #63971 removed the in-tree template copies.
- #66427 fixes the postmerge redirect apply step. Once it merges, this
change goes live on the next postmerge run. Until then, a maintainer
applies it manually.
- Duplicate check: no open PR touches template redirects. The only other
open PRs that touch `doc/redirects/` are #66427 (CI apply gate) and
#66027 (release-gated `master.yaml`), and neither adds these rules.
#66027 also edits `current.yaml`, so whichever merges second might need
a trivial rebase.

## Testing

- Built the URL list from `git show --name-status 70eade0` (#63971),
keeping deleted pages whose URL isn't produced at HEAD.
- Probed every old URL on `releases-2.55.1`, and every candidate target
on `/en/master/`. Targets were cross-checked against the `_collections/`
docnames in the live `objects.inv`. All 63 targets return 200.
- `rtd-redirects validate doc/redirects/current.yaml`: 0 errors. It
reports the same 44 pre-existing chain warnings as master and none from
the new rules.
- `rtd-redirects diff-file --file doc/redirects/current.yaml --base
upstream/master --head HEAD --repo .`: 63 add, 0 update, 0 delete.
- `rtd-redirects plan --project anyscale-ray --file
doc/redirects/current.yaml` against the live project: 63 add, 0 update,
0 delete. The reorders are position shifts from the insertion.
- `pre-commit run --files doc/redirects/current.yaml`: passes.
- Five `mcp-ray-serve` paths contain spaces, and one also contains
parentheses. Read the Docs matches redirects on the Django-decoded
request path, so a `%20` request should match the literal space in
`from`. I'll confirm that with a live request after apply.

## AI assistance

This PR was prepared with AI assistance (Claude Code). I reviewed every
added rule and the probe results above.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
dstrodtman added a commit that referenced this pull request Sep 24, 2026
…66427)

## Why are these changes needed?

The postmerge `doc: apply redirects` step, enabled in #66024, has failed
on every run since it was turned on, and it never applied a redirect
change. The one change that merged since then, the `/data/dataset.html`
target updated in #66024 itself, didn't reach Read the Docs until a
maintainer applied it by hand.

There are two problems, and both come from the `HEAD~1..HEAD` gate at
the top of the step:

1. **The gate checks the wrong range.** The step isn't scheduled on
every master merge. In the postmerge builds since 2026-09-18, it appears
only in the full builds that release automation triggers, a few times a
day, and not in the per-merge builds. A `git diff HEAD~1 HEAD --
doc/redirects/` check sees only the single commit that build is on, so a
redirect merge that isn't that commit is never applied.
2. **The skip path reports failure.** All 12 runs from [postmerge
#19792](https://buildkite.com/ray-project/postmerge/builds/19792)
through
[#19893](https://buildkite.com/ray-project/postmerge/builds/19893)
logged `no doc/redirects/ change in this merge; nothing to apply`, then
`logout`, then `The command exited with status 1`. The command runs
under `bash -elic`, so the `exit 0` likely goes through login-shell
logout handling. I inferred that cause from the log and couldn't
reproduce it locally.

This PR replaces the gate with two changes:

- **Converge on every run.** `rtd-redirects apply` already converges:
when the live project matches `current.yaml`, it makes only read calls,
prints `apply: no changes`, and exits 0 (`cli.py` in
anyscale-rtd-redirects 0.2.0). A redirect merge now goes live on the
next postmerge run of the step, not only when it happens to be that
build's commit.
- **Guard against stale checkouts.** Release automation triggers
postmerge with its own branch and commit
(`.buildkite/release-automation/pre_release.rayci.yml`). In September,
18 of the 88 full postmerge builds ran on `releases/*`. Because `apply`
deletes live redirects that aren't in the file, applying an older
`current.yaml` would roll back newer redirects. The step now applies
only on a `master` build whose `doc/redirects/` matches the freshly
fetched `origin/master`. Otherwise it logs why it skipped and passes. It
skips the same way if the fetch fails. Cursor Bugbot flagged this on the
first revision.

The skip path no longer calls `exit`, and the token is fetched only when
the step applies. The step comment and `doc/redirects/README.md` are
updated to match. The step is still `skip-on-premerge` and still reads
the dedicated `oss-ci/rtd-api-token` secret.

## Related PRs

- #66024 enabled the step.
- #65866 added it, disabled.
- Duplicate check: no open PR touches this step. I searched open PRs for
"redirect apply" and reviewed the open redirect PR #66027, which stages
release-gated redirects and doesn't change the apply gate.

## Testing

- `pre-commit run --files .buildkite/doc.rayci.yml
doc/redirects/README.md`: passes.
- Parsed `.buildkite/doc.rayci.yml` with `yaml.safe_load` and confirmed
the `doc_redirects_apply` commands are the file guard, the pinned
install, and the guarded apply block.
- Extracted the guarded block, with the token fetch and `apply` replaced
by fakes, and ran it with `bash -e` in a scratch git repo against a
local bare `origin`:
    - `master` at the tip: applies.
    - Older `master` SHA with the same `doc/redirects/`: applies.
    - `releases/2.50.0`: skips, exit 0.
- Older `master` SHA whose `doc/redirects/` has since changed: skips,
exit 0.
- Fetch fails: skips with its own message, exit 0. The fetch runs only
on `master` builds, and a missed apply converges on the next run.
- `rtd-redirects plan --project anyscale-ray --file
doc/redirects/current.yaml --strict` with 0.2.0 against the live project
showed the one missed update. `apply --strict --yes` applied it (`1
updated`), and a follow-up `plan` reports `0 add, 0 update, 0 delete, 0
reorder`. `https://docs.ray.io/en/latest/data/dataset.html` now 301s to
`/en/latest/data/api/dataset.html`.
- The step runs only on postmerge, so this PR's CI doesn't exercise it.
The check is the first postmerge run after merge: it should log `apply:
no changes` and pass.

## AI assistance

This PR was prepared with AI assistance (Claude Code). I reviewed every
changed line and the Buildkite evidence above.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Add master.yaml alongside current.yaml so redirects for the staged
next-release docs (/en/master/) can land without changing /en/latest/
until the version is promoted. The two files compose into one ordered
set, master.yaml first, so its exact /en/master/ rules index ahead of
current.yaml's broad page and wildcard rules and win for their URLs.

Update the validate and apply CI steps to compose both files in order
(validate --composed, diff-file, and apply all name master.yaml then
current.yaml), and broaden the fail-closed guard in both steps to require
exactly the {master,current}.yaml set, so a stray redirect file or a
deleted master.yaml is caught. The pinned anyscale-rtd-redirects==0.2.0
already supports ordered multi-file composition, so no tool bump is
needed. master.yaml ships empty (redirects: []) with a commented example;
that empty list is its resting state between release cycles.

Document the two-file model, the compose ordering, immediate versus
release-gated choices, and the release-day fold procedure in the README.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman

Copy link
Copy Markdown
Contributor Author

Closing this in favor of #66606. A separate master.yaml turns out to be unnecessary for staging redirects.

Read the Docs redirects default to force: false, so a rule fires only where the requested URL would otherwise 404. A version-less type: page rule for a move is therefore already gated by version:

  • It's inert on /en/latest/ and older releases, where the old path still exists.
  • It fires on /en/master/ as soon as the move merges.
  • It picks up /en/latest/ on release with no edit.

That's the gating this PR set out to build with a second file and a release-day fold.

The fold step would also have caused harm. Repointing existing rules from /old/... to /new/... sends readers of older releases to a path that doesn't exist in their version. Leaving those rules in place and adding a wildcard for the old path keeps every version working, at the cost of a second hop on newer versions.

#66606 documents that pattern in doc/redirects/README.md, and #66605 is the first move that uses it. If a case comes up that the 404 default can't handle, such as redirecting a page that still exists on master only, we can revisit a master-scoped file then. The rebased branch stays in place for reference.

@dstrodtman dstrodtman closed this Sep 30, 2026
dstrodtman added a commit that referenced this pull request Oct 1, 2026
…redirect targets (#66606)

## Why are these changes needed?

`doc/redirects/README.md` explains how to add a redirect. It doesn't
explain how a rule behaves across docs versions, or what to do when
pages that existing rules point at move. Directory moves such as #66605
need that guidance. The obvious approach, repointing existing rules at
the new path, breaks older releases.

The behavior that matters: Read the Docs redirects default to `force:
false`, so a rule fires only where the requested URL would otherwise
return 404. A `type: page` rule applies to every version and resolves
`to` within that version. So one version-less rule for a move does the
right thing everywhere:

- It's inert on `/en/latest/` and older releases, where the old path
still exists.
- It fires on `/en/master/` as soon as the move merges.
- It starts firing on `/en/latest/` when the release that ships the move
goes out, with no release-day edit.

Source: the "Robust fan-out" section of the [rtd-redirects
README](https://github.com/anyscale/rtd-redirects#robust-fan-out-page--force-false--splat).

This PR adds two README sections:

- **How redirects apply across versions**: the 404-only default,
per-version resolution, and when `force: true` is appropriate.
- **Moving or renaming pages**:
  - Add a wildcard `page` rule for the old path.
- Don't repoint existing rules whose `to` points under the moved path.
Older releases still serve the old path, and on newer versions the
request lands on the moved page in a second hop.
- Move the `from` of catch-alls under the old path, so they don't catch
moved pages first.
  - Expect chain warnings from the validator. They don't block CI.

It also fixes a live regression this pattern would have prevented.
#66060 repointed six root-level rules, such as `/rllib-env.html`, from
`/rllib/rllib-*.html` to the renamed `/rllib/*.html` pages. Those pages
exist only on master, so the redirects land on 404s on `/en/latest/` and
every older release. The second commit points them back at
`/rllib/rllib-*.html`, matching the file before #66060. The
`/rllib/rllib-*.html` rules that #66060 added then carry master readers
to the renamed pages in a second hop. A third commit fixes one older
instance of the same pattern: `/rllib-models.html` pointed at
`/rllib/rl-modules.html`, which exists only from 2.43.0 on. It now
points at `/rllib/rllib-models.html`.

It also adjusts step 1 of "Adding or changing a redirect", which said to
point `to` at the final destination. That still holds for new rules, and
the step now links to the move guidance for existing ones.

This replaces the approach in #66027, which staged release-gated rules
in a separate `master.yaml` and folded them into `current.yaml` on
release day. The 404-only default already gives that version gating, and
the fold step would repoint rules in a way that breaks older releases.
I'm closing #66027 in favor of this PR.

## Related PRs

- #66027: closed in favor of this PR.
- #66605: the first directory move that follows this pattern. It adds
`/ray-core/*` -> `/core/:splat`, keeps the 58 existing rules that point
at `/ray-core/...`, and moves the two catch-alls.
- Duplicate check: I searched open PRs for "redirects README" and
"redirect". The only matches are #66027 and #66605, and neither changes
this guidance.

## Testing

- `pre-commit run --files doc/redirects/README.md
doc/redirects/current.yaml`: passes.
- `rtd-redirects validate doc/redirects/current.yaml` with 0.2.0: exit
0, no errors. Warnings go from 44 to 58, all of them chain warnings from
the seven restored two-hop paths.
- For the six restored targets:
`/rllib/rllib-{env,examples,offline,dev,algorithms}.html` return 200 on
`/en/latest/`, `/en/releases-2.40.0/`, and `/en/releases-2.10.0/`. Each
has a `/rllib/rllib-*.html` rule that fires on master.
- Checked the CI claims against the anyscale-rtd-redirects 0.2.0 source
that CI pins. `validate` and `apply --strict` exit non-zero only on
error-level findings (`cli.py`), so chain warnings don't block either
step.
- Verified the 404-only behavior on the live project with the
`/rllib/rllib-env.html` -> `/rllib/env.html` rule that #66060 added
(`curl -sL` against docs.ray.io):
- `/en/master/rllib/rllib-env.html`: 1 hop to
`/en/master/rllib/env.html`, 200. The old page is gone on master, so the
rule fires.
- `/en/latest/rllib/rllib-env.html` and
`/en/releases-2.40.0/rllib/rllib-env.html`: 0 hops, 200. The old page
still exists there, so the rule doesn't fire.
- Verified the repointing failure on the live project, before this PR's
fix. #66060 also repointed six existing rules, such as
`/rllib-env.html`, from `/rllib/rllib-*.html` to the new names. Those
URLs now 404 on `/en/latest/`, `/en/releases-2.40.0/`, and
`/en/releases-2.10.0/`, because `/rllib/env.html` doesn't exist in those
versions. They resolve only on master. They resolve on every version
again once this PR merges and the postmerge apply step runs.

## AI assistance

This PR was prepared with AI assistance (Claude Code). It stays a draft
until I've reviewed every changed line.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…ay-project#66459)

## Why are these changes needed?

The Ray example and tutorial templates are fetched at doc build time
through `sphinx-collections` (`doc/source/template_collections.py`) and
build under `/_collections/<target>/`. ray-project#63971 deleted the stale in-tree
copies, but no redirects were added for the URLs those copies served.

Probing docs.ray.io shows where it broke:

- `releases-2.55.1` and earlier: the old path, such as
`/ray-overview/examples/e2e-rag/README.html`, returns 200. The
`/_collections/` path returns 404.
- `releases-2.56.0` and later, including `/latest` and `/master`: the
old path returns 404. The `/_collections/` path returns 200.

So since 2.56.0 became `/latest`, external links and search results
pointing at the old template pages have returned 404. Some of the old
paths fall under the legacy catch-alls (`/serve/tutorials/*`,
`/train/examples/*`, `/tune/examples/*`), which land readers on a
generic index instead of the page they wanted.

## What

This PR adds 63 `page` redirects to `doc/redirects/current.yaml`, one
per removed template URL that was actually served on 2.55.1, each
pointing at that page's `/_collections/` path:

- 40 move 1:1, so the target is `/_collections/<same path>`.
- 23 lived under a `content/` directory the sync no longer produces, so
the target drops that segment. A few single-notebook templates now build
only a `README`, so those point at the `README`:
`unstructured_data_ingestion`, `tune_pytorch_asha`, and
`model_composition_recsys`, which was renamed to
`model-composition-recsys`.

The block sits right after the Ray Data rules and ahead of every
wildcard rule, so the specific rules win over the catch-alls. `page`
rules without `force` fire only on 404, so 2.55 and earlier keep serving
their own in-tree copies.

Out of scope, and deliberately skipped:

- 9 removed paths that already returned 404 on 2.55.1, because they were
excluded from the build. These are the `llamafactory-llm-fine-tune`
pages and two `train/tutorials/content/*/README` indexes.
- 3 paths whose only 2.55.1 response was a catch-all 301, so they were
never pages.

## Related PRs

- ray-project#63971 removed the in-tree template copies.
- ray-project#66427 fixes the postmerge redirect apply step. Once it merges, this
change goes live on the next postmerge run. Until then, a maintainer
applies it manually.
- Duplicate check: no open PR touches template redirects. The only other
open PRs that touch `doc/redirects/` are ray-project#66427 (CI apply gate) and
ray-project#66027 (release-gated `master.yaml`), and neither adds these rules.
ray-project#66027 also edits `current.yaml`, so whichever merges second might need
a trivial rebase.

## Testing

- Built the URL list from `git show --name-status 70eade0` (ray-project#63971),
keeping deleted pages whose URL isn't produced at HEAD.
- Probed every old URL on `releases-2.55.1`, and every candidate target
on `/en/master/`. Targets were cross-checked against the `_collections/`
docnames in the live `objects.inv`. All 63 targets return 200.
- `rtd-redirects validate doc/redirects/current.yaml`: 0 errors. It
reports the same 44 pre-existing chain warnings as master and none from
the new rules.
- `rtd-redirects diff-file --file doc/redirects/current.yaml --base
upstream/master --head HEAD --repo .`: 63 add, 0 update, 0 delete.
- `rtd-redirects plan --project anyscale-ray --file
doc/redirects/current.yaml` against the live project: 63 add, 0 update,
0 delete. The reorders are position shifts from the insertion.
- `pre-commit run --files doc/redirects/current.yaml`: passes.
- Five `mcp-ray-serve` paths contain spaces, and one also contains
parentheses. Read the Docs matches redirects on the Django-decoded
request path, so a `%20` request should match the literal space in
`from`. I'll confirm that with a live request after apply.

## AI assistance

This PR was prepared with AI assistance (Claude Code). I reviewed every
added rule and the probe results above.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…ay-project#66427)

## Why are these changes needed?

The postmerge `doc: apply redirects` step, enabled in ray-project#66024, has failed
on every run since it was turned on, and it never applied a redirect
change. The one change that merged since then, the `/data/dataset.html`
target updated in ray-project#66024 itself, didn't reach Read the Docs until a
maintainer applied it by hand.

There are two problems, and both come from the `HEAD~1..HEAD` gate at
the top of the step:

1. **The gate checks the wrong range.** The step isn't scheduled on
every master merge. In the postmerge builds since 2026-09-18, it appears
only in the full builds that release automation triggers, a few times a
day, and not in the per-merge builds. A `git diff HEAD~1 HEAD --
doc/redirects/` check sees only the single commit that build is on, so a
redirect merge that isn't that commit is never applied.
2. **The skip path reports failure.** All 12 runs from [postmerge
ray-project#19792](https://buildkite.com/ray-project/postmerge/builds/19792)
through
[ray-project#19893](https://buildkite.com/ray-project/postmerge/builds/19893)
logged `no doc/redirects/ change in this merge; nothing to apply`, then
`logout`, then `The command exited with status 1`. The command runs
under `bash -elic`, so the `exit 0` likely goes through login-shell
logout handling. I inferred that cause from the log and couldn't
reproduce it locally.

This PR replaces the gate with two changes:

- **Converge on every run.** `rtd-redirects apply` already converges:
when the live project matches `current.yaml`, it makes only read calls,
prints `apply: no changes`, and exits 0 (`cli.py` in
anyscale-rtd-redirects 0.2.0). A redirect merge now goes live on the
next postmerge run of the step, not only when it happens to be that
build's commit.
- **Guard against stale checkouts.** Release automation triggers
postmerge with its own branch and commit
(`.buildkite/release-automation/pre_release.rayci.yml`). In September,
18 of the 88 full postmerge builds ran on `releases/*`. Because `apply`
deletes live redirects that aren't in the file, applying an older
`current.yaml` would roll back newer redirects. The step now applies
only on a `master` build whose `doc/redirects/` matches the freshly
fetched `origin/master`. Otherwise it logs why it skipped and passes. It
skips the same way if the fetch fails. Cursor Bugbot flagged this on the
first revision.

The skip path no longer calls `exit`, and the token is fetched only when
the step applies. The step comment and `doc/redirects/README.md` are
updated to match. The step is still `skip-on-premerge` and still reads
the dedicated `oss-ci/rtd-api-token` secret.

## Related PRs

- ray-project#66024 enabled the step.
- ray-project#65866 added it, disabled.
- Duplicate check: no open PR touches this step. I searched open PRs for
"redirect apply" and reviewed the open redirect PR ray-project#66027, which stages
release-gated redirects and doesn't change the apply gate.

## Testing

- `pre-commit run --files .buildkite/doc.rayci.yml
doc/redirects/README.md`: passes.
- Parsed `.buildkite/doc.rayci.yml` with `yaml.safe_load` and confirmed
the `doc_redirects_apply` commands are the file guard, the pinned
install, and the guarded apply block.
- Extracted the guarded block, with the token fetch and `apply` replaced
by fakes, and ran it with `bash -e` in a scratch git repo against a
local bare `origin`:
    - `master` at the tip: applies.
    - Older `master` SHA with the same `doc/redirects/`: applies.
    - `releases/2.50.0`: skips, exit 0.
- Older `master` SHA whose `doc/redirects/` has since changed: skips,
exit 0.
- Fetch fails: skips with its own message, exit 0. The fetch runs only
on `master` builds, and a missed apply converges on the next run.
- `rtd-redirects plan --project anyscale-ray --file
doc/redirects/current.yaml --strict` with 0.2.0 against the live project
showed the one missed update. `apply --strict --yes` applied it (`1
updated`), and a follow-up `plan` reports `0 add, 0 update, 0 delete, 0
reorder`. `https://docs.ray.io/en/latest/data/dataset.html` now 301s to
`/en/latest/data/api/dataset.html`.
- The step runs only on postmerge, so this PR's CI doesn't exercise it.
The check is the first postmerge run after merge: it should log `apply:
no changes` and pass.

## AI assistance

This PR was prepared with AI assistance (Claude Code). I reviewed every
changed line and the Buildkite evidence above.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…redirect targets (ray-project#66606)

## Why are these changes needed?

`doc/redirects/README.md` explains how to add a redirect. It doesn't
explain how a rule behaves across docs versions, or what to do when
pages that existing rules point at move. Directory moves such as ray-project#66605
need that guidance. The obvious approach, repointing existing rules at
the new path, breaks older releases.

The behavior that matters: Read the Docs redirects default to `force:
false`, so a rule fires only where the requested URL would otherwise
return 404. A `type: page` rule applies to every version and resolves
`to` within that version. So one version-less rule for a move does the
right thing everywhere:

- It's inert on `/en/latest/` and older releases, where the old path
still exists.
- It fires on `/en/master/` as soon as the move merges.
- It starts firing on `/en/latest/` when the release that ships the move
goes out, with no release-day edit.

Source: the "Robust fan-out" section of the [rtd-redirects
README](https://github.com/anyscale/rtd-redirects#robust-fan-out-page--force-false--splat).

This PR adds two README sections:

- **How redirects apply across versions**: the 404-only default,
per-version resolution, and when `force: true` is appropriate.
- **Moving or renaming pages**:
  - Add a wildcard `page` rule for the old path.
- Don't repoint existing rules whose `to` points under the moved path.
Older releases still serve the old path, and on newer versions the
request lands on the moved page in a second hop.
- Move the `from` of catch-alls under the old path, so they don't catch
moved pages first.
  - Expect chain warnings from the validator. They don't block CI.

It also fixes a live regression this pattern would have prevented.
ray-project#66060 repointed six root-level rules, such as `/rllib-env.html`, from
`/rllib/rllib-*.html` to the renamed `/rllib/*.html` pages. Those pages
exist only on master, so the redirects land on 404s on `/en/latest/` and
every older release. The second commit points them back at
`/rllib/rllib-*.html`, matching the file before ray-project#66060. The
`/rllib/rllib-*.html` rules that ray-project#66060 added then carry master readers
to the renamed pages in a second hop. A third commit fixes one older
instance of the same pattern: `/rllib-models.html` pointed at
`/rllib/rl-modules.html`, which exists only from 2.43.0 on. It now
points at `/rllib/rllib-models.html`.

It also adjusts step 1 of "Adding or changing a redirect", which said to
point `to` at the final destination. That still holds for new rules, and
the step now links to the move guidance for existing ones.

This replaces the approach in ray-project#66027, which staged release-gated rules
in a separate `master.yaml` and folded them into `current.yaml` on
release day. The 404-only default already gives that version gating, and
the fold step would repoint rules in a way that breaks older releases.
I'm closing ray-project#66027 in favor of this PR.

## Related PRs

- ray-project#66027: closed in favor of this PR.
- ray-project#66605: the first directory move that follows this pattern. It adds
`/ray-core/*` -> `/core/:splat`, keeps the 58 existing rules that point
at `/ray-core/...`, and moves the two catch-alls.
- Duplicate check: I searched open PRs for "redirects README" and
"redirect". The only matches are ray-project#66027 and ray-project#66605, and neither changes
this guidance.

## Testing

- `pre-commit run --files doc/redirects/README.md
doc/redirects/current.yaml`: passes.
- `rtd-redirects validate doc/redirects/current.yaml` with 0.2.0: exit
0, no errors. Warnings go from 44 to 58, all of them chain warnings from
the seven restored two-hop paths.
- For the six restored targets:
`/rllib/rllib-{env,examples,offline,dev,algorithms}.html` return 200 on
`/en/latest/`, `/en/releases-2.40.0/`, and `/en/releases-2.10.0/`. Each
has a `/rllib/rllib-*.html` rule that fires on master.
- Checked the CI claims against the anyscale-rtd-redirects 0.2.0 source
that CI pins. `validate` and `apply --strict` exit non-zero only on
error-level findings (`cli.py`), so chain warnings don't block either
step.
- Verified the 404-only behavior on the live project with the
`/rllib/rllib-env.html` -> `/rllib/env.html` rule that ray-project#66060 added
(`curl -sL` against docs.ray.io):
- `/en/master/rllib/rllib-env.html`: 1 hop to
`/en/master/rllib/env.html`, 200. The old page is gone on master, so the
rule fires.
- `/en/latest/rllib/rllib-env.html` and
`/en/releases-2.40.0/rllib/rllib-env.html`: 0 hops, 200. The old page
still exists there, so the rule doesn't fire.
- Verified the repointing failure on the live project, before this PR's
fix. ray-project#66060 also repointed six existing rules, such as
`/rllib-env.html`, from `/rllib/rllib-*.html` to the new names. Those
URLs now 404 on `/en/latest/`, `/en/releases-2.40.0/`, and
`/en/releases-2.10.0/`, because `/rllib/env.html` doesn't exist in those
versions. They resolve only on master. They resolve on every version
again once this PR merges and the postmerge apply step runs.

## AI assistance

This PR was prepared with AI assistance (Claude Code). It stays a draft
until I've reviewed every changed line.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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 devprod docs An issue or change related to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant