fix(ci): make benchmark_regression job fast and correctly fail on regressions #87

Open
CoreRasurae wants to merge 1 commits from task/m2-quick-benchmark-regression-ci into master
Member

Summary

Three compounding issues in the benchmark_regression CI check, found while investigating a 41m13s hang/timeout on PR #85's run (job 205876):

  1. ASV calibration overhead: asv continuous ran with no speed-oriented flags, fully calibrating/repeating every one of 138 benchmark runs (69 benchmarks × 2 commits). noxfile.py's benchmark_regression session now forwards *session.posargs to asv continuous (its own default, full-accuracy behavior is unchanged when called without extra args); .gitea/workflows/ci.yml's benchmark job now invokes nox -s benchmark_regression -- --quick, scoping ASV's single-run mode to this informational job only.

  2. Packaging bottleneck (surfaced once --quick was applied): asv.conf.json's build/install/uninstall commands used plain python -m build/pip, which silently spent ~11 minutes per run in pip's resolver (uncached, per-commit dependency install with no progress output). Switched to uv build/uv pip install/uv pip uninstall. Since ASV's find_executable only searches each managed venv's own bin/ (not $PATH), added uv to asv's matrix config so it gets pip-installed during venv bootstrap, and pass --python {env_dir}/bin/python explicitly to each command (standalone uv, unlike python -m pip, can't otherwise infer which of asv's several per-commit venvs to target). Also added --force-reinstall to the install command per ASV's own documented rationale.

  3. Exit-code / success_codes mismatch: asv continuous returns the boolean worsened as its exit code (0 = no significant regression, 1 = a benchmark measurably worsened past --factor) — there is no exit code 2 in this ASV version. noxfile.py's success_codes=[0, 2] never matched the real "worsened" code, so the session failed unconditionally on any regression signal. Corrected to success_codes=[0], so the session (and CI job step) now fails specifically when ASV reports a real, significant regression — continue-on-error: true on the job is what keeps this from blocking the PR merge, not this success list.

This is a CI/tooling-only change — no business logic, no src/ changes.

Closes #86

Test plan

  • python3 -m py_compile noxfile.py
  • JSON/YAML validity checks on asv.conf.json / .gitea/workflows/ci.yml
  • nox -s lint
  • Verified locally end-to-end, repeatedly, with rm -rf .asv/env .asv/results between runs:
    • Completes in ~3-11 minutes (vs. the prior 40+ minute hang/timeout)
    • uv-based build/install/uninstall correctly targets each per-commit venv (no more ModuleNotFoundError)
    • Session correctly reports failed when asv continuous detects a significant regression between the compared commits (confirms the fix doesn't mask real regressions)
  • Next CI run on this PR: confirm the benchmark job completes quickly and its pass/fail conclusion matches whether a real regression was detected

🤖 Generated with Claude Code

## Summary Three compounding issues in the `benchmark_regression` CI check, found while investigating a 41m13s hang/timeout on PR #85's run (job 205876): 1. **ASV calibration overhead**: `asv continuous` ran with no speed-oriented flags, fully calibrating/repeating every one of 138 benchmark runs (69 benchmarks × 2 commits). `noxfile.py`'s `benchmark_regression` session now forwards `*session.posargs` to `asv continuous` (its own default, full-accuracy behavior is unchanged when called without extra args); `.gitea/workflows/ci.yml`'s `benchmark` job now invokes `nox -s benchmark_regression -- --quick`, scoping ASV's single-run mode to this informational job only. 2. **Packaging bottleneck (surfaced once --quick was applied)**: `asv.conf.json`'s build/install/uninstall commands used plain `python -m build`/`pip`, which silently spent ~11 minutes per run in pip's resolver (uncached, per-commit dependency install with no progress output). Switched to `uv build`/`uv pip install`/`uv pip uninstall`. Since ASV's `find_executable` only searches each managed venv's own `bin/` (not `$PATH`), added `uv` to asv's `matrix` config so it gets pip-installed during venv bootstrap, and pass `--python {env_dir}/bin/python` explicitly to each command (standalone `uv`, unlike `python -m pip`, can't otherwise infer which of asv's several per-commit venvs to target). Also added `--force-reinstall` to the install command per ASV's own documented rationale. 3. **Exit-code / success_codes mismatch**: `asv continuous` returns the boolean `worsened` as its exit code (0 = no significant regression, 1 = a benchmark measurably worsened past `--factor`) — there is no exit code 2 in this ASV version. `noxfile.py`'s `success_codes=[0, 2]` never matched the real "worsened" code, so the session failed unconditionally on *any* regression signal. Corrected to `success_codes=[0]`, so the session (and CI job step) now fails specifically when ASV reports a real, significant regression — `continue-on-error: true` on the job is what keeps this from blocking the PR merge, not this success list. This is a CI/tooling-only change — no business logic, no `src/` changes. Closes #86 ## Test plan - [x] `python3 -m py_compile noxfile.py` - [x] JSON/YAML validity checks on `asv.conf.json` / `.gitea/workflows/ci.yml` - [x] `nox -s lint` - [x] Verified locally end-to-end, repeatedly, with `rm -rf .asv/env .asv/results` between runs: - Completes in ~3-11 minutes (vs. the prior 40+ minute hang/timeout) - `uv`-based build/install/uninstall correctly targets each per-commit venv (no more `ModuleNotFoundError`) - Session correctly reports `failed` when `asv continuous` detects a significant regression between the compared commits (confirms the fix doesn't mask real regressions) - [ ] Next CI run on this PR: confirm the `benchmark` job completes quickly and its pass/fail conclusion matches whether a real regression was detected 🤖 Generated with [Claude Code](https://claude.com/claude-code)
CoreRasurae added this to the v2.1.0 milestone 2026-07-31 12:02:45 +00:00
CoreRasurae added the
Type
Task
label 2026-07-31 12:02:46 +00:00
CoreRasurae added 1 commit 2026-07-31 14:59:28 +00:00
fix(ci): make benchmark_regression job fast and correctly fail on regressions
CI / lint (pull_request) Successful in 44s
CI / typecheck (pull_request) Successful in 1m32s
CI / security (pull_request) Successful in 1m15s
CI / quality (pull_request) Successful in 47s
CI / build (pull_request) Successful in 2m4s
CI / integration_tests (pull_request) Successful in 4m18s
CI / unit_tests (pull_request) Successful in 5m41s
CI / coverage (pull_request) Successful in 4m36s
CI / status-check (pull_request) Successful in 7s
CI / benchmark (pull_request) Failing after 17m20s
a1fd36932f
Three compounding issues in the benchmark_regression CI check, found
while investigating a 41m13s hang/timeout on PR #85's run (job 205876):

1. `asv continuous` ran with no speed-oriented flags, fully calibrating
   and repeating every one of 138 benchmark runs (69 benchmarks x 2
   commits). Per-benchmark ASV overhead (calibration + repeat + process
   averaging) cost 20-90s of wall clock per benchmark, dwarfing the
   actual measured microsecond-to-millisecond costs. `noxfile.py`'s
   `benchmark_regression` session now forwards *session.posargs to
   `asv continuous`, so its own default (full, accurate) behavior is
   unchanged when called without extra args; `.gitea/workflows/ci.yml`'s
   `benchmark` job now invokes `nox -s benchmark_regression -- --quick`,
   scoping ASV's single-run mode to this informational job only.

2. With --quick applied, a new bottleneck surfaced: asv.conf.json's
   build/install/uninstall commands used plain `python -m build`/`pip`,
   which silently spent ~11 minutes per run in pip's resolver (build
   isolation + a full, uncached dependency install per compared commit,
   no progress output during backtracking). Switched to `uv build`/
   `uv pip install`/`uv pip uninstall`. `uv` isn't installed inside each
   ASV-managed virtualenv by default (asv's find_executable only
   searches that venv's own bin/, not $PATH), so added `uv` to asv's
   `matrix` config to have it pip-installed during venv bootstrap
   (already-fast for a single small package), and pass `--python
   {env_dir}/bin/python` explicitly to each command since standalone
   `uv` (unlike `python -m pip`) has no unambiguous way to infer which
   of asv's several per-commit venvs to target otherwise. Also added
   `--force-reinstall` to the install command per asv's own documented
   rationale (compared commits may share the same package version).

3. `asv continuous` returns the boolean `worsened` as its process exit
   code (0 = no significant regression, 1 = a benchmark measurably
   worsened past --factor) -- there is no exit code 2 in this asv
   version. `noxfile.py`'s `success_codes=[0, 2]` therefore never
   actually matched the real "worsened" code, silently making this
   session fail on *any* regression signal regardless of significance.
   Corrected to `success_codes=[0]`, so the session (and CI job step)
   now fails specifically when asv reports a real, significant
   regression -- the CI job's existing `continue-on-error: true` is
   what keeps this from blocking the PR, not this success list.

Verified locally end-to-end (rm -rf .asv/env .asv/results between
runs): completes in ~3-11 minutes (vs. the prior 40+ minute
hang/timeout), and the session now correctly reports "failed" when
asv detects a significant regression between the compared commits.

ISSUES CLOSED: #86
CoreRasurae force-pushed task/m2-quick-benchmark-regression-ci from cc31d40aed to a1fd36932f 2026-07-31 14:59:28 +00:00 Compare
CoreRasurae changed title from fix(ci): scope asv --quick to the benchmark_regression CI job only to fix(ci): make benchmark_regression job fast and correctly fail on regressions 2026-07-31 14:59:50 +00:00
hurui200320 approved these changes 2026-08-01 07:21:21 +00:00
hurui200320 left a comment
Member

PR Review: !87 (Ticket #86)

Verdict: Approve

This PR correctly addresses the three compounding issues described in #86: ASV calibration overhead, pip packaging bottleneck, and the incorrect success_codes list. The changes are well-scoped, limited to CI/tooling files, and thoroughly documented with inline comments. No business logic is modified, so coverage and functional behavior are unaffected.

Critical Issues

None

Major Issues

None

Minor Issues

None

Nits

None

Summary

  • noxfile.py: Forwarding *session.posargs to asv continuous is the right way to let CI opt into --quick without changing the session's default behavior. Correcting success_codes from [0, 2] to [0] aligns the session with ASV's actual exit-code semantics (0 = no regression, 1 = regression detected), so the job now fails specifically on real regressions rather than unconditionally.
  • asv.conf.json: Switching build/install/uninstall commands to uv with explicit --python {env_dir}/bin/python and bootstrapping uv via the matrix config solves the per-commit pip resolver bottleneck while correctly targeting each ASV-managed venv.
  • .gitea/workflows/ci.yml: Passing --quick only in the CI benchmark job keeps the fast, informational regression check scoped appropriately; the existing continue-on-error: true on the job remains the non-blocking mechanism.

The commit is atomic, the message matches the issue metadata, and the body explains the rationale clearly. This is ready to merge.

## PR Review: !87 (Ticket #86) ### Verdict: Approve This PR correctly addresses the three compounding issues described in #86: ASV calibration overhead, pip packaging bottleneck, and the incorrect `success_codes` list. The changes are well-scoped, limited to CI/tooling files, and thoroughly documented with inline comments. No business logic is modified, so coverage and functional behavior are unaffected. ### Critical Issues None ### Major Issues None ### Minor Issues None ### Nits None ### Summary - `noxfile.py`: Forwarding `*session.posargs` to `asv continuous` is the right way to let CI opt into `--quick` without changing the session's default behavior. Correcting `success_codes` from `[0, 2]` to `[0]` aligns the session with ASV's actual exit-code semantics (0 = no regression, 1 = regression detected), so the job now fails specifically on real regressions rather than unconditionally. - `asv.conf.json`: Switching build/install/uninstall commands to `uv` with explicit `--python {env_dir}/bin/python` and bootstrapping `uv` via the `matrix` config solves the per-commit pip resolver bottleneck while correctly targeting each ASV-managed venv. - `.gitea/workflows/ci.yml`: Passing `--quick` only in the CI benchmark job keeps the fast, informational regression check scoped appropriately; the existing `continue-on-error: true` on the job remains the non-blocking mechanism. The commit is atomic, the message matches the issue metadata, and the body explains the rationale clearly. This is ready to merge.
hurui200320 approved these changes 2026-08-02 13:22:03 +00:00
Some checks are pending
CI / lint (pull_request) Successful in 44s
CI / typecheck (pull_request) Successful in 1m32s
CI / security (pull_request) Successful in 1m15s
CI / quality (pull_request) Successful in 47s
CI / build (pull_request) Successful in 2m4s
CI / integration_tests (pull_request) Successful in 4m18s
CI / unit_tests (pull_request) Successful in 5m41s
CI / coverage (pull_request) Successful in 4m36s
CI / status-check (pull_request) Successful in 7s
CI / benchmark (pull_request) Failing after 17m20s
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin task/m2-quick-benchmark-regression-ci:task/m2-quick-benchmark-regression-ci
git checkout task/m2-quick-benchmark-regression-ci
Sign in to join this conversation.
No Reviewers
No Label
Type
Task
2 Participants
Notifications
Due Date
No due date set.
Reference: cleveragents/cleveractors-core#87