The free plan’s 2,000 Actions minutes ran out at 11:36 AM on October 5. I rebuilt the bill from the job records, rounding each job up to a whole minute as GitHub does. The total crossed 90% and 100% at the same minutes as GitHub’s two notices, so it is the meter, not an estimate. No workflow had run away. September’s fix (#516) scoped jobs by what a change touches. It saved a minute and a half per run, but the job it added to decide the scope, six seconds of work billed as a full minute, gave one minute back. Growth in the backend suite added another minute in the same week. The suite went from 953 passing tests to 4,110 in eleven days, at a steady 50 ms each. Every PR runs it about one and a half times, and every merge runs it again.
So I ran the suite in a container built like the CI job and kept the per-test durations. The median test takes 3 ms, and the slowest 1% took 58% of the time. Three causes covered most of it, and none of them was a test doing work.
- A credential probe. Nine tests waited out google-auth’s 3-second probe of the GCE metadata server. The fine-tune handler’s poll loop builds a storage client that the test harness never stubbed, and off GCE that probe always times out.
- A shutdown grace. Thirty-eight API tests each slept half a second in
main.py’s shutdown handler. The grace is there for live SSE streams, and tests have none. - Catalog rebuilds.
test_docs_publish.py, 27% of the suite by itself, rebuilt the full docs/ catalog in eight places. Two of those were tests that only count calls to the builder.
The fixes keep every assertion:
- an environment variable for each wait, set in conftest;
- the module’s one real catalog shared, with a stub where a test asks when a rebuild happens rather than what it contains;
- a substring check before
ast.parsein two whole-tree sweeps.
On the same container, the suite went from 278 s to 161 s.
The second change had been asked for by name: a change that touches only docs/ no longer runs the whole suite. The open question was which tests a docs edit can break. A grep for “docs/” named 21 files, and most of them only mention the word. An audit hook that records the running test whenever something under docs/ is opened named three files. Tracing subprocesses as well added none. The hook stays in the suite, and a run in which an unmarked test opens a file under docs/ fails, so the selection cannot rot. There is one kind of read it cannot see: Python does not audit a stat, so exists() goes unrecorded. One test checks exactly that, that the runbook cloudbuild-backend.yaml cites is still there, so it is marked by hand. Breaking a mark on purpose turned the run red, naming the test and the file it read. A docs-only change now runs 81 tests in 25 seconds.
What this does not touch is the slope. Each new test still runs on every PR and every merge. The tracker for the rest is #842. A runner on the spare machine that used to host local workers would make the minutes free, and running the suite in parallel there would make it fast.