Skip to content

fix(ci): Tests & Coverage averages 363 s, over the 360 s limit #6262

Not planned

Description

@github-actions

devops ci job-time found that the last 20 runs of Tests & Coverage of ci.yml on main took 363 s on average. The limit is 360 s. A mean over the limit is a P0 bug (AGENTS.md rule 5). Find the change that made the check slow, and fix it or revert it (docs/TESTING.md, Run time).

The jobs also waited 11 s on average for a runner. The limit does not count this time.

Run Seconds Queue seconds
44239401738 326 159
44238563129 355 3
44237303658 336 2
44236127432 335 3
44236067498 341 3
44234490419 356 4
44233092221 345 4
44232188857 350 10
44225987049 315 3
44224484184 327 3
44223854687 349 3
44222967190 358 3
44220494734 377 3
44219570758 374 3
44217636858 419 3
44216694283 385 2
44215721384 432 3
44214367996 416 3
44204152219 359 3
44200276163 396 5

Proposed design

Problem statement

The Tests & Coverage job of ci.yml on main averaged 363 s over its last 20 runs, over the 360 s limit that AGENTS.md rule 5 sets. The issue needs the slow change found with the project's recorded tools, then fixed or reverted, and the module durations refreshed so the shard split stays balanced, without raising the limit.

Acceptance criteria

Requirement: Slow test is fixed or reverted

The change that made a test slow SHALL be reverted, or that test SHALL be changed, so its duration falls below the duration that its pre-fix JUnit report recorded.

Scenario: Slowest test after the fix

  • WHEN uv run pytest --durations=25 runs on the slow test module that uv run devops ci durations names
  • THEN the slow test's duration is lower than the duration that its pre-fix JUnit report recorded.

Requirement: Durations record is refreshed

The change SHALL refresh tests/module_durations.json from the post-fix test times with devops ci durations.

Scenario: Record refresh after the fix

  • WHEN uv run devops ci durations runs on main after the fix
  • THEN the command writes the mean seconds of each test module to tests/module_durations.json and exits 0.

Requirement: Tests & Coverage mean is under the limit

The Tests & Coverage job SHALL average 360 seconds or less over its last 20 runs on main.

Scenario: Next job-time report

  • WHEN uv run devops ci job-time runs on main after the fix
  • THEN the report shows a mean of 360 seconds or less for Tests & Coverage of ci.yml.

Requirement: The time limit is not raised

The change MUST NOT raise the 360-second limit for Tests & Coverage.

Scenario: Limit check after the fix

  • WHEN uv run devops ci job-time runs on main after the fix
  • THEN the report keeps the limit at 360 seconds and marks a mean over 360 seconds as a P0 bug.

Existing Tool Considered

No alternatives check has run. pytest is open and maintained, and its built-in --durations=25 option lists the slowest tests of a run (docs/TESTING.md:213, .github/workflows/service-image-test.yml:197). The project's existing devops ci durations reads the JUnit report of each shard of the last 20 push runs and writes the mean seconds of each test module to tests/module_durations.json (docs/TESTING.md:198, src/devops_cli/commands/ci.py:2895), and the local gate prints the slowest tests from pytest's durations report when the test step passes 300 s (src/devops_cli/commands/ci.py:1630). devops ci job-time gives the 20-run mean (docs/commands/ci.md:352). pytest lacks the CI history and the mean; devops ci durations lacks per-test detail within a module. The proposal adds no profiling code.

Key questions

  • Which test or commit made Tests & Coverage slower than 360 s?: The issue names neither. uv run devops ci durations reads the JUnit report of each shard of the last 20 push runs and writes the mean seconds of each test module to tests/module_durations.json, so a diff against the committed record names the module whose time grew. uv run pytest --durations=25 on that module names the slow test, and git log between the last fast and the first slow run names the commit. The local gate also prints the slowest tests from pytest's durations report when its test step passes 300 s. [sources: docs/TESTING.md:198, docs/commands/ci.md:375, src/devops_cli/commands/ci.py:1630, src/devops_cli/ci/diagnostics.py:60, .github/workflows/ci.yml:205, docs/TESTING.md:194]
  • Should the 360 s limit be raised to clear the alarm?: No. AGENTS.md rule 5 makes a check that averages over 5 min + 1 min tolerance a P0 bug, and only the owner may lower a threshold. The fix must lower the mean, not raise the limit. (best practice) [sources: AGENTS.md:11, docs/TESTING.md:193, docs/commands/ci.md:369]
    • Rejected: Raise the limit. It hides a P0 regression and breaks AGENTS.md rule 5.
    • Chosen: Revert or optimize the slow change. It fixes the cause and keeps the gate.
  • Which tool finds the slow test without new code?: Use the project's existing uv run devops ci durations first: it reads the JUnit report of each shard of the last 20 push runs and writes the mean seconds of each test module to tests/module_durations.json, so a diff against the committed record names the module whose time grew. The local gate already prints the slowest tests from pytest's --durations report when the test step passes 300 s, and uv run pytest --durations=25 narrows a module to its slow test. uv run devops ci job-time confirms the 20-run mean. No new profiling code is needed. (best practice) [sources: docs/TESTING.md:198, docs/commands/ci.md:375, src/devops_cli/commands/ci.py:1630, src/devops_cli/ci/diagnostics.py:60, .github/workflows/ci.yml:205, openspec/changes/archive/2026-11-18-6130-tests-coverage-duration-limit/design.md:5]
    • Chosen: devops ci durations plus pytest --durations. The first names the slow module from the CI history that the alarm reads, the second names the slow test; both already exist and need no new code.
    • Rejected: pytest --durations only. It gives per-test times of one local run, not the CI history whose mean rose.
    • Rejected: Custom timing wrapper. It adds code to build, keep and fix; the gate already parses pytest's durations report.
    • Rejected: CI job-time only. It reports the job mean, not the slow test.
  • How does the fix keep the shard split balanced after the slow test changes?: Refresh tests/module_durations.json with uv run devops ci durations after the fix. docs/TESTING.md records that the record is written again when Test Job Duration nears the bound or a change moves much test time, and the shard split weighs each module by those seconds. If the refreshed record and the fix still leave the mean over 360 s, the recorded next step is to add a sixth entry to the test-shard matrix, which holds five shards today. (best practice) [sources: docs/TESTING.md:195, docs/TESTING.md:198, .github/workflows/ci.yml:152, openspec/changes/archive/2026-11-18-6130-tests-coverage-duration-limit/design.md:5]
    • Chosen: Refresh the record, then add a shard if needed. docs/TESTING.md:195 records this order: write the record again first, then add a number to the matrix.
    • Rejected: Add a sixth shard now. The record refresh is the first recorded step and may bring the split under the bound without another runner.
    • Rejected: Leave the record. A stale record unbalances the shards, as docs/TESTING.md:198 says.
    • Rejected: Edit the record by hand. The file is generated from the JUnit reports; devops ci durations writes it.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    priority/p0-critical
    scope/ci
    status/new
    on Nov 18, 2026
  2. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Waiting for the alternatives check to run. The next refine round looks at the item again after the check records a verdict.

  3. dan-petty commented on Nov 23, 2026

    @dan-petty
    Owner

    The premise check of AGENTS.md rule 2 confirms that the last 20 runs of Tests & Coverage on main average 353 seconds. The duration is below the limit of 360 seconds. Closed as not planned.

  4. removed
    status/new
    on Nov 23, 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/p0-criticalscope/citype/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions