Repository navigation
site-build: the base environment, the full image with the list; intro joins - #84
Conversation
de0051d to
579af32
Compare
Validation: intro built from the pool against intro's own buildsBuilds compared, all of the same content (intro's
Noise baseline. intro's two own builds differ on 31 of 66 pages: image file names, unseeded random outputs, timings, memory addresses and the status page. This pull request's build differs from intro's fresh build on 45 pages. Every difference beyond the noise is one of these:
Warnings. The build log has no Sphinx warning (the strict build would fail on one). Its only warning lines are Node.js deprecation notices from GitHub's own actions and conda's update notice. The cell outputs carry the same two warnings as intro's own build, once each: a UserWarning in fitting_distributions and a Pandas4Warning in inflation_history (both pre-existing, upstream). Environment. All 39 pins in After the rebase on main |
There was a problem hiding this comment.
🟡 Changes recommended
Non-string YAML environment values cause an uncaught TypeError in tools/site-matrix, producing a traceback instead of reporting invalid input and collecting other sites’ refusal reasons.
1 open issue
What changed in this PR
This PR adds intro to the shared site-build workflow as the first site using the common base environment, while leaving dp in its existing series environment.
Changes:
- Adds an optional
environmentsetting to select the container image, package setup, and cache key. - Enables intro’s HTML build with the shared package list, warning suppression, and font-cache preparation.
- Records installed packages alongside execution reports and updates validation, tests, and documentation.
| File | Description |
|---|---|
tools/tests/test_sites.py |
Tests validation of the optional environment setting. |
tools/tests/test_site_matrix.py |
Tests environment defaults, image selection, cache settings, and rejection. |
tools/site-matrix |
Maps environments to images and cache-key inputs. |
tools/pool-check |
Allows and validates the environment field. |
sites/README.md |
Documents environment selection and the expanded build workflow. |
sites/intro/site.yml |
Selects the base environment for intro. |
.github/workflows/site-build.yml |
Adds intro, base-environment setup, package records, and environment-specific caching. |
Review effort: Balanced (adaptive)
… joins The first site brought into one environment for every site (QuantEcon/project-monorepo#77; the design note is ideas/one-environment-for-every-site.md there), by the owner's order of 2026-11-22: intro, then advanced, then the GPU sites. site.yml gains an optional `environment`. `series`, the default, is what dp builds in today and keeps until its first shadow comparison: the lean image ghcr.io/quantecon/quantecon-build:latest, nothing installed but extra_packages, the cache keyed on mirror/<key>/environment.yml. `base` is the full image ghcr.io/quantecon/quantecon:latest with _base/environment-update.yml applied by QuantEcon/actions' setup-environment, the cache keyed on that list, its key tagged `base-`. In the base environment the leg also sets PIP_ROOT_USER_ACTION=ignore (the full image runs as root, and the environment scan of 2026-11-19 found pip's root-user warning in 15 of intro's install cells, which the series' own builds do not print) and builds matplotlib's font cache first. tools/site-matrix reads the field (environment, image, env_file, cache_tag) and refuses an unknown value; tools/pool-check's site-yml rule allows series and base; both have tests. Every leg now records pip freeze beside its execution report. _base/** joins the workflow's triggers, so a change to the list rebuilds the sites built with it. dp's leg and its cache key are unchanged. sites/intro/site.yml sets environment: base, and SITES is dp intro. intro builds HTML alone for now, as dp does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WT8bMacV9Lmy1VLUc6XJoL
…not a traceback
From the review of this pull request (Copilot's thread on
tools/site-matrix, and the organiser's reviewer). `environment: [base]`
or `{name: base}`, and the same for `runner`, raised TypeError on the
table lookup, so site-matrix exited with a traceback and stopped
collecting the other sites' refusals. Both lookups now check for a string
first and refuse anything else as they refuse an unknown name; a test
covers a list and a mapping for each.
Also: the workflow records the environment with `pip list --format=freeze`,
since pip freeze gives a package conda installed (pandas, plotly, rich,
seaborn, statsmodels, tabulate) as `name @ file:///...` with no version;
and the header of _base/environment-update.yml and _base/README.md no
longer say that nothing builds with the list, that the image holds no
Chrome (both images carry Chrome for Testing 158.0.8127.36 at /opt/chrome
since QuantEcon/actions#346), or that the series are still being brought
to the baseline. No base-environment cache exists yet, so changing the
list's comments costs no cache.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WT8bMacV9Lmy1VLUc6XJoL
54f64cf to
fa8bd5d
Compare
…, 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

What
The first site brought into one environment for every site (QuantEcon/project-monorepo#77; the design note is
ideas/one-environment-for-every-site.mdin QuantEcon/project-monorepo), in the owner's order of 2026-11-22: intro first, then advanced, then the GPU sites (QuantEcon/project-monorepo#77, comment of 2026-11-22).site-build.ymlnow buildsdpandintro.site.ymlgains an optional field,environment:series(the default; dp)ghcr.io/quantecon/quantecon-build:latest, the lean image dp's own workflows build inextra_packagesonlymirror/<key>/environment.ymlbase(intro)ghcr.io/quantecon/quantecon:latest, the full image (anaconda=2026.07, the base every series names)_base/environment-update.yml, through QuantEcon/actions'setup-environment, thenextra_packages_base/environment-update.yml, with the key taggedbase-dp stays in
seriesuntil its first shadow comparison, so that comparison measures the move of the build alone (the design note's decision 4)..github/workflows/site-build.ymlPIP_ROOT_USER_ACTION=ignore, build matplotlib's font cache; every leg recordspip freezebeside its execution report; the cache key takes its file and tag from the matrix;_base/**joins the triggers;SITES: dp intro; the header comments say all of ittools/site-matrixenvironment(defaultseries) intoenvironment,image,env_fileandcache_tag, and refuses an unknown valuetools/pool-checksite-ymlrule allowsenvironment,seriesorbasetools/tests/test_site_matrix.py,tools/tests/test_sites.pysites/intro/site.ymlenvironment: basesites/README.mdWhy the two extra steps. The environment scan of 2026-11-19 built intro in this environment: 56 pages, nothing new, except pip's "Running pip as the 'root' user" warning in 15 pages' install cells, because the full image runs as root and the series' own builds do not.
PIP_ROOT_USER_ACTION=ignoresilences it. Building the font cache first keeps "Matplotlib is building the font cache" out of the first lecture that plots, as the series' own workflows now do.Not in this pull request: intro's PDF and notebooks (every leg builds HTML alone, as dp publishes); a shared cache between sites of one environment (the design note's later step); the GPU leg.
Checks
tools/tests: 328 passed, 1 skipped.tools/pool-check: clean.tools/site-matrix dp intro: dp unchanged (series, the lean image,mirror/dp/environment.yml, no tag); intro inbase.Validation
Done on 2026-11-22; the evidence is in this comment. The intro leg builds green and strict (
-n -W) from the pool in the full image with the list. Its HTML was compared page by page with two of intro's own builds of the same content: every difference beyond their noise is the full image's install output, citation anchors, or the merged bibliography's corrections of three of intro's malformed entries, plus one figure path in the pool's layout. The cell-output warnings are the same, and all 39 pins are installed.🤖 Generated with Claude Code
https://claude.ai/code/session_01WT8bMacV9Lmy1VLUc6XJoL