Skip to content

FIX: RTD build - remove broken TOC entries, fix AML image paths, build PDF in CI#1740

Merged
romanlutz merged 1 commit into
microsoft:mainfrom
romanlutz:romanlutz/fix-rtd-pdf-build
May 18, 2026
Merged

FIX: RTD build - remove broken TOC entries, fix AML image paths, build PDF in CI#1740
romanlutz merged 1 commit into
microsoft:mainfrom
romanlutz:romanlutz/fix-rtd-pdf-build

Conversation

@romanlutz
Copy link
Copy Markdown
Contributor

@romanlutz romanlutz commented May 18, 2026

Summary

The Read the Docs build for PyRIT has been failing silently for ~2 months. Most recent failed build: https://readthedocs.org/projects/pyrit/builds/32530550/

GitHub Actions kept passing because it only ran the HTML-only build, while RTD runs HTML + PDF and is stricter about TOC / image errors.

Root causes

  1. Broken TOC entries in doc/myst.yml (added in DOC improve API reference accuracy, structure, and readability #1469 and DOC: Add bibliography support with BibTeX citations across documentation #1472 in March 2026):

    • api/pyrit_setup_initializers.mdgen_api_md.py doesn't emit a separate page for pyrit.setup.initializers because the parent pyrit.setup has its own API members (the script only expands "pure-aggregate" modules into submodule pages).
    • api/pyrit_ui.mdpyrit/ui/ doesn't exist in the codebase.

    Both produced RTD-fatal Table of contents entry does not exist errors.

  2. Out-of-sync .ipynb AML image paths. The AML troubleshooting notebooks under doc/getting_started/troubleshooting/ referenced ./../../assets/aml_*.png (2 ../), which resolves to doc/assets/ — a directory that doesn't exist. The paired .py files correctly used ./../../../assets/ (3 ../), which resolves to the repo-root assets/ directory where the images actually live. The missing images caused xdvipdfmx:fatal: Image inclusion failed during the PDF export on RTD, and Cannot find image errors in the HTML build.

  3. GH Actions docs build was HTML-only. make docs-build runs jupyter-book build --all --html, so PDF-only regressions silently slipped past CI while RTD failed.

Changes

  • doc/myst.yml — removed the two missing TOC entries.
  • 3 .ipynb files under doc/getting_started/troubleshooting/ — synced AML image paths to ./../../../assets/ so they match the .py versions and correctly resolve to the repo-root assets/ directory.
  • Makefile — added a new docs-build-all target that mirrors RTD (jupyter-book build --all --html --pdf). Kept the existing docs-build (HTML-only) for fast local dev iteration since most contributors don't have xelatex/latexmk installed.
  • .github/workflows/docs.yml — installs texlive-xetex/latexmk and uses make docs-build-all so PDF regressions are caught in CI from now on.

Verification

  • Ran make docs-build locally — HTML build now reports 0 Table of contents entry does not exist errors and 0 Cannot find image errors (vs. 2 and 8 respectively on main).
  • The 16 Link has no URL errors in code/converters/*.ipynb from <a id=...> HTML anchors are pre-existing and out of scope here; they were present on every prior build too.

Notes for review

  • We might want to add --strict in the future.

…d PDF in CI

The Read the Docs build for PyRIT has been failing silently because:

1. doc/myst.yml referenced two API pages that do not exist:
   - api/pyrit_setup_initializers.md - gen_api_md.py does not emit a
     separate page for pyrit.setup.initializers (its parent pyrit.setup
     has its own API members, so the script doesn't expand into
     submodules)
   - api/pyrit_ui.md - the pyrit/ui/ module doesn't exist
   Both entries produced RTD-fatal 'Table of contents entry does not exist'
   errors (added in microsoft#1469 and microsoft#1472 in March 2026).

2. The AML troubleshooting notebooks under doc/getting_started/troubleshooting/
   referenced images via ./../../assets/aml_*.png which resolves to doc/assets/
   (a directory that doesn't exist). The paired .py files correctly used
   ./../../../assets/ (3 ../, resolving to the repo-root assets/ where the
   images actually live). The .ipynb / .py pair was out of sync. The missing
   images caused xdvipdfmx to abort during the PDF export on RTD.

3. The build-book GitHub Actions workflow only ran 'jupyter-book build --all
   --html' (HTML-only), so PDF-only regressions silently slipped past CI
   while RTD failed.

This change:
  - removes the two missing TOC entries from doc/myst.yml
  - syncs the .ipynb AML image paths to ./../../../assets/ matching the .py
    files
  - adds a 'docs-build-all' Makefile target that runs HTML + PDF together
    (mirroring RTD's 'jupyter-book build --all' behaviour)
  - updates .github/workflows/docs.yml to install texlive-xetex / latexmk
    and use 'make docs-build-all' so PDF regressions are caught in CI

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
romanlutz added a commit to romanlutz/PyRIT that referenced this pull request May 18, 2026
…ions

Closes microsoft#1741.

Append '--strict' to both 'docs-build' and 'docs-build-all' in the
Makefile so MyST errors (broken links, missing TOC entries, malformed
syntax, etc.) hard-fail CI instead of being silently emitted as
'⛔' lines in a green build. This is how RTD silently broke before
PR microsoft#1740.

To make '--strict' actually pass today, add a small, well-documented
'error_rules' block to 'doc/myst.yml' that ignores three categories
of errors which are inherently outside the project's control or
intentionally non-resolvable:

1. 'tex-renders' (blanket): mystmd v2.x has no LaTeX renderer for
   the MyST layout directives the project uses extensively
   ('grid', 'tabSet', 'details', 'mermaid'). They render fine in
   HTML. PDF export emits 'Unhandled LaTeX conversion for node of X'
   per node. Remove when upstream support lands.

2. 'link-resolves' for auth-required external API docs:
   'platform.openai.com/**', 'api.openai.com/**',
   'cognitiveservices.azure.com/**'. These always return 401/403
   from CI. URLs themselves are correct, just unverifiable
   without credentials.

3. 'link-resolves' for intentional placeholder URLs:
   'pyrit.shared.foo' (style-guide example),
   'account.blob.core.windows.net/...' (docstring placeholder shape),
   'PyRIT/releases/vx.y.z/**' (release-process template that
   operators substitute at release time).

4. 'link-resolves' for stale URLs in immutable historical blog
   posts and one current memory doc whose external target moved
   ('PyRIT/.../pdf_converter.ipynb' was deleted,
   'microsoft.github.io/PyRIT/**' old paths from before the v2
   site restructure, 'dbeaver.com/.../sqlite.html' link rot).
   Marked TODO for editorial cleanup in a follow-up.

Each suppression carries a comment explaining *why* the URL is
suppressed and what would need to change to remove the
suppression, so the allow-list stays honest.

Verified locally:
- 'cd doc && jupyter-book build --all --html --strict' → exit 0
- Same with a deliberately broken link added to 'doc/index.md':
  → exit 1, error reported, build stops. Confirms '--strict'
  is effective.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread Makefile
@hannahwestra25 hannahwestra25 self-assigned this May 18, 2026
@romanlutz romanlutz added this pull request to the merge queue May 18, 2026
Merged via the queue into microsoft:main with commit 6850d2e May 18, 2026
48 checks passed
@romanlutz romanlutz deleted the romanlutz/fix-rtd-pdf-build branch May 18, 2026 18:40
romanlutz added a commit to romanlutz/PyRIT that referenced this pull request May 18, 2026
The merge brought in main's docs-build-all (from PR microsoft#1740) while our branch already had it (since we merged the same PR microsoft#1740 branch earlier). The duplicate-second-wins behavior of make would have silently dropped --strict from docs-build-all. Removed the duplicate (without --strict).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants