Repository navigation
[ci][doc] Add merge-time redirect apply step (disabled pending credential) - #65866
Merged
Merged
Conversation
…tial) Adds the post-merge sync that reconciles doc/redirects/current.yaml into the live anyscale-ray Read the Docs project, replacing the manual apply a maintainer runs today. The step is postmerge-only (skip-on-premerge), self-gates on whether the merge touched doc/redirects/, and reads its RtD token from a dedicated, least-privilege Secrets Manager ARN read by no other step. It lands disabled: the bot user and token are still being provisioned. Enabling is a one-PR flip -- remove the disabled tag and drop in the real ARN -- the same way the doc linkcheck step landed ahead of its webhook secret. Signed-off-by: Douglas Strodtman <[email protected]>
elliot-barn
requested changes
Sep 3, 2026
dstrodtman
marked this pull request as ready for review
September 4, 2026 19:58
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds a merge-time sync step to .buildkite/doc.rayci.yml for automatically applying documentation redirects to Read the Docs. The feedback recommends wrapping the credential export command with set +x and set -x to prevent potential leakage in Buildkite logs, and replacing the piped git diff and grep command with git diff --quiet to avoid silent failures during change detection.
Address review on the merge-time redirect-apply step: - Point the secret fetch at the provisioned oss-ci/rtd-api-token secret instead of the RTD_TOKEN_SECRET_ARN placeholder. Enabling is now just removing the disabled tag; update the in-file comment to match. - Fetch the token with shell tracing off (set +x) so an xtrace-enabled agent can't echo the expanded token into the build log. - Replace the 'git diff | grep -q .' change gate with 'git diff --quiet'. The pipe masked git's exit status and would exit 0 on a git error, silently skipping a real redirect apply; --quiet falls through to apply on error, matching the step's stated fail-open intent. Signed-off-by: Douglas Strodtman <[email protected]>
elliot-barn
approved these changes
Sep 9, 2026
NightWing1998
pushed a commit
to NightWing1998/ray
that referenced
this pull request
Sep 11, 2026
…tial) (ray-project#65866) ## What this does Adds the merge-time sync step that reconciles `doc/redirects/current.yaml` into the live `anyscale-ray` Read the Docs project. This is the automation that replaces the manual `rtd-redirects apply` a maintainer runs by hand today (see `doc/redirects/README.md`). It completes the redirect-as-code pipeline whose credential-free PR-time validation gate already landed in ray-project#64413. **It lands disabled.** The dedicated bot credential it needs isn't provisioned yet, so the step carries the `disabled` tag and rayci skips it in both premerge and postmerge. This PR is deliberately staged, not ready to merge-and-run — it's here so the credential wiring can be reviewed and the dependency tracked. Same pattern the `doc: linkcheck` step used to land ahead of its Slack webhook secret. ## How it's wired - **Postmerge-only.** The `skip-on-premerge` tag keeps it off every PR build, so no PR event — fork or not — ever runs the token-bearing step. It runs only on push to master. - **Self-gated on the diff.** rayci evaluates file-based tag rules on premerge only; master builds are run-all. The step therefore exits early unless the merge actually touched `doc/redirects/`, so the token and the RtD API are used only when a redirect changed. - **Least-privilege secret.** The token is read inline from a dedicated Secrets Manager ARN read by no other step — not the shared `ray-air-test-secrets` bucket. Blast radius stays bounded to redirects on the one RtD project. ## What I need to enable it A dedicated bot principal with admin on the `anyscale-ray` RtD project, its API token stored in a dedicated Secrets Manager ARN. Once that exists, enabling is a one-PR flip: remove the `disabled` tag, replace the `RTD_TOKEN_SECRET_ARN` placeholder with the real ARN, and update the "application is manual for now" line in `doc/redirects/README.md`. ## One caveat for review The pinned tool version (0.2.0) has no `--no-delete` or `--accept-drift` guard, so the first automated `apply` reconciles hard: a live redirect absent from `current.yaml` is deleted. That's the intended one-write-path behavior, but it's why the manual-apply phase should finish before this is turned on. ## Test plan - [x] YAML parses; new step present with tags `oss`, `skip-on-premerge`, `disabled`. - [x] Tag-rules dry-run confirms the edit emits only the doc pipeline (`doc, doc_api, doc_redirects, lint`), no code fan-out. - [x] `disabled` tag verified to skip in both premerge and postmerge rayci configs. - [ ] Enablement (separate PR, after credential): real premerge/postmerge run. --------- Signed-off-by: Douglas Strodtman <[email protected]>
dstrodtman
added a commit
that referenced
this pull request
Sep 18, 2026
## What Two changes: 1. Enable the postmerge redirect apply step in `.buildkite/doc.rayci.yml` by removing its `disabled` tag, and update `doc/redirects/README.md` so the authoring flow documents that redirect application is now automatic. 2. Fix one redirect in `doc/redirects/current.yaml`: `/data/dataset.html` pointed at `/en/master/data/api/dataset.html`, hard-pinning a version-agnostic `page` rule to the master build. Point it at the version-less `/data/api/dataset.html` like every other `page` rule in the file, so a reader who hits the legacy path stays on their own docs version instead of being bounced to master. Enabling the step is the enable half of #65866, which deliberately landed the step disabled as a one-line follow-up so the live `anyscale-ray` Read the Docs project could be reconciled to `doc/redirects/current.yaml` under the manual-apply phase before automation took over. ## Why now The live `anyscale-ray` project has been reconciled to `current.yaml` under the manual-apply phase, so `rtd-redirects plan` now reports only the single intentional `/data/dataset.html` update this PR introduces (`0 add / 1 update / 0 delete / 0 reorder`). Bundling that one-line fix here makes the first automated postmerge run a small, fully reviewed apply — the redirect goes live exactly when automation turns on — rather than a hard reconcile of a drifted project. The step's safety properties are unchanged from #65866: it's `skip-on-premerge` (postmerge-only, never runs on a PR or fork build), self-gates on the `doc/redirects/` diff so unrelated master merges are a no-op, reads its token only from the dedicated least-privilege `oss-ci/rtd-api-token` secret, and fails without blocking master. ## Not a duplicate No open PR touches the redirect steps in `.buildkite/doc.rayci.yml`. This is the deferred enable step for #65866, not a competing change. ## Testing - `rtd-redirects plan --project anyscale-ray --file doc/redirects/current.yaml` → `0 add, 1 update, 0 delete, 0 reorder`; the single update is `~ /data/dataset.html -> /data/api/dataset.html (page)`. Read-only; confirms the live project matches the file except for the one intentional fix this PR applies. - `rtd-redirects validate doc/redirects/current.yaml` → 0 errors (44 pre-existing chain warnings, unchanged by this PR; all are false positives against version-agnostic catch-all rules that only fire on 404). - No local Buildkite run: the step is postmerge-only by construction and can't be exercised from a PR build. Its first real run is this merge. Known follow-up: confirm the OSS CI IAM role can read the `oss-ci/rtd-api-token` secret. If it can't, the step fails at the secret fetch without blocking master, and the enable half of this PR is a clean one-line revert. ## AI assistance AI assistance (Claude Code) prepared this change and ran the `plan` and `validate` checks above. The submitter reviews every changed line before merge. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 4.8 <[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]>
nadongjun
pushed a commit
to nadongjun/ray
that referenced
this pull request
Oct 6, 2026
…tial) (ray-project#65866) ## What this does Adds the merge-time sync step that reconciles `doc/redirects/current.yaml` into the live `anyscale-ray` Read the Docs project. This is the automation that replaces the manual `rtd-redirects apply` a maintainer runs by hand today (see `doc/redirects/README.md`). It completes the redirect-as-code pipeline whose credential-free PR-time validation gate already landed in ray-project#64413. **It lands disabled.** The dedicated bot credential it needs isn't provisioned yet, so the step carries the `disabled` tag and rayci skips it in both premerge and postmerge. This PR is deliberately staged, not ready to merge-and-run — it's here so the credential wiring can be reviewed and the dependency tracked. Same pattern the `doc: linkcheck` step used to land ahead of its Slack webhook secret. ## How it's wired - **Postmerge-only.** The `skip-on-premerge` tag keeps it off every PR build, so no PR event — fork or not — ever runs the token-bearing step. It runs only on push to master. - **Self-gated on the diff.** rayci evaluates file-based tag rules on premerge only; master builds are run-all. The step therefore exits early unless the merge actually touched `doc/redirects/`, so the token and the RtD API are used only when a redirect changed. - **Least-privilege secret.** The token is read inline from a dedicated Secrets Manager ARN read by no other step — not the shared `ray-air-test-secrets` bucket. Blast radius stays bounded to redirects on the one RtD project. ## What I need to enable it A dedicated bot principal with admin on the `anyscale-ray` RtD project, its API token stored in a dedicated Secrets Manager ARN. Once that exists, enabling is a one-PR flip: remove the `disabled` tag, replace the `RTD_TOKEN_SECRET_ARN` placeholder with the real ARN, and update the "application is manual for now" line in `doc/redirects/README.md`. ## One caveat for review The pinned tool version (0.2.0) has no `--no-delete` or `--accept-drift` guard, so the first automated `apply` reconciles hard: a live redirect absent from `current.yaml` is deleted. That's the intended one-write-path behavior, but it's why the manual-apply phase should finish before this is turned on. ## Test plan - [x] YAML parses; new step present with tags `oss`, `skip-on-premerge`, `disabled`. - [x] Tag-rules dry-run confirms the edit emits only the doc pipeline (`doc, doc_api, doc_redirects, lint`), no code fan-out. - [x] `disabled` tag verified to skip in both premerge and postmerge rayci configs. - [ ] Enablement (separate PR, after credential): real premerge/postmerge run. --------- Signed-off-by: Douglas Strodtman <[email protected]>
nadongjun
pushed a commit
to nadongjun/ray
that referenced
this pull request
Oct 6, 2026
…#66024) ## What Two changes: 1. Enable the postmerge redirect apply step in `.buildkite/doc.rayci.yml` by removing its `disabled` tag, and update `doc/redirects/README.md` so the authoring flow documents that redirect application is now automatic. 2. Fix one redirect in `doc/redirects/current.yaml`: `/data/dataset.html` pointed at `/en/master/data/api/dataset.html`, hard-pinning a version-agnostic `page` rule to the master build. Point it at the version-less `/data/api/dataset.html` like every other `page` rule in the file, so a reader who hits the legacy path stays on their own docs version instead of being bounced to master. Enabling the step is the enable half of ray-project#65866, which deliberately landed the step disabled as a one-line follow-up so the live `anyscale-ray` Read the Docs project could be reconciled to `doc/redirects/current.yaml` under the manual-apply phase before automation took over. ## Why now The live `anyscale-ray` project has been reconciled to `current.yaml` under the manual-apply phase, so `rtd-redirects plan` now reports only the single intentional `/data/dataset.html` update this PR introduces (`0 add / 1 update / 0 delete / 0 reorder`). Bundling that one-line fix here makes the first automated postmerge run a small, fully reviewed apply — the redirect goes live exactly when automation turns on — rather than a hard reconcile of a drifted project. The step's safety properties are unchanged from ray-project#65866: it's `skip-on-premerge` (postmerge-only, never runs on a PR or fork build), self-gates on the `doc/redirects/` diff so unrelated master merges are a no-op, reads its token only from the dedicated least-privilege `oss-ci/rtd-api-token` secret, and fails without blocking master. ## Not a duplicate No open PR touches the redirect steps in `.buildkite/doc.rayci.yml`. This is the deferred enable step for ray-project#65866, not a competing change. ## Testing - `rtd-redirects plan --project anyscale-ray --file doc/redirects/current.yaml` → `0 add, 1 update, 0 delete, 0 reorder`; the single update is `~ /data/dataset.html -> /data/api/dataset.html (page)`. Read-only; confirms the live project matches the file except for the one intentional fix this PR applies. - `rtd-redirects validate doc/redirects/current.yaml` → 0 errors (44 pre-existing chain warnings, unchanged by this PR; all are false positives against version-agnostic catch-all rules that only fire on 404). - No local Buildkite run: the step is postmerge-only by construction and can't be exercised from a PR build. Its first real run is this merge. Known follow-up: confirm the OSS CI IAM role can read the `oss-ci/rtd-api-token` secret. If it can't, the step fails at the secret fetch without blocking master, and the enable half of this PR is a clean one-line revert. ## AI assistance AI assistance (Claude Code) prepared this change and ran the `plan` and `validate` checks above. The submitter reviews every changed line before merge. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 4.8 <[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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Adds the merge-time sync step that reconciles
doc/redirects/current.yamlintothe live
anyscale-rayRead the Docs project. This is the automation thatreplaces the manual
rtd-redirects applya maintainer runs by hand today (seedoc/redirects/README.md). It completes the redirect-as-code pipeline whosecredential-free PR-time validation gate already landed in #64413.
It lands disabled. The dedicated bot credential it needs isn't provisioned
yet, so the step carries the
disabledtag and rayci skips it in both premergeand postmerge. This PR is deliberately staged, not ready to merge-and-run — it's
here so the credential wiring can be reviewed and the dependency tracked. Same
pattern the
doc: linkcheckstep used to land ahead of its Slack webhook secret.How it's wired
skip-on-premergetag keeps it off every PR build, sono PR event — fork or not — ever runs the token-bearing step. It runs only on
push to master.
only; master builds are run-all. The step therefore exits early unless the
merge actually touched
doc/redirects/, so the token and the RtD API are usedonly when a redirect changed.
Manager ARN read by no other step — not the shared
ray-air-test-secretsbucket. Blast radius stays bounded to redirects on the one RtD project.
What I need to enable it
A dedicated bot principal with admin on the
anyscale-rayRtD project, its APItoken stored in a dedicated Secrets Manager ARN. Once that exists, enabling is a
one-PR flip: remove the
disabledtag, replace theRTD_TOKEN_SECRET_ARNplaceholder with the real ARN, and update the "application is manual for now"
line in
doc/redirects/README.md.One caveat for review
The pinned tool version (0.2.0) has no
--no-deleteor--accept-driftguard,so the first automated
applyreconciles hard: a live redirect absent fromcurrent.yamlis deleted. That's the intended one-write-path behavior, but it'swhy the manual-apply phase should finish before this is turned on.
Test plan
oss,skip-on-premerge,disabled.(
doc, doc_api, doc_redirects, lint), no code fan-out.disabledtag verified to skip in both premerge and postmerge rayci configs.