Skip to content

[Task]: cut CI and pre-push test time (matrix size, per-push suite runs) #787

Closed

Description

@sumithr

Priority / sequencing

P1 / priority: soon. The cost lands on every push.

Suggested labels

  • documentation
  • ux
  • compatibility
  • distribution

Roadmap fields

Status: Ready; Priority: P1; Size: M; Order: (unset); Depends on: (none)

Problem

The test suite (4,746 collected tests) runs too often and too slowly for the signal it adds:

  1. CI matrix. test.yml runs the full suite on 3 OS x 5 Python versions (15 jobs). The last green run (36857043731) used about 72 runner-minutes. Windows jobs take 250s to 650s; windows-latest · py3.10 (653s) sets the wall-clock time.
  2. Pre-push. The pytest hook is always_run: true and runs the full suite on every push (about 2m48s locally), which CI then repeats. The mutmut hook also triggers on any tests/*.py change and runs with --max-children 1.
  3. Serial execution. The suite runs in one process. The slowest tests spawn subprocesses or build git repos and plugin trees per test (session-start hook about 4.3s per test, plugin-packaging setup 3s to 4s per test).

Test-file cleanup (merging fan-outs, fixture scope, duplicate helpers) is tracked separately in #779 Scope D. This issue covers how and where the suite runs.

Expected outcome

  • CI wall-clock time and runner-minutes per push both drop measurably, with OS and Python-version coverage that still catches platform-specific breaks.
  • Pushing no longer waits on a full-suite run that CI repeats, unless the team decides the local gate is worth its cost.
  • The 100% coverage gate and the mutation gate keep their current strength.

Scope

  • Matrix. Decide and implement a smaller matrix. Candidate: full suite on ubuntu-latest across all 5 Python versions, plus macos-latest and windows-latest on the oldest and newest supported Python only (15 to 9 jobs). Check which tests are OS-specific (path handling, JetBrains/VS Code dirs, subprocess quoting) and confirm they still run on every OS kept.
  • Coverage on one job. Measure whether running --cov with --cov-fail-under=100 on a single job (the one with the treesitter extra) and plain pytest elsewhere saves meaningful time. Keep it only if it does.
  • Parallel runs. Evaluate pytest-xdist (or the current equivalent) for CI and pre-push: measure the wall-clock gain, check that it works with pytest-cov and the 100% gate, and check mutmut still runs (mutmut stays single-worker on macOS). Adopt it only with numbers showing it helps, pinned per the repo toolchain-pin rules (pyproject extra plus the pre-commit hook dependency lists).
  • Pre-push pytest hook. Decide between keeping the full run, scoping it to tests affected by the pushed change, or dropping it in favour of CI. Record the decision and the reason in the hook comment.
  • Pre-push mutmut trigger. Narrow the files: regex so a change to a test file unrelated to a mutated module does not trigger the hook, if check_mutation_gate.py --changed-only does not already make that a no-op. Measure first.

Acceptance criteria

  • The PR states before/after numbers for: CI wall-clock time, total runner-minutes for one test.yml run, and local pre-push time.
  • Every OS-specific test still runs on the OS it targets.
  • The oldest and newest supported Python versions are tested on every OS kept in the matrix.
  • The 100% coverage gate still runs on at least one job with the treesitter extra installed.
  • The mutation gate behaviour is unchanged (same modules, same no-new-survivors rule).
  • Any new tool is pinned to an exact version in the repo and used by both CI and the pre-commit hooks.

Test plan

  • Push a branch and record the test.yml job durations before and after.
  • Time git push with the pre-push hooks on a test-only change and on a src/ change, before and after.
  • Push a deliberate Windows-only path regression on a scratch branch and confirm the reduced matrix still fails it.

Context

Activity

  1. sumithr commented on Oct 2, 2026

    @sumithr
    OwnerAuthor

    Finish proof, head 5c5f87b

    CI: 27 of 27 checks pass on 5c5f87b (9 pytest jobs). Mutation gate: run 37058420037 on this head, success. Open review threads: 0.

    Per-file review (sumo-qa-reviewing-before-merge, each changed file's full post-change content vs main): SAFE for all 25 files. One low note, not a code defect: src/sumo_qa/external_skills.py carries a user-visible fix (the provenance lock is read only under its guard; an unsearchable lock folder is refused before the fetch), and the ci(tests): ... squash title gives it no release-please changelog entry.

    /code-review (high): 4 rounds plus a comment-only round (03ea8be, 5c5f87b: the mutmut hazard classifier's comments now match its rule, history sentence removed). Final delta: clean.

    Behaviour ledger (finish-pr 4.7):

    # expected behaviour real-surface call + input observed output Met
    1 PR states before/after CI wall-clock, runner-minutes for one test.yml run, local pre-push time gh run view <id> --json jobs summed (ci_minutes.py) on main run 37014740621 vs this branch's run; pre-commit pre-push stage timed on a test-only and a src change, before (042c013) vs after CI: 15 jobs, 73.7 runner-min, wall 466s -> 9 jobs, 21.6 runner-min, wall 208s (head run 37058370119; previous head 20.7, 203s). Pre-push: test-only 122.6 to 142.0s -> 58.5 to 60.8s; src 96.8s -> 29.8 to 31.6s; real pushes of this branch: hook 61 to 65s (5066 passed, 100%) Met (PR body updated)
    2 Every OS-specific test still runs on its OS scratch draft PR #817: installer.py PATH split on ":" instead of os.pathsep, test.yml run 37057716159 on the reduced matrix both windows jobs FAIL (5 failed, 5005 passed: test_iter_skips_empty_path_segments and 4 selector tests); all ubuntu/macOS pytest jobs pass; PR closed unmerged, branch deleted Met
    3 Oldest and newest Python on every kept OS run 37057234383 job list ubuntu py3.10 to 3.14; macos py3.10, 3.14; windows py3.10, 3.14 Met
    4 100% coverage gate on at least one job with treesitter run 37057234383, job pytest (ubuntu-latest · py3.14) log pip install -e ".[dev,vertex,treesitter]", SUMO_QA_REQUIRE_TREESITTER: 1, repo_map_treesitter.py 36 0 100%, Required test coverage of 100% reached. Total coverage: 100.00% Met
    5 Mutation gate unchanged (same modules, same no-new-survivors rule) git diff origin/main...branch on mutation.yml, check_mutation_gate.py, mutmut-baseline.json, [tool.mutmut] no change to the workflow, checker, baseline or source_paths; one added --ignore=tests/test_conformance_redos_subprocess.py (a new subprocess-spawning test, marker mutmut-subprocess-spawning, same pattern as the existing ignores); mutation.yml run 37058420037 on the head: success Met
    6 New tool pinned exactly, used by CI and the pre-commit hooks pyproject dev extra + .pre-commit-config.yaml diff; test.yml pytest-xdist==3.8.0 in the dev extra and the hook's additional_dependencies; hook entry pytest -n auto --maxprocesses 4 --dist loadfile; CI jobs run pytest -n auto --dist loadfile; lockstep row in test_toolchain_pin_lockstep.py Met
    • real_repo: this repo's real suite and CI.
    • real_surface: real GitHub Actions runs and real pre-push hook runs.
    • existing_flow: clean wheels of 5c5f87b and origin/main 042c013, scoped haiku claude -p (sumo-qa only, no host skills): "load the QA classifications" -> sumo_qa_load_classifications (2297 B) and "is playwright-e2e installed" -> sumo_qa_check_external_skill_installed give identical tool sequences and byte-identical results on both builds; repos stayed clean. The lock-present path is covered by the new tests in tests/test_external_skills_provenance.py, not this run.
    • evals: N/A, no eval input in the diff.

    Acceptance criteria (#787): all 6 met, evidence per row above (numbers are in the PR body's "How it was verified" table).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions