Repository navigation
[doc] rtd: walk origin/master (not shallow HEAD) to find the doc cache - #64482
Merged
Merged
Conversation
find_latest_master_commit() ran `git log` with no ref, i.e. against HEAD. But Read the Docs checks out PRs with `git clone --depth 1`, so HEAD is grafted and the walk sees ~1 commit -- it never probes a real master commit. post_checkout deepens origin/master to 500 commits, but the consumer looked at HEAD, not origin/master, so the two never meet. Result: load_doc_cache.py always raises "No cache found", `make rtd` fails, and every PR preview falls through to a full `git clean` + cold Sphinx build (~3,967 sources) -- chronically near the RtD time limit, and timing out when the full build runs slow. Walk origin/master -- the ref post_checkout already deepened -- instead. Fall back to HEAD when origin/master is unavailable (e.g. a local checkout without the remote-tracking ref); the `|| make rtd-fallback` clause still covers a genuine cache miss. This is the consumer side of the incremental RtD build (#64277); the producer was repaired in #64414. Merging master did not help affected PRs because the shallow graft means `git log HEAD` never reaches a merged-in cached commit. Verified: the modified find_latest_master_commit() returns a live cached commit (0c1f570...) against origin/master where the HEAD walk returned nothing. Related to DOC-1047 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Ronny Roland <[email protected]>
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates find_latest_master_commit in doc/load_doc_cache.py to fall back to HEAD if origin/master is unavailable, addressing issues with shallow clones on Read the Docs. The reviewer suggested using subprocess.run to check for the ref's existence, which simplifies the logic and avoids a try-except block.
Address review (@gemini-code-assist, endorsed by @dstrodtman): replace the try/except check_output with subprocess.run(...).returncode == 0 so the ref check no longer uses an exception for control flow. Related to DOC-1047 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Ronny Roland <[email protected]>
elliot-barn
approved these changes
Jul 1, 2026
edoakes
pushed a commit
that referenced
this pull request
Jul 8, 2026
…4599) ## Why The incremental RtD PR-preview build (added in #64277) isn't paying off, and a clean build is faster and lower-variance in practice. Opening as a draft for @ronny-anyscale to review, since this is your workstream. Present-state evidence from read-only RtD build logs (project `anyscale-ray`, 2026-07-08): - Every PR preview downloads the master doctree cache successfully, then Sphinx discards all of it and rebuilds every document: ``` Use build cache for commit 1319e11... updating environment: [config changed ('intersphinx_mapping')] 3968 added, 1 changed, 0 removed ``` `3968 added` = full rebuild. The discard reason has moved from `[new config]` (the version-skew fixed by #64414/#64482) to `[config changed ('intersphinx_mapping')]` / `[config changed ('llms_txt_exclude')]` — a config value that differs between the postmerge cache producer and the RtD build environment. - So the cache download and extract are pure overhead, and when the incremental leg trips a warning the build does a second full clean build (near 2× wall-clock). - Measured: clean full builds land at ~7–9 min (master builds 418–525s), faster than most PR "incremental" builds (466–1195s, median ~640s). Turning the incremental leg off reduces both wall-clock and shared-slot queue pressure versus today. ## What this changes Collapses the `build.jobs.build.html` override so every build — PR previews and branch/tag builds alike — runs a full clean `make -C doc html`. The `rtd` / `rtd-fallback` Makefile targets and `doc/load_doc_cache.py` stay in the tree so the incremental path can be re-enabled later. ## Re-enable criteria (not in this PR) 1. Cache reuse actually works — a PR preview logs `N changed` rather than `NNNN added` — which needs the config-determinism gap closed (`intersphinx_mapping`, `llms_txt_exclude`, and any other env-signature config that differs between producer and RtD). 2. Stale-artifact pruning lands for PRs that rename/delete sources, so incremental previews don't publish stale pages. The `post_checkout` skip guard (skip PR builds that don't touch doc-affecting files) is unchanged — it's orthogonal and still valuable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Douglas Strodtman <[email protected]>
elliot-barn
pushed a commit
that referenced
this pull request
Jul 9, 2026
#64482) ## Description Fixes the **consumer** side of the incremental Read the Docs build. `find_latest_master_commit()` never finds the doc cache, so every PR preview falls through to a full cold build — chronically near the RtD time limit, and timing out when the full build runs slow. ### Root cause `find_latest_master_commit()` (`doc/load_doc_cache.py`) ran `git log` with **no ref** — i.e. against `HEAD`. But Read the Docs checks out PRs with `git clone --depth 1`, so `HEAD`'s history is grafted: the walk sees ~1 commit and never probes a real master commit. `post_checkout` deepens `origin/master` to 500 commits, but the consumer looked at `HEAD`, not `origin/master` — the two never meet. So `load_doc_cache.py` always raises `No cache found for latest master commit`, `make rtd` fails, and `|| make rtd-fallback` does a full `git clean` + cold Sphinx build (~3,967 sources) on every build. This is independent of the producer: even after #64414 repaired cache production (caches are flowing again — e.g. `0c1f570a8bf1`, `5612883ea63f` serve 200 today), the consumer still couldn't reach them. It also explains why *merging master didn't help* affected PRs — the shallow graft means `git log HEAD` never reaches a merged-in cached commit either. ### Fix Walk `origin/master` — the ref `post_checkout` already deepened — instead of `HEAD`. Falls back to `HEAD` when `origin/master` isn't available (e.g. a local checkout without that remote-tracking ref), and the existing `|| make rtd-fallback` still covers a genuine cache miss. ### Verified Ran the modified `find_latest_master_commit()` against the live cache: it returns `0c1f570a8bf1` (a real cached master commit) where the old `HEAD` walk returned nothing usable. `ruff` + `black` clean. ## Related issues Consumer side of the incremental RtD build (**#64277**); producer repaired in **#64414**. Related to **[DOC-1047](https://anyscale1.atlassian.net/browse/DOC-1047)** (epic DOC-1046). ## Additional information Credit to the reviewer who pinpointed the shallow-`HEAD` / wrong-ref root cause. This is only fully exercised on a real RtD PR build (the `--depth 1` clone + `post_checkout` deepen), so worth confirming on this PR's own preview that it logs `Use build cache for commit …` and an incremental `N changed` instead of `3967 added, 0 changed`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Ronny Roland <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: elliot-barn <[email protected]>
400Ping
pushed a commit
to 400Ping/ray
that referenced
this pull request
Aug 18, 2026
ray-project#64482) ## Description Fixes the **consumer** side of the incremental Read the Docs build. `find_latest_master_commit()` never finds the doc cache, so every PR preview falls through to a full cold build — chronically near the RtD time limit, and timing out when the full build runs slow. ### Root cause `find_latest_master_commit()` (`doc/load_doc_cache.py`) ran `git log` with **no ref** — i.e. against `HEAD`. But Read the Docs checks out PRs with `git clone --depth 1`, so `HEAD`'s history is grafted: the walk sees ~1 commit and never probes a real master commit. `post_checkout` deepens `origin/master` to 500 commits, but the consumer looked at `HEAD`, not `origin/master` — the two never meet. So `load_doc_cache.py` always raises `No cache found for latest master commit`, `make rtd` fails, and `|| make rtd-fallback` does a full `git clean` + cold Sphinx build (~3,967 sources) on every build. This is independent of the producer: even after ray-project#64414 repaired cache production (caches are flowing again — e.g. `0c1f570a8bf1`, `5612883ea63f` serve 200 today), the consumer still couldn't reach them. It also explains why *merging master didn't help* affected PRs — the shallow graft means `git log HEAD` never reaches a merged-in cached commit either. ### Fix Walk `origin/master` — the ref `post_checkout` already deepened — instead of `HEAD`. Falls back to `HEAD` when `origin/master` isn't available (e.g. a local checkout without that remote-tracking ref), and the existing `|| make rtd-fallback` still covers a genuine cache miss. ### Verified Ran the modified `find_latest_master_commit()` against the live cache: it returns `0c1f570a8bf1` (a real cached master commit) where the old `HEAD` walk returned nothing usable. `ruff` + `black` clean. ## Related issues Consumer side of the incremental RtD build (**ray-project#64277**); producer repaired in **ray-project#64414**. Related to **[DOC-1047](https://anyscale1.atlassian.net/browse/DOC-1047)** (epic DOC-1046). ## Additional information Credit to the reviewer who pinpointed the shallow-`HEAD` / wrong-ref root cause. This is only fully exercised on a real RtD PR build (the `--depth 1` clone + `post_checkout` deepen), so worth confirming on this PR's own preview that it logs `Use build cache for commit …` and an incremental `N changed` instead of `3967 added, 0 changed`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Ronny Roland <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: 400Ping <[email protected]>
400Ping
pushed a commit
to 400Ping/ray
that referenced
this pull request
Aug 18, 2026
…y-project#64599) ## Why The incremental RtD PR-preview build (added in ray-project#64277) isn't paying off, and a clean build is faster and lower-variance in practice. Opening as a draft for @ronny-anyscale to review, since this is your workstream. Present-state evidence from read-only RtD build logs (project `anyscale-ray`, 2026-07-08): - Every PR preview downloads the master doctree cache successfully, then Sphinx discards all of it and rebuilds every document: ``` Use build cache for commit 1319e11... updating environment: [config changed ('intersphinx_mapping')] 3968 added, 1 changed, 0 removed ``` `3968 added` = full rebuild. The discard reason has moved from `[new config]` (the version-skew fixed by ray-project#64414/ray-project#64482) to `[config changed ('intersphinx_mapping')]` / `[config changed ('llms_txt_exclude')]` — a config value that differs between the postmerge cache producer and the RtD build environment. - So the cache download and extract are pure overhead, and when the incremental leg trips a warning the build does a second full clean build (near 2× wall-clock). - Measured: clean full builds land at ~7–9 min (master builds 418–525s), faster than most PR "incremental" builds (466–1195s, median ~640s). Turning the incremental leg off reduces both wall-clock and shared-slot queue pressure versus today. ## What this changes Collapses the `build.jobs.build.html` override so every build — PR previews and branch/tag builds alike — runs a full clean `make -C doc html`. The `rtd` / `rtd-fallback` Makefile targets and `doc/load_doc_cache.py` stay in the tree so the incremental path can be re-enabled later. ## Re-enable criteria (not in this PR) 1. Cache reuse actually works — a PR preview logs `N changed` rather than `NNNN added` — which needs the config-determinism gap closed (`intersphinx_mapping`, `llms_txt_exclude`, and any other env-signature config that differs between producer and RtD). 2. Stale-artifact pruning lands for PRs that rename/delete sources, so incremental previews don't publish stale pages. The `post_checkout` skip guard (skip PR builds that don't touch doc-affecting files) is unchanged — it's orthogonal and still valuable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Douglas Strodtman <[email protected]> Signed-off-by: 400Ping <[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.
Description
Fixes the consumer side of the incremental Read the Docs build.
find_latest_master_commit()never finds the doc cache, so every PR preview falls through to a full cold build — chronically near the RtD time limit, and timing out when the full build runs slow.Root cause
find_latest_master_commit()(doc/load_doc_cache.py) rangit logwith no ref — i.e. againstHEAD. But Read the Docs checks out PRs withgit clone --depth 1, soHEAD's history is grafted: the walk sees ~1 commit and never probes a real master commit.post_checkoutdeepensorigin/masterto 500 commits, but the consumer looked atHEAD, notorigin/master— the two never meet. Soload_doc_cache.pyalways raisesNo cache found for latest master commit,make rtdfails, and|| make rtd-fallbackdoes a fullgit clean+ cold Sphinx build (~3,967 sources) on every build.This is independent of the producer: even after #64414 repaired cache production (caches are flowing again — e.g.
0c1f570a8bf1,5612883ea63fserve 200 today), the consumer still couldn't reach them. It also explains why merging master didn't help affected PRs — the shallow graft meansgit log HEADnever reaches a merged-in cached commit either.Fix
Walk
origin/master— the refpost_checkoutalready deepened — instead ofHEAD. Falls back toHEADwhenorigin/masterisn't available (e.g. a local checkout without that remote-tracking ref), and the existing|| make rtd-fallbackstill covers a genuine cache miss.Verified
Ran the modified
find_latest_master_commit()against the live cache: it returns0c1f570a8bf1(a real cached master commit) where the oldHEADwalk returned nothing usable.ruff+blackclean.Related issues
Consumer side of the incremental RtD build (#64277); producer repaired in #64414. Related to DOC-1047 (epic DOC-1046).
Additional information
Credit to the reviewer who pinpointed the shallow-
HEAD/ wrong-ref root cause. This is only fully exercised on a real RtD PR build (the--depth 1clone +post_checkoutdeepen), so worth confirming on this PR's own preview that it logsUse build cache for commit …and an incrementalN changedinstead of3967 added, 0 changed.🤖 Generated with Claude Code