Skip to content

Commit f6dde71

Browse files
committed
fix(35-S6): retry intersphinx inventory fetches on transient network errors
1 parent 20a181a commit f6dde71

3 files changed

Lines changed: 50 additions & 0 deletions

File tree

‎docs/conf.py‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,32 @@
229229
"pyformlang": ("https://pyformlang.readthedocs.io/en/latest/", None),
230230
}
231231

232+
# CI runners occasionally drop outbound connections mid-fetch (2026-09-16:
233+
# networkx.org reset the connection, leaving every networkx cross-reference
234+
# unresolved and failing the build under the no-warnings policy). Retry
235+
# transient connection errors; when all attempts fail, the error propagates
236+
# and the build still fails.
237+
import time as _time
238+
239+
from requests.exceptions import ConnectionError as _RequestsConnectionError
240+
from requests.exceptions import Timeout as _RequestsTimeout
241+
from sphinx.util import requests as _sphinx_requests
242+
243+
_orig_intersphinx_get = _sphinx_requests.get
244+
245+
246+
def _get_with_retries(url, *args, retries=3, backoff=2.0, **kwargs):
247+
for attempt in range(retries + 1):
248+
try:
249+
return _orig_intersphinx_get(url, *args, **kwargs)
250+
except (_RequestsConnectionError, _RequestsTimeout):
251+
if attempt == retries:
252+
raise
253+
_time.sleep(backoff * (attempt + 1))
254+
255+
256+
_sphinx_requests.get = _get_with_retries
257+
232258
# The reST default role (used for this markup: `text`) to use for all
233259
# documents.
234260
default_role = "obj"

‎docs/developer.rst‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ HTML, checking links) live in :file:`docs/README.md`. Two policies matter:
108108
- **Full link check.** ``sphinx-build -b linkcheck`` verifies every local
109109
target and external URL (two documented exceptions in
110110
:file:`docs/conf.py`); it exits non-zero on broken or timed-out links.
111+
- **Resilient inventory fetches.** Intersphinx inventories are fetched with
112+
retries on transient connection errors (:file:`docs/conf.py`); a persistent
113+
failure still warns and fails the build.
111114

112115
Both the build and the link check run in CI on every push and pull request
113116
(:file:`.github/workflows/docs.yml`).

‎tasks/detailed_plan.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,24 @@ plan records only what is specific to this run.
8989
`[5.0.0]` changelog section.
9090
- Prepend `[done] ` to the task 35 line in `tasks/tasks.md` (local commit on
9191
`dev`; pushed with the next dev push — the release itself is already out).
92+
93+
### S6: Make intersphinx inventory fetches resilient to transient network errors
94+
95+
Added 2026-09-16 at the merge gate (user: "CI report set of warnings ... Fix
96+
it"). The first CI run on `20a181a` failed its Docs build because the runner's
97+
connection to `networkx.org` was reset while fetching the intersphinx
98+
inventory; with the inventory missing, every `nx.MultiDiGraph` cross-reference
99+
went unresolved and failed the build under the no-warnings policy. A second
100+
run of the same commit passed — the failure was a transient network flake, not
101+
a docs defect.
102+
103+
**Code:** `docs/conf.py` (retry wrapper around `sphinx.util.requests.get`)
104+
**Tests:** skip — build configuration only; verified by a clean docs build
105+
**Docs:** `docs/developer.rst` ("Docs build and deploy" section)
106+
107+
**Spec:**
108+
- Retry only transient connection errors (`ConnectionError`, `Timeout`); a
109+
final failure propagates, so the warning still fires and the build still
110+
fails — no suppression.
111+
- Note the behavior in the "Docs build and deploy" section of
112+
`docs/developer.rst`.

0 commit comments

Comments
 (0)