Skip to content

Commit 69a1960

Browse files
committed
[docs] Add /backport-docs skill for release-branch doc cherry-picks
docs.ray.io/en/latest is built from the newest releases/X.Y.Z branch, not master, so a docs change merged to master only reaches /latest once it's cherry-picked onto the release branch. Add a shared Claude Code skill that walks through that backport end to end: find the release branch, identify what's missing, skip already-backported content, cherry-pick with -x --signoff, verify cross-references and toctree entries for the fail_on_warning build, and open a draft cherry-pick PR. Also document the process for humans in the docs contribution guide, and register the skill in the agent-development guide and the docs-scoped skill list. Signed-off-by: Douglas Strodtman <douglas@anyscale.com>
1 parent 7a5d7f1 commit 69a1960

4 files changed

Lines changed: 147 additions & 1 deletion

File tree

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
name: backport-docs
3+
description: Cherry-pick documentation changes from master onto a release branch so they appear on the docs.ray.io /latest build
4+
---
5+
6+
# Backport docs to a release branch
7+
8+
`docs.ray.io/en/latest` is built from the newest `releases/X.Y.Z` branch, **not**
9+
from `master`. A docs change merged to `master` shows up only on
10+
`docs.ray.io/en/master` until it's cherry-picked onto the release branch. Use this
11+
skill to get already-merged docs onto `/latest`.
12+
13+
Throughout, `<remote>` is the remote that points at `ray-project/ray`. Derive it
14+
from `git remote -v` — it's `origin` in a direct clone and `upstream` in a clone
15+
that started as a fork. Don't assume.
16+
17+
## 1. Find the release branch that `/latest` serves
18+
19+
```bash
20+
git ls-remote --heads <remote> 'refs/heads/releases/*' | sort -t/ -k3 -V | tail -5
21+
```
22+
23+
The highest `releases/X.Y.Z` version is what `/latest` tracks. Fetch it:
24+
25+
```bash
26+
git fetch <remote> releases/X.Y.Z
27+
```
28+
29+
## 2. Identify what's missing on `/latest`
30+
31+
You usually start from a set of already-merged master commits or PRs (for example,
32+
the docs behind a release blog post). For each candidate, check whether it — or
33+
equivalent content — is already on the release branch:
34+
35+
- **File missing entirely:**
36+
`git cat-file -e <remote>/releases/X.Y.Z:doc/source/<path>.md`
37+
- **File present but content differs:**
38+
`git diff <remote>/releases/X.Y.Z..<remote>/master -- doc/source/<path>.md`
39+
- **Which master commits touch a page (newest first):**
40+
`git log --oneline --no-merges <remote>/releases/X.Y.Z..<remote>/master -- doc/source/<path>.md`
41+
42+
## 3. Check for prior backports (avoid duplicates)
43+
44+
Equivalent content is often already on the release branch under a **different SHA**
45+
(a prior cherry-pick). Re-applying it will conflict or produce an empty commit.
46+
Before picking a PR, search the release-branch history for it:
47+
48+
```bash
49+
git log --oneline <remote>/releases/X.Y.Z --grep "#<PR_NUMBER>)"
50+
```
51+
52+
If it's already there, skip that commit. Confirm with a file diff
53+
(`git diff <remote>/releases/X.Y.Z..<remote>/master -- <path>`); an empty diff means
54+
the page is already up to date on `/latest`.
55+
56+
Also check nothing is already in flight:
57+
58+
```bash
59+
gh pr list --repo ray-project/ray --state open --base releases/X.Y.Z
60+
gh pr list --repo ray-project/ray --state open --search "<PR_NUMBER> in:title,body"
61+
```
62+
63+
## 4. Cherry-pick onto a worktree of the release branch
64+
65+
```bash
66+
git worktree add -b <branch> .worktrees/<branch> <remote>/releases/X.Y.Z
67+
cd .worktrees/<branch>
68+
```
69+
70+
Apply the chosen commits in **chronological (oldest-first)** order, preserving
71+
provenance (`-x`) and DCO sign-off (`--signoff`, required — see
72+
`doc/source/ray-contribute/agent-development.md`):
73+
74+
```bash
75+
git cherry-pick -x --signoff <sha1> <sha2> ...
76+
```
77+
78+
**Keep the backport tight.** Cherry-pick only the feature/fix commits. Leave out
79+
broad, non-feature commits that happen to touch the same files (site-wide
80+
frontmatter/SEO passes, terminology renames, tooling like vendored references).
81+
Their hunks will remain as harmless residual diffs against master.
82+
83+
### Resolving conflicts
84+
85+
Conflicts here almost always come from an **excluded** commit that the picked
86+
commit carried as adjacent context (for example, `html_meta` frontmatter the
87+
release branch doesn't have). Resolve toward the release branch's state for those
88+
excluded hunks, and keep only the feature substance. If the whole page turns out to
89+
be already backported (step 3), `git cherry-pick --skip` it.
90+
91+
## 5. Verify the build won't break
92+
93+
The docs build runs with `fail_on_warning: true` (`.readthedocs.yaml`), so an
94+
unresolved cross-reference or a toctree entry pointing at a nonexistent file fails
95+
the build. For every file the backport changed:
96+
97+
- **Cross-references resolve on the branch.** Collect the `{ref}` and `{doc}`
98+
targets and confirm each label exists:
99+
```bash
100+
git grep -nE "^\(<label>\)=" -- 'doc/source/**' # MyST label
101+
git grep -nE "^\.\. _<label>:" -- 'doc/source/**' # rST label
102+
```
103+
- **New toctree entries point at files that exist** on the branch.
104+
- Sanity-check that each changed file matches master except for the hunks you
105+
intentionally excluded:
106+
`git diff HEAD..<remote>/master -- <path>`.
107+
108+
A local docs build (see the "Building the Ray documentation" section of
109+
`doc/source/ray-contribute/docs.md`) is the strongest check before handing off.
110+
111+
## 6. Open the PR
112+
113+
Push the branch to `ray-project/ray` (not a fork, if you have push access) and open
114+
against the release branch:
115+
116+
```bash
117+
git push -u <remote> <branch>
118+
gh pr create --repo ray-project/ray \
119+
--base releases/X.Y.Z --head <branch> --draft \
120+
--title "[cherry-pick][X.Y.Z][docs] <summary>" \
121+
--body-file <body>
122+
```
123+
124+
- Match the release branch's existing title convention: `[cherry-pick][X.Y.Z]...`.
125+
- Open as **draft** — Ray's contribution policy requires a human to review every
126+
line and run tests before it requests review.
127+
- The PR body must state why it isn't a duplicate, what testing ran, and that AI
128+
assistance was used (see `AGENTS.md`). Note any commits you deliberately excluded
129+
and any already-present backports you skipped.
130+
- Keep internal tracking keys out of the PR title, body, and commits.

doc/.claude/CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,6 @@ For regression checks, compare a PR preview against `/en/master` — it's the do
6161

6262
- `/lint` — run linters on modified files.
6363
- `/fetch-buildkite-logs` — pull build logs for CI failures.
64+
- `/backport-docs` — cherry-pick merged docs onto the release branch so they appear on `docs.ray.io/en/latest`.
6465

6566
See top-level `.claude/CLAUDE.md` for the full skill index.

doc/source/ray-contribute/agent-development.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The Ray repository includes shared Claude Code configuration that is version-con
2828
- `.claude/CLAUDE.md`: root instructions loaded in every session
2929
- `<library>/.claude/CLAUDE.md`: library-specific instructions loaded on-demand (for example, `python/ray/data/.claude/CLAUDE.md`)
3030
- `.claude/rules/`: coding rules scoped by file type
31-
- `.claude/skills/`: reusable workflows (rebuild, lint, fetch CI logs)
31+
- `.claude/skills/`: reusable workflows (rebuild, lint, fetch CI logs, backport docs)
3232
- `.claude/agents/`: project-specific subagents
3333

3434
Personal configuration lives in files that are **not** version-controlled:
@@ -110,6 +110,7 @@ Shared skills available in every session:
110110
- `/rebuild`: guided Ray rebuild based on what files changed
111111
- `/lint`: run linting and formatting checks
112112
- `/fetch-buildkite-logs`: fetch and analyze Buildkite CI logs
113+
- `/backport-docs`: cherry-pick merged docs onto a release branch so they appear on `docs.ray.io/en/latest`
113114

114115
### Adding team rules
115116

doc/source/ray-contribute/docs.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,20 @@ If you run into a problem building the docs, following these steps can help isol
441441
4. **Enable breakpoints in Sphinx.** Add `-P` to the `SPHINXOPTS` in `doc/Makefile` to tell `sphinx` to stop when it encounters a breakpoint, and remove `-j auto` to disable parallel builds. Now you can put breakpoints in the modules you're trying to import, or in `sphinx` code itself, which can help isolate stubborn build issues.
442442
5. **[Incremental build] Side navigation bar doesn't reflect new pages.** If you're adding new pages, they should always show up in the side navigation bar on index pages. However, incremental builds with `make local` skip rebuilding many other pages, so Sphinx doesn't update the side navigation bar on those pages. To build docs with a correct side navigation bar on all pages, consider using `make develop`.
443443
444+
(backport-docs-to-release)=
445+
446+
## Getting a docs change onto the released version
447+
448+
`docs.ray.io/en/latest` is built from the newest `releases/X.Y.Z` branch, not from `master`. A docs change merged to `master` appears on `docs.ray.io/en/master` right away, but only reaches the default `/latest` site once it's cherry-picked onto the current release branch.
449+
450+
If a merged docs change should be live on the released version — for example, documentation for a feature that has already shipped — open a cherry-pick pull request against the `releases/X.Y.Z` branch:
451+
452+
- Base the PR on `releases/X.Y.Z` and title it `[cherry-pick][X.Y.Z][docs] ...` to match the branch's convention.
453+
- Apply the commits with `git cherry-pick -x --signoff` to preserve provenance and the required DCO sign-off.
454+
- Before you start, check that the change isn't already backported under a different commit (`git log --oneline releases/X.Y.Z --grep "#<PR>)"`) and that no cherry-pick PR is already open against the branch.
455+
456+
If you use Claude Code, the `/backport-docs` skill walks through this end to end, including the build-safety checks. See {ref}`agent-development`.
457+
444458
## Where to go from here?
445459

446460
There are many ways to contribute to Ray other than documentation. See {doc}`our contributor guide <getting-involved>` for more information.

0 commit comments

Comments
 (0)