Skip to content

DO NOT MERGE: test for #111, a change that reaches no site - #113

Closed
mmcky wants to merge 1 commit into
site-build/affected-sitesfrom
test/affected-none
Closed

mmcky wants to merge 1 commit into
site-build/affected-sitesfrom
test/affected-none

Conversation

@mmcky

@mmcky mmcky commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

A throwaway test for #111, against its branch, not main. It changes only sites/README.md, which reaches no site. Expected: site-build starts (the path filter takes sites/**), its matrix job reports that no site is reached, and the build job is skipped. It will be closed once its run reports. Never to be merged.

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

@mmcky

mmcky commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Test done, closing; never to be merged. Run https://github.com/QuantEcon/lectures/actions/runs/46075234082 at a8f1cb2 (a pull_request event, base 3ec6097): the matrix job wrote "none: the sites the change reaches, from 1 changed path(s) against 3ec6097" and "No site is affected, so none is built.", and the build job was skipped; the run concluded success. The evidence is on #111.

@mmcky mmcky closed this Nov 27, 2026
@mmcky
mmcky deleted the test/affected-none branch November 27, 2026 22:35
mmcky added a commit that referenced this pull request Nov 28, 2026
## Why

The last open part of QuantEcon/project-monorepo#77. Its acceptance criteria:
- "A pull request that touches one shared lecture rebuilds every product that lists it and no other";
- "A planted broken lecture fails every product that holds it and no other product's build".

Today every pull request and push to `main` that touches a build input builds all six sites. A fix to one intro lecture also rebuilds intermediate, programming and jax on the GPU machines. For pushes to `main` the owner chose the same narrowing on 2026-11-27, in the project-monorepo session: "Affected only (Recommended)". The schedule and a manual run still build every site.

## What it adds

- **`tools/affected-sites`** reads the changed paths and prints the sites, of those named, that they reach:
  - a lecture, or its own `_static/<slug>/` files: the sites whose `_toc.yml` lists it, at any depth of parts, chapters and sections;
  - a `_static/_shared/` asset: the sites of the lectures the ledger records as using it, or every site when it records none;
  - a `_static/<dir>/` that is no pool lecture's folder: every site;
  - a site's own file: that site (`sites/README.md` reaches none);
  - `tools/sync` and `sync/state.yml`: the sites in the `series` environment, here or at the base, since only those run `tools/sync` (today dp). `sync.yml`'s near-daily pin refresh starts no run, but the next push takes it in, and it builds dp alone;
  - any other build input: every site. That covers the bibliography, any other pool file, a build tool, `_base/`, `sync/manifest.yml` (which `tools/stage-site` reads for every site) and the workflow. These are the workflow's path filter outside the pool and the sites, and a test keeps the two lists in step;
  - anything else (documentation, the tests, another workflow, the other sync records): none.

  With `--base`, the contents lists and the ledger are read at the base too. So a lecture a change drops still builds the sites that listed it, and a shared asset its old users' sites. Paths come NUL-separated with `-z`. The tool refuses a `--base` that is no commit, and a contents list or ledger it can't parse, with exit 2. Links between sites don't widen the set: intersphinx resolves them against the other site's published inventory, not this build.
- **`site-build.yml`**'s first job chooses the sites:
  - **A pull request** is compared with its base.
  - **A push** is compared with the head of the last build on `main` that succeeded, not the commit before it. That build may be a push, scheduled or manual one, but never a pull request's. A run cancelled while it waits (the concurrency group keeps one waiting), cancelled by hand, or failed then leaves nothing unbuilt: the next push takes its change in. A step of its own reads that run through the API, with `actions: read`. It runs only on a push, and is the only step that holds the token.
  - **While a site stays red on `main`,** no build succeeds, so each push builds all that has changed since the last green build. The header says to mend a red site first. It also says to re-run an older push build's failed jobs, not all its jobs.
  - **The schedule and a manual run** take every site, and so does a base that can't be found or fetched.
  - The diff is `git diff --no-renames --name-only -z`. A renamed or moved file counts by its old path as well as its new one, and a name git would quote keeps its bytes. Only the base commit is fetched: a diff of two trees needs no history.
  - **A change to the rule itself** (the tool or this workflow) builds every site without asking the tool, so a broken tool can't skip its own build.
  - The job writes "Sites built: … " and the reason to the run summary. When a change reaches no site, the build job is skipped, since GitHub refuses an empty matrix.
- **The header:** who builds what, and how a push is compared. "What it does not do" now puts mystmd and the shared cache in the second phase, after the cutovers, which takes in the note deferred from #110.
- **Docs:** README's build paragraph and tools table, and `sites/README.md`'s "Building a site in CI".

## Checked

- **Tests:** 501 passed and 1 skipped. They cover:
  - every rule (24 cases), including a section nested in a part and the series inputs;
  - a site moved out of the series environment, read at the base, and a site with no `site.yml`;
  - over a real git history: a dropped lecture, the ledger read at the base, a renamed lecture, an asset moved between two lectures' folders, and a name git would quote;
  - a key with no site, a base that is no commit, and a contents list that can't be parsed;
  - the workflow, read for its path filter (both events), its diff flags, the rule check, the push base's query step, and that only that step holds the token.

  Six of the new tests fail on the first version of the tool, and dropping the ledger's base reading fails one. actionlint and pool-check are clean.
- **On the real pool,** with the workflow's own diff command:
  - `git mv lectures/os_stochastic.md lectures/os_stochastic_v2.md` builds dp and intermediate;
  - moving an `about_py` figure into `os_stochastic`'s folder builds dp, programming and intermediate;
  - a new `_static/lecture_specific/…` builds all six;
  - `about_py/café.png` builds programming;
  - the pin refresh `fc2ea1f` builds dp alone.
- **On tonight's merges** (each squash commit against its parent):

  | Merge | Sites it would build |
  |---|---|
  | the refresh #107 (two intro lectures) | intro alone, instead of all six |
  | #101 (pool-check, its tests, `sites/README.md`) | none; it built all six |
  | #110 (the README) | none |
  | #106 (`site-build.yml`) | all six |
  | #109 (`tools/stage-site`) | all six |

- **Real runs, each from a throwaway draft against this branch, now closed:**
  - #112 planted a failing cell in a lecture that dp and intermediate list. Only those two legs ran, and both failed in the strict build on the planted error.
  - #113 changed only `sites/README.md`. The matrix job reported no site, and the build job was skipped.

  The evidence comments below have the details.
- **This PR's own build** changes the workflow, so it builds all six: the "rule itself" path.
- **The push path** can't run before the merge. Its query, run now against this repository, returns 31f29fc (#101), the last build on `main` that succeeded. The first push after the merge carries this workflow, so it builds all six. The "Sites built" summaries of the first two push builds on `main` are to be read after the merge. The first should say it touches the rule, against 31f29fc. The second should be compared with the merge commit, if the first went green.

The validation rule: this changes which sites build, not how. The legs that run are unchanged steps, so a full output comparison isn't needed. The planted test is the evidence.

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

🤖 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