Skip to content

[doc] Document cross-version redirect behavior and restore six RLlib redirect targets - #66606

Merged
dstrodtman merged 3 commits into
masterfrom
doc-1301-redirect-authoring-guidance
Oct 1, 2026
Merged

dstrodtman merged 3 commits into
masterfrom
doc-1301-redirect-authoring-guidance

Conversation

@dstrodtman

@dstrodtman dstrodtman commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

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.

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

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 [rllib] Drop the rllib- filename prefix from the RLlib doc pages #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. [rllib] Drop the rllib- filename prefix from the RLlib doc pages #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

…moves

Explain in doc/redirects/README.md that a `force: false` page rule fires
only where the requested URL would 404, so one version-less rule behaves
correctly on master, latest, and older releases without any release-day
edit. Add guidance for page and directory moves: add a wildcard rule for
the old path, don't repoint existing rules that point under it, move
catch-alls that match under it, and treat the resulting chain warnings as
expected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman dstrodtman added the docs An issue or change related to documentation label Sep 30, 2026
#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 now land on 404s on /en/latest/ and every
older release. Point them back at /rllib/rllib-*.html, which exists on
every published version, and let the /rllib/rllib-*.html rules that #66060
added carry master readers to the renamed pages in a second hop.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman dstrodtman changed the title [doc] Document how redirects apply across versions and how to handle moves [doc] Document cross-version redirect behavior and restore six RLlib redirect targets Sep 30, 2026
@dstrodtman dstrodtman added the go add ONLY when ready to merge, run all tests label Sep 30, 2026
@dstrodtman
dstrodtman marked this pull request as ready for review September 30, 2026 17:13
@dstrodtman
dstrodtman requested review from a team as code owners September 30, 2026 17:13

@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 documentation in doc/redirects/README.md to clarify how redirects apply across versions and how to handle page moves. It also updates several legacy RLlib redirect rules in doc/redirects/current.yaml to point to intermediate paths, preventing 404 errors on older documentation versions. Feedback indicates that two additional legacy RLlib redirect rules (/rllib-models.html and /rllib-package-ref.html) were missed in this update and should be updated similarly to fully resolve the regression.

type: page
- from: /rllib-sample-collection.html
to: /rllib/examples.html
to: /rllib/rllib-examples.html

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.

high

It looks like there are two more legacy RLlib redirect rules that were missed in this restoration and still suffer from the same regression (pointing directly to the renamed paths, which will 404 on older versions):\n\n1. /rllib-models.html (line 353) points directly to /rllib/rl-modules.html. It should point to /rllib/rllib-models.html (which then redirects to /rllib/rl-modules.html on master via the rule on line 725).\n2. /rllib-package-ref.html (line 596) points directly to /rllib/package_ref/index.html. It should point to /rllib/rllib-package-ref.html (which then redirects to /rllib/package_ref/index.html on master via the rule on line 494).\n\nConsider updating these two rules as well to fully resolve the regression across all legacy RLlib pages.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks. One of these was a real gap, and the other already resolves.

  • /rllib-models.html: fixed in 4ac5249. /rllib/rl-modules.html first exists in 2.43.0, so the direct target 404s on 2.42.0 and older, for example /en/releases-2.40.0/rllib-models.html. The rule now points at /rllib/rllib-models.html, which exists on those releases, and the /rllib/rllib-models.html rule carries 2.43.0 and newer on to /rllib/rl-modules.html. This one predates [rllib] Drop the rllib- filename prefix from the RLlib doc pages #66060, which didn't touch it.
  • /rllib-package-ref.html: leaving as is. /rllib/package_ref/index.html exists on every version I checked (master, latest, 2.40.0, 2.10.0), and /rllib-package-ref.html returns 200 on all four. Pointing it at /rllib/rllib-package-ref.html would add a hop without fixing anything.

/rllib/rl-modules.html exists only from Ray 2.43.0 on, so the direct
target 404s on 2.42.0 and older releases. /rllib/rllib-models.html
exists there, and the /rllib/rllib-models.html rule carries newer
versions on to /rllib/rl-modules.html in a second hop.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman
dstrodtman merged commit a99d2ff into master Oct 1, 2026
6 checks passed
@dstrodtman
dstrodtman deleted the doc-1301-redirect-authoring-guidance branch October 1, 2026 18:13
dstrodtman added a commit to anyscale/rtd-redirects that referenced this pull request Oct 1, 2026
…-1712]

validate checks a rule set in isolation, so a page-rename change can pass
it and still send readers to a landing page, a 404, or a loop. Whether a
force: false rule fires depends on which pages exist on each version, so
the answer needs page sets, not just rules.

- resolve.py: a request-time Resolver. First match by position, force:
  false only on a 404, page vs exact matching, :splat, fragments never
  matching, /<lang>/<version>/ targets switching page sets, and loop
  detection. Kept separate so the DOC-1697 coverage guard can share it.
- pages.py: page sets from a built HTML dir, objects.inv, sitemap.xml, a
  git tree of Sphinx sources (or WORKTREE), or a path list. Local or URL.
- simulate.py: test URLs from rule sources, prefixes, and explicit URLs;
  per-URL, per-version verdicts against the expected page via a rename map
  (YAML or git renames); hop budget; text and JSON reports.
- cli: simulate subcommand, exit 6 on any failure. Notes when the matrix
  has fewer than three versions or a version mixes a git tree with a build.
- diff_file: make compose_at_ref public for reuse.

Replayed against ray-project/ray#66060, it reports the six flattened
RLlib rules as regressions on latest, releases-2.40.0, and
releases-2.10.0, which ray-project/ray#66606 later restored. Against the
Ray Core move (ray-project/ray#66605) it reports no regressions or wrong
landings on master, latest, releases-2.40.0, or releases-2.20.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
dstrodtman added a commit that referenced this pull request Oct 2, 2026
## Description

Bumps `anyscale-rtd-redirects` from 0.2.0 to
[0.3.0](https://pypi.org/project/anyscale-rtd-redirects/0.3.0/) in both
redirect steps in `.buildkite/doc.rayci.yml`: `doc: validate redirects`
on premerge and `doc: apply redirects` on postmerge.

0.3.0 does the following:

- Removes multi-file composition and multi-version expansion
(`defaults:`, `versions:`). `doc/redirects/current.yaml` never used
either feature.
- Reports a `force: false` chain as info instead of a warning, since a
two-hop chain after a move is the pattern `doc/redirects/README.md`
documents. On `current.yaml` the result goes from 58 warnings to 0
warnings and 58 info. Neither version ever failed CI on chains, because
`--strict` gates only on errors.
- Adds a `simulate` command that replays URLs through the before and
after rules across versions. No CI step uses it yet.

The commands both steps run (`validate`, `diff-file`, `apply --yes
--strict`) are unchanged, so only the pin moves. This PR also updates
the comments that described composing multiple redirect files, and the
README paragraph that called chains warnings.

## Related issues

Related to #66606, which documented the current version-less `page` rule
pattern.

## Additional information

**Not a duplicate.** No open PR touches the rtd-redirects pin: `gh pr
list --repo ray-project/ray --state open --search "rtd-redirects"`
returns only #66605 and #66533, and neither changes
`.buildkite/doc.rayci.yml`.

**Tests run:**

- Parsed `current.yaml` with 0.2.0 and 0.3.0: 270 records each, with an
identical SHA-256 over every field.
- `rtd-redirects validate doc/redirects/current.yaml` with 0.3.0 from a
clean PyPI install: `0 error, 0 warning, 58 info`, exit 0.
- `rtd-redirects diff-file --file doc/redirects/current.yaml --base
upstream/master --head HEAD --repo .`: `0 add, 0 update, 0 delete, 0
reorder`, exit 0.
- The fail-closed single-file guard passes on this branch.
- `pre-commit run` on the two changed files: passed.
- `.buildkite/doc.rayci.yml` still parses as YAML.

The postmerge `apply` step can't run before merge, since it needs the
bot token. Its flags are the same in 0.3.0.

AI assistance (Claude Code) was used to prepare this change. I 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
…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]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…ct#66665)

## Description

Bumps `anyscale-rtd-redirects` from 0.2.0 to
[0.3.0](https://pypi.org/project/anyscale-rtd-redirects/0.3.0/) in both
redirect steps in `.buildkite/doc.rayci.yml`: `doc: validate redirects`
on premerge and `doc: apply redirects` on postmerge.

0.3.0 does the following:

- Removes multi-file composition and multi-version expansion
(`defaults:`, `versions:`). `doc/redirects/current.yaml` never used
either feature.
- Reports a `force: false` chain as info instead of a warning, since a
two-hop chain after a move is the pattern `doc/redirects/README.md`
documents. On `current.yaml` the result goes from 58 warnings to 0
warnings and 58 info. Neither version ever failed CI on chains, because
`--strict` gates only on errors.
- Adds a `simulate` command that replays URLs through the before and
after rules across versions. No CI step uses it yet.

The commands both steps run (`validate`, `diff-file`, `apply --yes
--strict`) are unchanged, so only the pin moves. This PR also updates
the comments that described composing multiple redirect files, and the
README paragraph that called chains warnings.

## Related issues

Related to ray-project#66606, which documented the current version-less `page` rule
pattern.

## Additional information

**Not a duplicate.** No open PR touches the rtd-redirects pin: `gh pr
list --repo ray-project/ray --state open --search "rtd-redirects"`
returns only ray-project#66605 and ray-project#66533, and neither changes
`.buildkite/doc.rayci.yml`.

**Tests run:**

- Parsed `current.yaml` with 0.2.0 and 0.3.0: 270 records each, with an
identical SHA-256 over every field.
- `rtd-redirects validate doc/redirects/current.yaml` with 0.3.0 from a
clean PyPI install: `0 error, 0 warning, 58 info`, exit 0.
- `rtd-redirects diff-file --file doc/redirects/current.yaml --base
upstream/master --head HEAD --repo .`: `0 add, 0 update, 0 delete, 0
reorder`, exit 0.
- The fail-closed single-file guard passes on this branch.
- `pre-commit run` on the two changed files: passed.
- `.buildkite/doc.rayci.yml` still parses as YAML.

The postmerge `apply` step can't run before merge, since it needs the
bot token. Its flags are the same in 0.3.0.

AI assistance (Claude Code) was used to prepare this change. I 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

docs An issue or change related to documentation 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