Skip to content

site-build: intermediate joins the base environment on the GPU leg - #99

Merged
mmcky merged 2 commits into
mainfrom
site-build/intermediate
Nov 26, 2026
Merged

mmcky merged 2 commits into
mainfrom
site-build/intermediate

Conversation

@mmcky

@mmcky mmcky commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

The fourth step of the site builds in Matt's order of 2026-11-22 (intro, advanced, then the GPU sites: programming, intermediate and jax): intermediate builds from the pool on the GPU leg, in the base environment, as programming does since #87.

What changes

  • sites/intermediate/site.yml gains environment: base. On the GPU leg that means _base/environment.yml is created on the RunsOn machine, _base/environment-update.yml is applied, and jax[cuda13] is added at the list's jax version.
  • site-build.yml: SITES gains intermediate, and the header and the GPU leg's notes name it. jax is the one site left.
  • The job's time limit. tools/site-matrix gives each leg cell_timeout plus an allowance for a build from an empty cache. intermediate's own builds from an empty cache took 128 to 139 minutes in November 2026 (twelve cache.yml runs), so the old allowance of 120 minutes would have left intermediate a limit of 160, about 20 minutes above its slowest build. The allowance is now 150 minutes, so intermediate's limit is 190 minutes. The limit is only a ceiling: it changes no key and no build, and costs time only on a hung job. The tests follow.
  • The docs: README.md, sites/README.md, _base/README.md and the list's header name the five sites built.

Checks before this pull request

  • The machine image. The AMI in tools/site-matrix, ami-0edec81935264b6d3, is the one the three GPU series' .github/runs-on.yml name: QuantEcon/lecture-python.myst, QuantEcon/lecture-jax and QuantEcon/lecture-python-programming, read 2026-11-26. intermediate's own fresh builds today ran on it.
  • The text. By the ledger, intermediate is the canonical source of 156 of the 157 pool lectures its table of contents lists. The other, pandas_panel (canonical in programming), has the same text as intermediate's copy. So the site's lecture text is intermediate's own at its pin, eb06599.
  • The installs. tools/pool-check --installs lists no install that would replace a pin. The --upgrade jax in kesten_processes was removed upstream (Raise the build stack to the shared baseline, pin jax 0.12.1, drop --upgrade from install lines lecture-python.myst#1135).
  • The cache. The list's header edit is a comment. Since environment: plotly-orca leaves the list; key the base cache on its entries; dp publishes notebooks #98 the base key hashes only the list's entries, so intro, advanced and programming should restore their caches; this is the first test of that.

Validation (to follow, in a comment)

This pull request's intermediate leg builds from an empty cache, about 2.5 hours on the T4. It will be compared page by page with intermediate's own fresh builds of eb06599 from today: QuantEcon/lecture-python.myst 45766690882, and a second for the noise baseline, QuantEcon/lecture-python.myst 45804060322. The comparison covers log warnings, cell-output warnings and errors, in-cell installs and every page with its figures. It adds a per-page GPU check: every lecture that uses jax ran it on the GPU, as in intermediate's own builds, with no fallback to the CPU.

Copilot: not requested (Matt, 2026-11-22).

🤖 Generated with Claude Code

https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG

mmcky and others added 2 commits November 26, 2026 21:46
- sites/intermediate/site.yml: environment: base, as programming's.
- site-build.yml: SITES gains intermediate; the header and the GPU leg's
  notes name it, and the GPU leg's AMI is the one the three GPU series'
  .github/runs-on.yml name (all three checked 2026-11-26).
- tools/site-matrix: BUILD_ALLOWANCE 150 minutes (was 120). intermediate's
  own builds from an empty cache took 128 to 139 minutes in November 2026,
  so its limit is 40 + 150 = 190 minutes; the tests follow.
- README.md, sites/README.md, _base/README.md and the list's header: the
  five sites built, intermediate among the base sites; jax is the last.

The list's header edit is a comment, so the base sites' cache key is
unchanged and intro, advanced and programming restore their caches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG
@mmcky

mmcky commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor Author

Validation: intermediate built from the pool on the GPU leg, against intermediate's own builds

The builds compared. All three are of intermediate's lectures at eb06599, the pool's pin and intermediate's main.

Build Run What
This pull request at bfb6f86 (main 78f1eda merged in), intermediate leg 45815408131 from the pool on the RunsOn T4, base environment, strict (-n -W), cold, with the notebooks (#104); 2 h 13 min against the leg's new limit of 190 min
intermediate's own, fresh QuantEcon/lecture-python.myst 45766690882 cache.yml on main, 2026-11-26
intermediate's own, fresh again QuantEcon/lecture-python.myst 45804060322 the same, hours later, for the noise baseline

The first push's run was cancelled when main was merged in: the merged head adds the notebook build, so the leg ran again on it.

  • The build: all 161 pages ok; 159 executed and 2 from the cache (pages with no code cell). The report counts them although the notebooks were built after the HTML, which shows site-build: build the notebooks of a site that publishes them, and serve them at _notebooks/ #104's ordering keeps the cache save working on a cold build. 161 notebooks were copied into _notebooks/. No Sphinx warning.
  • The GPU, page by page. No page of any of the three builds has jax's CPU-fallback warning or a CUDA error, and each status page reports a Tesla T4. The 34 pages that import jax took 0.83 to 1.06 times as long as in intermediate's own builds; kesten_processes is the fastest relative, because its install cell finds its packages already installed. A page that fell back to the CPU would take several times as long.
  • The other legs restored main's caches and executed nothing: dp, intro, advanced and programming.
  • The noise baseline: intermediate's own two builds differ on 36 of 176 pages, all in their outputs, with identical log warnings.

The pages: 143 of 176 differ from intermediate's own build. Every difference is explained:

Pages What differs
101 only the generated ids of citation links (zreferences.html#id241 against #id20): the pool builds with its merged bibliography, so the anchors number differently. Nothing a reader sees
35 output noise; every one is among the 36 pages intermediate's own two builds differ on (unseeded draws, sampling, timings, progress bars, a memory address)
aiyagari, house_auction, back_prop the output of an install cell. The pool's environment already holds quantecon, prettytable and kaleido, so pip prints "Requirement already satisfied" where intermediate's own build downloads them; programming showed the same (#87)
hoist_failure a speed-up, 26x against 25x
linear_algebra, linear_models one link each to a PDF the lecture offers. Intermediate's points at its live site's _static/; the pool's at the site's own _downloads/, the copy promotion keeps beside the lecture. Same file, served by the site itself
zreferences the merged bibliography, below

Cell outputs: the warnings and errors are the same on both sides, page by page, except ar1_bayes' "RuntimeWarning: overflow encountered in dot". It appears in one of intermediate's own two builds and not the other, so it's sampling noise.

The references page. 593 entries on both sides, of which 21 render differently, all from the pool's merged bibliography, which every pool site shares:

  • 18 lose their month (for example "Econometrica, 58(5):1041–1063, September 1990" against "…, 1990");
  • three lose an empty doi:., two of them as well as a month;
  • one page range loses its spaces ("1 – 68" becomes "1–68");
  • one title is capitalised by a pool ruling (hansen1995discounted: "Gaussian control", "Automatic Control").

All four kinds are the house style the merge applies on purpose (tools/bib-merge's normalising: month and empty fields dropped, page ranges and DOIs normalised, after QuantEcon's manual, "Writing a bibliography entry"); intermediate's own .bib still carries months. None comes from this pull request. (Corrected minutes after posting: the first version called these something to follow up.)

Conclusion. intermediate builds from the pool on the GPU leg, strict, in the base environment, with every page ok and every jax page on the GPU. The site matches intermediate's own build except for the merged bibliography's citations, the pool's environment, and noise of the kinds intermediate's own builds show between runs.

Corrected 2026-11-27: this said 29 pages import jax. The check matched import jax in each page's raw HTML, where code highlighting splits it across tags, so it missed five. Matched on the page text instead, the count is 34, and the range, the fallback check and the GPU are unchanged.

@mmcky
mmcky merged commit fb579c7 into main Nov 26, 2026
11 checks passed
@mmcky
mmcky deleted the site-build/intermediate branch November 26, 2026 21:55
mmcky added a commit that referenced this pull request Nov 27, 2026
The last step of the site builds in Matt's order of 2026-11-22 (intro, advanced, then the GPU sites: programming, intermediate and jax): jax builds from the pool on the GPU leg, in the base environment, as programming (#87) and intermediate (#99) do. With it, `site-build.yml` builds all six sites.

## What changes

- **`sites/jax/site.yml`** gains `environment: base`. On the GPU leg that means `_base/environment.yml` is created on the RunsOn machine, `_base/environment-update.yml` is applied, and `jax[cuda13]` is added at the list's jax version (0.12.1, the version jax's own workflows pin). Its other fields, re-read at lecture-jax `3431f12` (the pin) on 2026-11-27, are unchanged.
- **`site-build.yml`**: `SITES` gains `jax`, and the header and the GPU leg's notes name it.
- **The time limit** needs no change: jax's `cell_timeout` is 2400 seconds, so its limit is 40 + 150 = 190 minutes, against its own builds from an empty cache of 20 to 23 minutes (the ten `cache.yml` runs in November 2026 before this pull request; an earlier version of this description said eight).
- **The docs.** With jax in, the base sites are every site but dp, so `README.md`, `sites/README.md`, `_base/README.md` and the list's header say that, instead of listing the sites in each place. intermediate's build times now stay in `tools/site-matrix` alone, with jax's added beside them; `sites/README.md` points there.
- **The organiser's nits on #99**, in the lines this edits anyway: the list's header names #99 and this pull request; the stray `names, with` line in `site-build.yml`'s notes is rewrapped; and `tools/site-matrix`'s AMI note says when it was last read.

## Checks before this pull request

- **The machine image.** The AMI in `tools/site-matrix`, `ami-0edec81935264b6d3`, is still the one the three GPU series' `.github/runs-on.yml` name (QuantEcon/lecture-jax, QuantEcon/lecture-python.myst and QuantEcon/lecture-python-programming), read 2026-11-27.
- **The text.** By the ledger, jax is the canonical source of 27 of the 28 pool lectures its table of contents lists. The other, `autodiff` (canonical in programming), has the same digest as jax's copy. So the site's lecture text is jax's own at its pin, `3431f12`, which is lecture-jax's main.
- **The installs.** `tools/pool-check --installs` lists no install that would replace a pin. jax's lectures install `quantecon`, `keras`, `optax` and `jax` in their cells, and all four are in the list. In jax's own builds those cells fetch the newest releases, so a version difference shows up in the comparison, not as a failure.
- **The cache.** The list's header edit is a comment. Since #98 the base key hashes only the list's entries, so the other base sites restore their caches, as on #99.
- Locally: tests 330 passed and 1 skipped; pool-check clean; `tools/site-matrix` gives jax the GPU leg, the base environment and 190 minutes; actionlint clean.

## Validation (to follow, in a comment)

This pull request's jax leg builds from an empty cache. It will be compared page by page with two fresh builds of jax's own site at `3431f12`, dispatched today: [QuantEcon/lecture-jax 45901655935](https://github.com/QuantEcon/lecture-jax/actions/runs/45901655935), and a second for the noise baseline, [QuantEcon/lecture-jax 45901668136](https://github.com/QuantEcon/lecture-jax/actions/runs/45901668136). The comparison covers log warnings, cell-output warnings and errors, in-cell installs and every page with its figures. It adds a per-page GPU check: every lecture that uses jax ran it on the GPU, as in jax's own builds, with no fallback to the CPU.

Copilot: not requested (Matt, 2026-11-22).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG
mmcky added a commit that referenced this pull request Dec 3, 2026
…, every difference classified (#129)

The first piece of QuantEcon/project-monorepo#26, as re-cut on 2026-12-03 from the owner's decisions after a review of phase 4: the comparison a cutover is decided on. It is ported from the validations already run by hand on #84, #99, #105 and others.

**Reworked in `0deb1f2` after the first review,** which found real defects the first version missed (each demonstrated on real intermediate pages, each now a test). **Then `a21757a`, after the delta review:**
- a different message of the same warning class now blocks;
- the header's page-history link is compared, since the per-page View Source link sits in an HTML comment on today's theme;
- root-absolute links, links at the site's own address, and files a notebook names at that address (a `_static/` figure) are resolved in the build;
- a redirect stub's script target is compared;
- one new code block no longer counts against every block after it.

**Then `3bb3e97`, after a second delta review:**
- a site served under a path, as dp is at `quantecon.github.io/lecture-dp/`, has its own address resolved (the canonical's path less the page's), so a lost figure a notebook names is caught there and a figure the pool's layout moved is no false defect;
- with no canonical in the candidate, the reference's is used, and each page's canonical is compared under links;
- a warning's numbers, memory addresses, temporary paths and times are set aside, as values;
- a script's target counts only in a script that redirects.

The table below is the tool as it now stands.

**`tools/site-compare`** compares two HTML builds: a series' own build (its release, or its repository built at a commit) and the monorepo's build of the same site (the `html-<key>` artefact `site-build.yml` makes, which `publish.yml` releases).

**What it compares:**

| Check | What it compares | Blocks? |
|---|---|---|
| inventory | files only in one build | yes |
| text | each page's prose; only build ids (UUIDs, long hashes, `?v=`) set aside, every date, number and word kept | yes |
| code | code blocks line by line, indentation kept | yes |
| structure | counts of exercises, proofs, maths, tables, admonitions | yes |
| links | a page's links as one list, and its canonical link; hashed asset paths set aside | yes |
| targets | a link or image newly broken in the candidate: relative, root-absolute or at the site's own address (from its canonical link); and a file a notebook names at that address | yes |
| launch-links | Colab, notebook and PDF links that aren't prose links (the toolbar's) | yes |
| source-link | GitHub links that aren't prose links (the header's page-history link), by path within the repository (QuantEcon/quantecon-book-theme#452) | yes |
| redirects | a redirect stub's meta refresh and script target; `_rediraffe_redirected.json` | yes |
| warnings | per output block: `…Warning:`, `…Error:`, `WARNING`, traceback headers, each by its class and message (numbers, dates, times, addresses and temporary paths set aside); traceback and stderr blocks | yes |
| figures | the images on a page, and an image file the candidate names but lacks | yes |
| figure-bytes | each `_images/` figure's bytes, in order | reported |
| outputs | output text, dates and durations set aside | reported |
| labels | `objects.inv`: a lost label blocks, a new one is reported | lost: yes |
| notebooks | kernel; markdown by text, code line by line with indentation; ids and other metadata set aside | yes |

**Classes.** Every difference is one of:
- **expected:** an entry of an expected-difference list covers it, with its reason;
- **lag:** it is in a lecture changed since the reference's commit (`--lag`), except a warning, a lost file or a lost target, which always block;
- **defect;**
- **reported:** it never blocks, under the owner's rule of 2026-12-03 (values, timings, pixels).

**The expected-difference lists.** They are YAML: the shared `sites/compare-expected.yml` (this PR) and `sites/<key>/compare-expected.yml`, changed only by reviewed pull request. An entry can cover:
- a whole difference;
- only the lines a `lines` pattern finds, with the rest classified on;
- a `normalise` pattern, set aside before comparing, whose pages the report counts.

`tools/affected-sites` now treats these lists as no build's input, so editing one rebuilds nothing. The tool writes `report.json` and `report.md`. It exits 1 on a defect, and 3 when the comparison itself fails (a crash, or pyyaml missing), which is not a finding.

**Calibration on intermediate.** The reference is its release publish-2026nov30b (QuantEcon/lecture-python.myst at `3437219`). The candidate is the monorepo's `html-intermediate` from site-build run 47031722447, at `9728988`. The run went in six steps:

1. With no list: 280 defects, almost all citation anchors (`zreferences.html#idN`), which the merged bibliography numbers differently.
2. With the shared list's bibliography, status-page and PDF-link entries: 15 defects, all notebook image links that differ only in the pool's `_static/<slug>/` layout.
3. With that layout entry: 7.
4. With equation UUIDs set aside in notebooks, and the status and bibliography entries covering their notebooks: 2 defects, 8 expected, 6 lag, 46 reported.
5. With the reworked tool (`0deb1f2`), whose checks are stricter: 2 defects, 6 expected, 5 lag, 48 reported. The same two defects remain; the shared list's PDF entry now sets aside only the folder.
6. With `a21757a`, which compares the page-history link: **6 defects, 6 expected, 5 lag, 48 reported.**

The lag items are newton_method, changed since the release by #125. The reported items are output values and figure bytes.

**The six defects are real,** and go on no list here:
- **Two notebooks' PDF links.** `linear_algebra.ipynb` and `linear_models.ipynb` link "these notes" (a PDF) relatively, as `_static/<slug>/….pdf`. A notebook opened in Colab can't follow such a link. The series' notebooks link the live site's absolute address. The cause is #45 (promote's rule 7, open).
- **Four site pages without a page history.** The monorepo's intro, status, troubleshooting and zreferences pages, which come from `sites/intermediate/`, show no page-history link and no list of recent commits; the series' pages do. The lectures' pages have theirs (`QuantEcon/lectures/commits/main/lectures/<slug>.md`). Whether site-build should give these pages a history, or the shared list should accept the difference, is a question for the calibration report on QuantEcon/project-monorepo#26. Either way they will need a list entry: a history link site-build gave them would rightly point at `sites/intermediate/<page>.md`, which still differs from the series' `lectures/<page>.md`.

`3bb3e97` leaves the calibration unchanged: the same 6 defects, 6 expected, 5 lag and 48 reported.

**Tests:**
- `tools/tests/test_site_compare.py`, 75 tests:
  - one per planted defect: a removed paragraph, a missing figure, a broken link, a dropped notebook, a lost label, a new warning, a lost redirect, an edited notebook cell, a View Source link without `lectures/`;
  - identical builds, and notebook ids or metadata alone, give nothing;
  - values and pixels are reported, and a new label is reported;
  - entries with reasons, partial lines and normalising;
  - lag;
  - bad lists, and the Markdown report.
- One test for each false negative the first review demonstrated: dates and decades in prose, indentation, notebook code and kernel, SyntaxError and bare-warning outputs, a missing figure file, a broken target, a redirect stub, a launch link, a prose GitHub link, external links, structure, lag not covering warnings or lost files, a normalise entry's scope, and the shared PDF entry.
- One test for each gap the delta review found, each checked against a mutation of the guard it pins: a same-class warning with a new message, a traceback header alone, a lost target on a lag page, a kernel change alone, an image outside `_images/`, a root-absolute link, a notebook's self-site `_static/` URL (and another site's address left alone), a redirect's script target, the history link's path and its absence, and a new code block's count.
- One test for each point of the second delta review, which also found guards no test pinned (the host check, the subtraction of what the reference already lacks, the site address in a page's targets, the exit code without pyyaml); all 12 mutations of the new guards now fail a test: a site under a path (a lost figure; a moved one), a page in a folder, http and https, a candidate without a canonical, a URL broken in both builds, a URL inside an HTML attribute, a warning's values, a script that doesn't redirect, and pyyaml missing.
- The affected-sites cases for the lists, and pool-check now allowing them.
- Full suite: 609 passed, 1 skipped.

**Left for a follow-up pull request** (the last review's nits, none blocking): tests for guards still unpinned (root-absolute paths under the prefix, another path on the same host, the per-page canonical fallback, scheme and case); a script that reads `location.href` but doesn't redirect (plotly's bundle) still counts as a redirect script; a double slash after the prefix resolves outside the build; and the warnings key's number pattern also sets aside digits inside identifiers (`float64`, `log10`).

**Next for QuantEcon/project-monorepo#26:** the PDF check by outline section, and the GPU-fallback check from the execution report. Then dp's comparison against dp's own build at its pin, once that reference is built. Changing `tools/affected-sites`, a build input, makes this PR build every site, from the cache.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG
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.

1 participant