Skip to content

perf(ci): the gate's test workers start at least 15% faster, and the full test run keeps at least half of that saving #1338

Closed

Description

@dan-petty

Problem

Every pytest-xdist worker imports and collects the whole suite before it runs its first test. The gate runs pytest with -n logical from pyproject.toml:126 (16 workers in the devcontainer), plus coverage [code: src/devops_cli/commands/ci.py:385-395]. The figures below were measured on 2026-10-07 at 36cfbbb, in the devcontainer and without coverage. Other work was running on the machine, so they are given as ranges over several runs.

Acceptance criteria

  • (person-run) Baseline first. At the item's base, on an otherwise idle devcontainer, the task file records:
    • the median of three runs of uv run pytest -q -p no:cacheprovider -k zz_no_such_test_zz (start-up and collection only);
    • the median of three runs of uv run pytest -q -p no:cacheprovider (the full run);
    • the five largest import costs from uv run python -X importtime -m pytest --collect-only -q -s -n0 -p no:cacheprovider.
  • (person-run) After the change, the start-up median is at least 15% below its baseline. The new figures are recorded in the task file.
  • (person-run) The full-run median falls by at least half as many seconds as the start-up median did, so the saving is not moved into the tests.
  • No test is lost. The full run collects as many tests as at the base, with the same passed, skipped and xfailed counts.
  • The gate still measures coverage over src and still meets fail_under = 90.
  • changelog.d/<n>.md records the change; CHANGELOG.md and docs/ROADMAP.md are not edited.
  • uv run devops ci passes.

Key questions

Strategic alignment

Activity

  1. added
    type/test
    priority/p2-medium
    scope/ci
    on Oct 7, 2026
  2. dan-petty-bot commented on Oct 7, 2026

    @dan-petty-bot
    Collaborator

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Priority: P2-Medium. A meaningful CI speedup (≈5-7 s saved) that improves developer feedback loop but does not block any functionality or fix a defect.
    • Value: Medium. Every developer push and every CI run benefits from faster worker startup, but the gate already passes and the saving is a fraction of total wall time.
    • Effort: Medium. Requires measuring baselines, deferring imports across ~32 modules that pull in pydantic_ai and the model SDKs, verifying no tests are lost, and confirming coverage still meets the 90 % floor.
  3. added this to the v0.2.30 milestone on Oct 8, 2026
  4. dan-petty commented on Oct 8, 2026

    @dan-petty
    OwnerAuthor

    Placed in v0.2.30 on 2026-10-08 at the owner's request ("Populate 10 security and ci issues into each v0.2.30, v0.2.31, and v0.2.32 milestone"). This is a person's placement. Release theme: P1 secret and sandbox-boundary fixes, the review tools lock, kube-linter finding identity and a faster gate. Position 9 of 10 in the release's planned merge order. Its board Status is set to Ready, so the release-start fill keeps it.

  5. modified the milestones: v0.2.30, v0.2.31 on Oct 9, 2026
  6. dan-petty-bot commented on Oct 9, 2026

    @dan-petty-bot
    Collaborator

    Moved to v0.2.31: v0.2.30 started with more than 12 items, and this was its lowest-ranked unstarted item. (devops roadmap reprioritize)

  7. dan-petty-bot commented on Oct 9, 2026

    @dan-petty-bot
    Collaborator

    What changed

    #1483, merged into release/v0.2.31 as 0f945db.

    Resolves #1338.

    21 file(s) changed.

    How it was verified

    Check runs at 88c5c93:

    • Prune PR DevContainer Images: pass
    • CodeQL: pass
    • Static Analysis: pass
    • Tests & Coverage: pass
    • Analyze (actions): pass
    • Analyze (python): pass
    • DevContainer Image: skipping
    • Service Image: skipping
    • Dependency Freshness: skipping

    Acceptance Criteria of docs/agent/tasks/task-1338-test-worker-startup.md:

    • (person-run) Baseline first. At the item's base, on an otherwise idle devcontainer, the task file records:
      • the median of three runs of uv run pytest -q -p no:cacheprovider -k zz_no_such_test_zz (start-up and collection only) -> 37.52s;
      • the median of three runs of uv run pytest -q -p no:cacheprovider (the full run) -> 152.32s;
      • the five largest import costs from uv run python -X importtime -m pytest --collect-only -q -s -n0 -p no:cacheprovider -> devops_cli, anthropic, kubernetes, google, qdrant_client.
    • (person-run) After the change, the start-up median is at least 15% below its baseline. The new figures are recorded in the task file (28.02s median, 25.32% reduction).
    • (person-run) The full-run median falls by at least half as many seconds as the start-up median did, so the saving is not moved into the tests (11.27s saved, exceeding required 4.75s).
    • No test is lost. The full run collects as many tests as at the base, with the same passed, skipped and xfailed counts (10,132 passed with 1 new invariant test, 1 skipped, 8 xfailed).
    • The gate still measures coverage over src and still meets fail_under = 90 (measured 92.36%).
    • changelog.d/1338.md records the change; CHANGELOG.md and docs/ROADMAP.md are not edited.
    • uv run devops ci passes.
  8. added a commit that references this issue on Oct 9, 2026
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

    priority/p2-mediumscope/citype/test

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions