Skip to content

perf(ci): cut test job time and guard its mean - #2764

Merged
dan-petty merged 6 commits into
mainfrom
perf/2699-test-check-time
Oct 30, 2026
Merged

dan-petty merged 6 commits into
mainfrom
perf/2699-test-check-time

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

What

The required check Tests & Coverage averaged 372 s over 24 runs of main. The newest 10 averaged 387 s. AGENTS.md rule 5 makes this a P0 bug. This change does two things.

  • It cuts work that every test repeated. The same tests run. The same lines are covered. No threshold moves.
    • tmp_path_retention_policy = "failed" and one runtime directory per worker.
    • The LLM response cache is built on first use, not in every test.
    • The garbage collector's young threshold is 50,000.
    • Five test servers poll their shutdown every 0.01 s.
    • The click command of a Typer app is built once per app state.
  • It adds the guard devops ci job-time and the job Test Job Duration in ci.yml. The job runs on push to main and every day. It reads the last 10 completed runs from the Actions API. It counts a job that passed, failed or timed out, whatever the run concluded. It fails when the mean is over 300 s or fewer than 10 runs were read.

Why

A pull request has one run, so it cannot show a mean. The history of main can. Reading the job's own conclusion keeps the run that the guard turned red in the next window.

Result and open points

  • The cut is 0.79 to 0.82 of the CPU time on pinned CPUs. The projected job time is 294 to 317 s. The change does not show that the mean is under 300 s. Ten runs on main are the proof.
  • The job Test Job Duration is expected to be red on the merge push and on about 8 pushes after it. Its window still holds the slow runs. This is not a regression.
  • This PR does not close perf(ci): the Tests & Coverage check averages 382 s on main, over the 5-minute limit #2699. The issue stays open until ten runs on main read under 300 s.

Plans #2699

Plans #2699. The change folder holds the baseline of the Tests & Coverage job
on the runner (24 runs), the design with the rejected alternatives, the spec
delta of devops ci job-time, and the tasks.
Adds devops ci job-time. It reads the time of a job in the last successful
push runs of a workflow on a branch from the Actions API, and fails when
the mean is over the limit or when fewer runs than asked for were read.
The job Test Job Duration of ci.yml runs it after each push to main and
every day.

The test job cannot be the guard: a pull request has one run, and a guard
there fails the pull request that fixes the time. The read is tested
offline over the fake of the GitHub API with recorded runs of main.
The Tests & Coverage job took 372 s on average on the runner, 92% of it
in the test step. Each of the 13,900 tests paid for work that it did not
ask for. No test is skipped or changed, and no threshold moves.

- tmp_path_retention_policy is failed, and the runtime directory of a test
  is made without a number: pytest listed the whole base directory for
  each numbered directory.
- The LLM response cache is built on first use, not in an autouse fixture
  that loaded the settings for every test.
- The young threshold of the garbage collector is 50,000.
- Five test servers poll their shutdown every 0.01 s.
- The click command of a Typer app is built once for each state of the
  app, not for each CliRunner.invoke.
- The parse cache of the Markdown helper is keyed by the text, since a
  path can be reused now.

Same 13,918 tests plus 17 new ones, same coverage (93.73%). On 4 pinned
CPUs the run takes 0.75 of the time of the base.
Archives 2699-test-check-time and adds the ci-job-time spec.
The guard listed only successful runs. The run that the guard turned
red left the next window, so a slow window could clear itself. A slow
run that failed was never seen. List completed runs and read the
conclusion of the job: success, failure and timed_out count.
State the measured ratio of the cut, the expected red of the guard
after the merge, and the rule that the job conclusion decides.
@dan-petty

Copy link
Copy Markdown
Owner Author

Run of this pull request, measured

Source: Actions API, run 41020014773, job Tests & Coverage, read on 2026-10-30. The baseline is in baseline.md (24 runs of main).

Part of the job Baseline mean (24 runs) This run
Job, start to end 372 s 242 s
Tests & Coverage Quality Gate step 341 s 208 s
Set up uv toolchain 18 s 16 s
Changed-Line Coverage (pull request only) none 8 s

The job took 0.65 of the baseline mean. Without the 8 s step that a push does not run, it took about 234 s.

Limits of this number:

  • It is one sample. The spread of one run is 38 s (SD), and runs of the baseline went from 279 s to 425 s.
  • It is faster than the 0.79 to 0.82 that the pinned-CPU pairs gave. The runner of this run may have been quiet. Do not use it as the proof.
  • The proof is ten runs on main, read by devops ci job-time.

This pull request uses Plans #2699, not a closing keyword. The issue stays open until ten runs on main read under 300 s. The job Test Job Duration is expected to be red on the merge push and on about 8 pushes after it, because its window still holds the slow runs.

@dan-petty
dan-petty marked this pull request as ready for review October 30, 2026 07:31
@dan-petty
dan-petty merged commit e76f656 into main Oct 30, 2026
19 checks passed
@dan-petty
dan-petty deleted the perf/2699-test-check-time branch October 30, 2026 08:22
dan-petty pushed a commit that referenced this pull request Oct 30, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.22.1](v0.22.0...v0.22.1)
(2026-10-30)


### Bug Fixes

* **github:** ask no traffic endpoint as the App
([#2759](#2759))
([692c15f](692c15f)),
closes [#2752](#2752)
* **roadmap:** a stop of the Service is not a failed round
([#2756](#2756))
([0b7e190](0b7e190)),
closes [#2753](#2753)
* **roadmap:** say why an implement step stopped
([#2762](#2762))
([cd56ce4](cd56ce4)),
closes [#2758](#2758)
* **service:** render and alert on the hourly request budget
([#2760](#2760))
([809d85b](809d85b)),
closes [#2755](#2755)
* **service:** run the implement row on the status lane
([#2763](#2763))
([cd94f2c](cd94f2c)),
closes [#2757](#2757)


### Performance Improvements

* **ci:** cut test job time and guard its mean
([#2764](#2764))
([e76f656](e76f656)),
closes [#2699](#2699)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
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.

perf(ci): the Tests & Coverage check averages 382 s on main, over the 5-minute limit

1 participant