Skip to content

perf(ci): the local gate writes coverage XML only where CI reads it, and the cleanup keeps the combined data #1743

Description

@dan-petty

Friction

The local gate's test row spends its last seconds writing coverage reports serially, and only CI reads one of them.

Evidence

  • After the last test, pytest-cov's controller makes three report passes over all 579 source files, one after another, on the critical path. Timed in one process at load 23: 17.7s in total, of which term-missing took 11.6s and xml 8.8s. In two probed gate runs at load 30-40, the phase took 55s and 98s.
  • Only CI's diff-cover step reads coverage.xml.
  • _clean_coverage_artifacts in src/devops_cli/commands/ci.py globs .coverage*, which also deletes the combined .data/.coverage once it is over 60s old, although its docstring says it cleans worker files only.

Remedy

  • The local gate writes no XML report. CI writes it with uv run coverage xml where diff-cover reads it.
  • The cleanup removes only the worker data files.
  • The 90% threshold and the term report stay.

Acceptance criteria

  • Tests first: the cleanup keeps the combined data file, and the local gate's pytest command carries no XML report.
  • CI's diff-cover step still gets coverage.xml.
  • The test row's time after the last test drops by the XML pass, measured before and after.
  • uv run devops ci passes.

Proposed design

Problem statement

The local CI gate writes a coverage XML report that only the CI pipeline reads, adding roughly 9 seconds (up to 55-98 seconds under load) to the critical path. The coverage artifact cleanup also deletes the combined .data/.coverage file when it is older than 60 seconds, contradicting its stated purpose of cleaning only worker files.

Acceptance criteria

  • Criterion 1: The local gate's pytest command carries no --cov-report=xml flag.
    Verification: Inspect the output of _resolve_pytest_cmd() in src/devops_cli/commands/ci.py and confirm the list contains no 'xml' entry.
  • Criterion 2: The cleanup function preserves the combined .data/.coverage file while still removing worker files.
    Verification: Run the test that creates a .data/.coverage file and a .data/.coverage.host.pid worker file, call _clean_coverage_artifacts, and assert the combined file still exists while the worker file is gone.
  • Criterion 3: CI's diff-cover step still receives coverage.xml.
    Verification: The CI workflow file contains a step that runs 'uv run coverage xml' before the diff-cover step, and diff-cover references coverage.xml.
  • Criterion 4: The test row's time after the last test drops by the XML report pass duration.
    Verification: Measure 'uv run devops ci --only test' before and after the change; the after time is lower by approximately the XML generation time (about 9 seconds at load 23).
  • Criterion 5: uv run devops ci passes with all checks green.
    Verification: Run 'uv run devops ci' and confirm exit code 0 and all checks show pass.

Key questions

  • What glob pattern matches only worker files and not the combined .coverage data file?: Worker files are named .coverage.., so the pattern .coverage.* (with a literal dot before the wildcard) matches them. The bare .coverage file does not match because it has no character after the dot. [sources: src/devops_cli/commands/ci.py:414]
  • Where in the CI workflow does diff-cover read coverage.xml?: The issue body states that only CI's diff-cover step reads coverage.xml. The exact workflow file is not in the provided context, but the remedy specifies that CI writes it with 'uv run coverage xml' in the step before diff-cover. [sources: src/devops_cli/commands/ci.py]
  • Should the coverage.xml deletion in _clean_coverage_artifacts stay?: Yes. The local gate no longer generates coverage.xml, so a stale one from a prior run is safe to remove. CI generates its own copy in its own step. (proposed)
  • Does the 90% coverage threshold and the term-missing report stay in the local gate?: Yes. The remedy explicitly states the 90% threshold and the term report stay. Only the XML report is removed from the local gate. (proposed)

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/infra
    on Oct 20, 2026
  2. dan-petty commented on Oct 20, 2026

    @dan-petty
    OwnerAuthor

    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.

    • Type: type/infra. The candidate improves CI performance by changing how coverage reports are handled.
    • Priority: P2-Medium. This change addresses a performance issue in the CI pipeline that impacts developer productivity and build times.
    • Value: Medium. Improving CI speed benefits all developers and reduces build time overhead, but it's not critical to core functionality or security.
    • Effort: Medium. Requires modifying both local gate and CI configurations to change coverage reporting behavior and cleanup logic.
  3. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

    Status set to Ready at 4da1e34 (see proposed design in issue body).

  4. added
    priority/p2-medium
    status/ready
    value/medium
    effort/medium
    on Oct 28, 2026
  5. added a commit that references this issue on Oct 29, 2026
  6. removed
    status/ready
    on Oct 30, 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

    effort/mediumpriority/p2-mediumsource/agenttype/infravalue/medium

    Type

    No type

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions