Skip to content

Publish reuses a stale Sphinx environment: two lectures publish as chapter 57, and mccall_risk is missing from nearly every sidebar #270

Description

@mmcky

Summary

publish.yml unpacks the cache.yml artifact into _build whole — including _build/.doctrees, the Sphinx environment from the run that produced the artifact — and never clears it. That environment holds cross-document state: the resolved toctree and the section numbering derived from it. Reusing it makes every page render its navigation from the table of contents as it stood when the artifact was built, however current the sources are.

publish-2026aug24 (37d8e85, run 32688898836) shipped that. The artifact in use was from 2026-08-17, because the three cache runs since had failed, and mccall_risk entered _toc.yml on 2026-08-21 with #264 — so the restored environment had never seen the new lecture.

Reader-visible symptoms, verified live 2026-08-24

Two lectures publish under the same chapter number, because the numbering came from a toctree that does not contain mccall_risk:

Page <title> as published Expected from _toc.yml
mccall_risk.html 57. 工作搜寻 V:风险敏感型偏好 57
mccall_persist_trans.html 57. 工作搜寻 V:持续性与暂时性工资冲击 58
career.html 58. 工作搜寻 VI:职业选择建模 59

The offset continues for the rest of the corpus (jv 59, odu 60).

The new lecture is missing from other pages' navigation. In the release asset — the build's own output, so this is not a deploy or CDN artefact — the Search section of career.html's navigation reads mccall_model, mccall_model_with_separation, mccall_model_with_sep_markov, mccall_fitted_vfi, mccall_persist_trans, jv, odu. mccall_risk is absent, though _toc.yml at the published commit lists it exactly once between mccall_fitted_vfi and mccall_persist_trans. Same omission on mccall_persist_trans.html. A reader can reach the new lecture only from the landing page.

This is separate from #266 (the undelivered upstream renumberings), though the two compound on the same two pages: #266 gives both lectures the numeral V, this issue gives both the number 57. Fixing either leaves the other.

What is not wrong

The build did not skip pages, and the deploy is faithful. The run log's HTML phase shows writing output for 145 docnames, including career, mccall_persist_trans and mccall_risk, and the release tarball matches the live site byte-for-byte on the pages checked. _toc.yml at 37d8e85 is correct and there were no toctree warnings. The pages are fresh; only the global state they were rendered against is stale.

Fix

Clear the restored Sphinx environment after the download, keeping _build/.jupyter_cache — the expensive notebook execution and the only part the artifact exists to supply. ci.yml already does this in a step named "Clear stale Sphinx environment"; publish.yml had it only as a commented-out line beside the HTML build.

PR: #272.

Why nothing caught it

Every signal was green: the workflow succeeded, all 145 pages return HTTP 200, bin/check-tofu --site reports no missing glyphs, and no link 404s. The defect lives only in cross-page consistency, which nothing currently checks — a whole-site invariant (every page's own section number agrees with the number the navigation gives it; every page in the ToC appears in every page's navigation) would have caught it before the tag went out.

Remediation

A cache run was dispatched on main 2026-08-24 (32710038106) and gates a re-cut. Sequence: green cache artifact → merge #272 → re-tag → confirm career.html lists mccall_risk and no two lectures share a chapter number.

Refs: #271 (the cache.yml gate defects that let the artifact go stale), #266 (the numeral collision this compounds with), QuantEcon/project-translation#48.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions