diff --git a/.gitattributes b/.gitattributes index 9fffab6336..eed1c70d9f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -18,5 +18,6 @@ uv.lock linguist-generated **/package-lock.json linguist-generated CHANGELOG.md linguist-generated .release-please-manifest.json linguist-generated +tests/module_durations.json linguist-generated docs/CLI_REFERENCE.md linguist-generated docs/commands/*.md linguist-generated diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9a9237dd3..13344d8943 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -105,8 +105,9 @@ jobs: # The test row runs in four shards on four runners (#3050). On one runner the suite took 355 s # to 528 s for the same tests, depending on the speed of the runner that GitHub gave: more than # the 300 s of AGENTS.md rule 5, and growing with the suite. Each shard runs a quarter of the - # tests, keeps its coverage data, and checks no floor, since it measures a part of the tree. It - # passes the paths of its own test files to pytest, so no worker collects the whole suite (#2371). + # recorded test time (tests/module_durations.json, #5247), keeps its coverage data, and checks no + # floor, since it measures a part of the tree. It passes the paths of its own test files to + # pytest, so no worker collects the whole suite (#2371). # The job `Tests & Coverage` below joins the data and checks the floor. The matrix lists the # shards and `strategy.job-total` gives their number, so a fifth shard is one more entry. The # shard jobs are no required check: ADR 0004 binds the ruleset to the aggregate. @@ -190,7 +191,7 @@ jobs: run: uv run devops ci test tests/invariants # The combined data file of the shard, which the gate keeps (#1743), and the JUnit XML report - # with the time of each test of the shard, for the split by measured time (#4673). The + # with the time of each test of the shard, which `devops ci durations` reads (#4673). The # coverage path starts with a dot, so the action needs `include-hidden-files`. - name: Upload Coverage Data and Test Report if: steps.changes.outputs.outside_plan != 'false' @@ -359,16 +360,18 @@ jobs: exit 1 fi - # AGENTS.md rule 5: a check that averages more than 5 minutes is a P0 bug. The run of one pull - # request is one sample, so this job reads the last twenty completed pushes to main from the - # Actions API and fails when the mean of the `Tests & Coverage` check is over 300 s (#2699). The + # AGENTS.md rule 5: a check that averages more than 5 minutes is a P0 bug, with 1 minute of + # tolerance for the variation of the runners. The run of one pull request is one sample, so + # this job reads the last twenty completed pushes to main from the Actions API and fails when + # the mean of the `Tests & Coverage` check is over 360 s (#2699, #5247). Then it comments on the + # open P0 issue of the check, or files one when none is open, so one breach has one issue. The # time of a run is the run time of the slowest shard job plus that of the job `Tests & Coverage`, # which joins the shards (#3050). The time the jobs waited for a runner is shown on its own line # and is not counted (#4634). The job runs only on the daily schedule and on a manual run: a # merge does not change the window of twenty runs much, and a red alarm on each push to main hid # the result of the tests of that push (#4634). No pull request waits for it. It reads the # conclusion of the test job, not of the run, so a failed run still gives its test time to the - # window. It needs `actions: read` only. + # window. It needs `actions: read`, and `issues: write` for the P0 issue. job-time: name: Test Job Duration if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' @@ -377,6 +380,7 @@ jobs: permissions: contents: read actions: read + issues: write steps: - name: Check out repository @@ -393,7 +397,7 @@ jobs: - name: Check the duration of Tests & Coverage env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: uv run devops ci job-time --repo "$GITHUB_REPOSITORY" + run: uv run devops ci job-time --repo "$GITHUB_REPOSITORY" --file-issue # Builds, smoke-tests and scans the Service image of every pull request but the release pull # request, without pushing it; release.yml publishes it when a release is created (#1486). diff --git a/AGENTS.md b/AGENTS.md index e093c6f6b9..30f11d8b42 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -10,7 +10,7 @@ devops-cli is a Python command-line tool, `devops`, that automates workstation, 2. **Check the premise first.** Confirm it against the real system: upstream documents, source or command output. Record how in the proposal `## Feasibility` section. If the item cannot be built as written, write no compensating code. Return it to `New` with the evidence (`devops roadmap return`) and stop. Close issues as rejected if their functionality has been superseded by newer issues or code changes. Stop also when you swallow an error, make product code detect tests, or put a second fix on a fix. 3. **Use an open tool before you build.** Name the tool or library that covers the need. To build instead, write the cost in the issue or pull request: tokens to build, keep and fix it, and elapsed time. This rule outranks every other convention. 4. **Test new behavior first** ([docs/TESTING.md](docs/TESTING.md)). Prove other changes with a command. A fix pull request cites its `fail-to-pass` run (`devops ci fail-to-pass --base `). -5. **Pass the checks.** The pre-push hook runs the fast static checks. Never use `--no-verify`. The required CI checks gate the merge. Never lower a security or quality threshold; only the owner can allow it ([SECURITY.md](SECURITY.md#a-finding-with-no-fix)). A check that averages more than 5 minutes is a P0 bug. +5. **Pass the checks.** The pre-push hook runs the fast static checks. Never use `--no-verify`. The required CI checks gate the merge. Never lower a security or quality threshold; only the owner can allow it ([SECURITY.md](SECURITY.md#a-finding-with-no-fix)). A check that averages over 5 min + 1 min tolerance is a P0 bug. 6. **Open every pull request as a draft** with `devops pr create`, watch it with `devops pr monitor `, and mark it ready (`devops pr ready `) only after the checks pass. Reply in each review thread (`devops pr threads reply`). Advance your pull requests oldest first. Never request a Copilot review. 7. **Use `devops gh` and `devops pr`.** Never run bare `gh`: `devops` paces each request against the rate limit. 8. **Write as merged.** Write code and documents as they will read after the merge. Make no commit or pull request that only updates tracking. If a change makes a document wrong, fix it in the same pull request. diff --git a/docs/CLI_REFERENCE.md b/docs/CLI_REFERENCE.md index 6b2e6aaf44..821e9e84cc 100644 --- a/docs/CLI_REFERENCE.md +++ b/docs/CLI_REFERENCE.md @@ -213,6 +213,7 @@ Exits 1 when a row fails or a pod opens a connection. | | | `devops ci run [OPTIONS]` | Run full CI and return a single pass/fail status. | | | `devops ci mutate [OPTIONS] ` | Mutation-test functions with mutmut and show each mutant no test killed; never a gate. | | | `devops ci job-time [OPTIONS]` | Fail when the last runs of a CI job took more than the limit on average. Reads the job time of the last completed push runs of a workflow on a branch from GitHub's Actions API. A job that passed, failed or timed out counts, whatever the run concluded. Fails too when fewer runs than asked for could be read. | +| | `devops ci durations [OPTIONS]` | Write the mean seconds of each test module to tests/module_durations.json, from the JUnit reports of the test shards of the last push runs of a workflow on a branch. The split of the test shards weighs each module by these seconds. gh downloads the artifacts of each run. A run whose artifacts GitHub no longer holds is left out. | | | `devops ci fail-to-pass [OPTIONS]` | Replay added or modified tests against the merge-base tree to prove a defect fix's tests fail unpatched. A changed module under tests/gate/*_checks/ runs its gate row on the base and head trees: a case of that module that fails on base and passes on head proves the fix. | | [**uv**](commands/uv.md) | `devops uv sync [OPTIONS]` | Sync project dependencies into the virtual environment. | | | `devops uv lock [OPTIONS]` | Regenerate the uv lockfile. | diff --git a/docs/SDLC.md b/docs/SDLC.md index 8690c8559a..eeee2048fc 100644 --- a/docs/SDLC.md +++ b/docs/SDLC.md @@ -226,7 +226,7 @@ CI is the authoritative gate ([ADR 0004](adr/0004-ci-is-the-authoritative-gate.m - The release pull request starts only the jobs of the checks that the `main` ruleset reads: `Static Analysis`, `Tests on Main` and `Tests & Coverage`, `Semantic PR title` and the CodeQL analysis. It changes `pyproject.toml` and `uv.lock`, which are image inputs, and `release.yml` builds, starts and scans each image before it publishes it. So each other job that a push to it starts skips a branch of this repository whose name starts with `release-please--`, and takes no runner (#4637). The branch of a fork with such a name runs these jobs. A new job that no rule of `main` reads gets the same condition: an invariant test in `tests/invariants/test_workflow_contracts.py` fails without it. #### The Test Shards (`ci.yml`, `test-shard` and `test`) -The suite has about 18,000 tests, and on one runner it took 355 s to 528 s, depending on the speed of the runner that GitHub gave. AGENTS.md rule 5 sets the bound at 300 s. The test row therefore runs in four shards on four runners, the jobs `Tests & Coverage (shard of 4)`. Each runs `uv run devops ci --check --no-cache --only test --shard --shards 4`, which passes the paths of about one quarter of the test files to pytest, so a shard collects only its own files. A shard checks no coverage floor, since it measures a part of the tree. Its log gives the reason of each skipped test (`-rfEs`). It uploads its coverage data and a JUnit XML report with the time of each of its tests (`.data/junit.xml`) as one artifact, for the split by measured time (#4250). +The suite has about 18,000 tests, and on one runner it took 355 s to 528 s, depending on the speed of the runner that GitHub gave. AGENTS.md rule 5 sets the bound at 300 s. The test row therefore runs in four shards on four runners, the jobs `Tests & Coverage (shard of 4)`. Each runs `uv run devops ci --check --no-cache --only test --shard --shards 4`, which passes to pytest the paths of the test files that hold about one quarter of the recorded test time (`tests/module_durations.json`), so a shard collects only its own files. A shard checks no coverage floor, since it measures a part of the tree. Its log gives the reason of each skipped test (`-rfEs`). It uploads its coverage data and a JUnit XML report with the time of each of its tests (`.data/junit.xml`) as one artifact. `devops ci durations` reads these reports and writes the record that the split reads (#5247). The required check `Tests & Coverage` is the job that waits for the shards. It fails when a shard did not succeed, because a skipped job would pass a required check. It downloads the data, runs `coverage combine` and `coverage report`, which applies `fail_under` of `pyproject.toml` to the lines and branches of the whole tree (`[tool.coverage.run]` sets `branch = true`), and then runs the step `Changed-Line Coverage`. Beside the step that writes it, the job keeps `.data/coverage.xml` as an artifact with a 7-day retention. The ruleset binds to this job, never to a shard ([ADR 0004](adr/0004-ci-is-the-authoritative-gate.md)). To add a shard, add a number to the matrix `shard` of `test-shard`: the name, `--shards` and the split follow the count. diff --git a/docs/TESTING.md b/docs/TESTING.md index c7207022c4..dc33498d8b 100644 --- a/docs/TESTING.md +++ b/docs/TESTING.md @@ -179,11 +179,12 @@ Every new test follows these rules. Some of them name a path, fixture or check t ### Run time -- The `Tests & Coverage` check must average under 300 s (AGENTS.md, rule 5). `devops ci job-time` reads the time of the check in the last 20 completed pushes to `main` from the Actions API and fails when their mean is over the limit. The time of a run is the run time of the slowest shard job `Tests & Coverage (shard of )` plus the run time of the job `Tests & Coverage`, which joins the shards. The time that the jobs waited for a runner is shown on its own line and is not counted, because the queue depends on the other runs of the account, not on the tests. It counts a job that passed, failed or timed out, whatever the run concluded, so a slow run that failed stays in the mean. The `Test Job Duration` job of `ci.yml` runs it every day and on a manual run, not on a push, so a push to `main` is green when its tests pass. A pull request cannot show the mean, so the check reads the history of `main`, not the pull request. A mean over the limit is a P0 bug: find the change that made the check slow, and fix it or revert it. Do not narrow or skip a needed check to hide the time. +- The `Tests & Coverage` check must average under 300 s (AGENTS.md, rule 5). The owner allows 60 s of tolerance for the variation of the runners (2026-10-23), so the limit of the alarm is 360 s. `devops ci job-time` reads the time of the check in the last 20 completed pushes to `main` from the Actions API and fails when their mean is over the limit. The time of a run is the run time of the slowest shard job `Tests & Coverage (shard of )` plus the run time of the job `Tests & Coverage`, which joins the shards. The time that the jobs waited for a runner is shown on its own line and is not counted, because the queue depends on the other runs of the account, not on the tests. It counts a job that passed, failed or timed out, whatever the run concluded, so a slow run that failed stays in the mean. The `Test Job Duration` job of `ci.yml` runs it every day and on a manual run, not on a push, so a push to `main` is green when its tests pass. A pull request cannot show the mean, so the check reads the history of `main`, not the pull request. A mean over the limit is a P0 bug: find the change that made the check slow, and fix it or revert it. Do not narrow or skip a needed check to hide the time. The job runs the check with `--file-issue`: over the limit, it comments on the open issue whose body holds the alarm line of the check, or files one with the labels `type/bug`, `scope/ci`, `status/new` and `priority/p0-critical` when none is open. The issue holds a Priority, so intake does not place it, and the Status New lets refine read it. So one breach has one issue, also after a person changes its title or labels, and the next breach after the issue closes files a new one. - The budget measures the mean of the `Tests & Coverage` check on `main`, not the test step of one local run. A local `uv run devops ci` runs the whole suite on every logical CPU of a host, and the gates of other agents share that host, so a local full gate can pass the budget on a shared host. When the test step of a local run goes above `CONST_CI_TEST_BUDGET_SECONDS` (300 s), the gate prints the time of the step and the slowest tests against the budget. It fails no test on the time. -- The same suite took 355 s on a fast runner and 528 s on a slow one (2026-11-04), so no cut of constant work holds the bound on every runner. The test row runs in four shards, one quarter of the tests on each runner (`devops ci --only test --shard --shards 4`, split by lines of test code). When `Test Job Duration` nears the bound, add a number to the matrix of the job `test-shard`. A test must not depend on a test that runs before it in the same process, since a shard holds only some of the tests. +- The same suite took 355 s on a fast runner and 528 s on a slow one (2026-11-04), so no cut of constant work holds the bound on every runner. The test row runs in four shards, one quarter of the recorded test time on each runner (`devops ci --only test --shard --shards 4`). When `Test Job Duration` nears the bound, write the record again first (`uv run devops ci durations`, below), then add a number to the matrix of the job `test-shard`. A test must not depend on a test that runs before it in the same process, since a shard holds only some of the tests. - A shard measures a part of the tree, so it checks no coverage floor and prints no report. The job `Tests & Coverage` combines the coverage data of the shards and checks `fail_under` on the whole. -- A shard collects only its own test files. Pytest collects every file it gets, in every xdist worker. A split plugin that deselects tests after collection makes each worker collect the whole suite. That cost 31.8 s of CPU in each of 16 workers, which is 13.5% of the CPU of a run (2026-11-05, 16-CPU host, 19,074 tests). Now `devops ci --shard --shards ` passes the paths of the test modules of the shard to pytest. The split is by lines of test code, heaviest file first, and it stores no data. A new test module joins a shard with no other step. A quarter of the files collects in about two thirds of the CPU time of the whole suite, not a quarter. The imports of shared modules stay. In the same run, worker start was 2.8% of the CPU and the controller was 1.4%. A preload fixture gave no saving. A test must not depend on a test of another file, because a shard holds only some of the files. For the same reason a `conftest.py` below `tests/` imports no devops-cli module at its top: a run that names a file below its directory loads it before the root conftest isolates HOME, and devops-cli binds its paths under HOME when it is first imported. +- A shard collects only its own test files. Pytest collects every file it gets, in every xdist worker. A split plugin that deselects tests after collection makes each worker collect the whole suite. That cost 31.8 s of CPU in each of 16 workers, which is 13.5% of the CPU of a run (2026-11-05, 16-CPU host, 19,074 tests). Now `devops ci --shard --shards ` passes the paths of the test modules of the shard to pytest. A quarter of the files collects in about two thirds of the CPU time of the whole suite, not a quarter. The imports of shared modules stay. In the same run, worker start was 2.8% of the CPU and the controller was 1.4%. A preload fixture gave no saving. A test must not depend on a test of another file, because a shard holds only some of the files. For the same reason a `conftest.py` below `tests/` imports no devops-cli module at its top: a run that names a file below its directory loads it before the root conftest isolates HOME, and devops-cli binds its paths under HOME when it is first imported. +- The split weighs each test module by its recorded seconds in `tests/module_durations.json` (#5247). It deals the modules, heaviest first, to the shard with the least weight so far. A module that the record does not hold weighs its lines at the recorded seconds per line, so a new test module joins a shard with no other step. A module that the record holds and the tree does not is in no shard. A stale record only unbalances the shards and drops no test, and every runner reads the same record from the same commit. The split by lines put a short module with slow tests in one shard, and each change of the tree moved modules between shards: in one run of 2026-11-13 the four shards took 160 s to 341 s, and the mean of the check over 20 runs was 316 s. A replay of the last 20 runs of `main` with weights from the other 19 runs gives a mean of 284 s. `uv run devops ci durations` writes the record: it reads the JUnit report of each shard of the last 20 push runs of `main`, which `ci.yml` uploads in the artifact `coverage-shard-` and keeps for 7 days, and writes the mean seconds of each module over the runs that ran it. Write it again when `Test Job Duration` nears the bound, or after a change moves much test time, and commit the file. - An autouse fixture runs before each of the 14,000 tests, so it does no work that most tests do not need. A fixture that loads settings, opens a database or lists a directory belongs to the tests that ask for it. A numbered directory made for every test, such as `tmp_path_factory.mktemp("run")`, is slow: pytest lists every entry of the base directory to find the next number. - `tmp_path_retention_policy = "failed"` in `pyproject.toml` deletes the directory of a test that passed, so the base directory stays small. A later test can therefore get the path of an earlier one. A cache that is keyed by a path and holds the content of a file is wrong in such a run: key it by the content. - The root conftest raises the young threshold of the garbage collector to `GC_YOUNG_THRESHOLD`. The default made the collector a tenth of the run time. A test that needs the collector calls `gc.collect()`. diff --git a/docs/commands/ci.md b/docs/commands/ci.md index b8b141bb28..5e9ab652e6 100644 --- a/docs/commands/ci.md +++ b/docs/commands/ci.md @@ -383,7 +383,28 @@ devops ci job-time [OPTIONS] | `--workflow` | `string` | `ci.yml` | Workflow file that holds the job. | | `--branch`, `-b` | `string` | `main` | Branch whose push runs are read. | | `--runs` | `integer` | `20` | How many of the last runs the mean covers. | -| `--limit` | `float` | `300.0` | Most seconds the mean of the runs may be. | +| `--limit` | `float` | `360.0` | Most seconds the mean of the runs may be. Default: the 300 s of AGENTS.md rule 5 and the 60 s of tolerance that the owner allows for the variation of the runners. | +| `--file-issue` | `boolean` | - | When the mean is over the limit, comment on the open issue of the check, or file one with the priority P0 when none is open. The search for the open issue reads the line that the command writes in the body of the issue, so a changed title or label files no second issue. | +| `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. | + +--- + +## `devops ci durations` + +**Write the mean seconds of each test module to tests/module_durations.json, from the JUnit reports of the test shards of the last push runs of a workflow on a branch. The split of the test shards weighs each module by these seconds. gh downloads the artifacts of each run. A run whose artifacts GitHub no longer holds is left out.** + +```bash +devops ci durations [OPTIONS] +``` + +**Options:** + +| Option / Flag | Type | Default | Description | +|---|---|---|---| +| `--repo`, `-R` | `string` | - | Repository as owner/name. Default: the origin of the current checkout. | +| `--workflow` | `string` | `ci.yml` | Workflow file that holds the job. | +| `--branch`, `-b` | `string` | `main` | Branch whose push runs are read. | +| `--runs` | `integer` | `20` | How many of the last runs with an ended Tests & Coverage check to read. | | `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. | --- diff --git a/openspec/changes/archive/2026-11-13-5247-the-duration-alarm-fires-at-360/.openspec.yaml b/openspec/changes/archive/2026-11-13-5247-the-duration-alarm-fires-at-360/.openspec.yaml new file mode 100644 index 0000000000..22ca07d756 --- /dev/null +++ b/openspec/changes/archive/2026-11-13-5247-the-duration-alarm-fires-at-360/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-11-13 diff --git a/openspec/changes/archive/2026-11-13-5247-the-duration-alarm-fires-at-360/design.md b/openspec/changes/archive/2026-11-13-5247-the-duration-alarm-fires-at-360/design.md new file mode 100644 index 0000000000..2d58459ab6 --- /dev/null +++ b/openspec/changes/archive/2026-11-13-5247-the-duration-alarm-fires-at-360/design.md @@ -0,0 +1,21 @@ +# Design + +## Decisions + +- **Limit = target + tolerance.** `CONST_CI_JOB_TIME_LIMIT_SECONDS` is the sum of `CONST_CI_TEST_BUDGET_SECONDS` (300 s) and `CONST_CI_TEST_BUDGET_TOLERANCE_SECONDS` (60 s), and it is the default of `--limit`. The target stays 300 s: the local gate still warns above it, and the split aims under it. +- **One issue for one breach.** The alarm issue holds the line ``. A run over the limit searches the issues whose body holds `devops-ci-job-time` and counts only an open issue with the line of its own check. It comments on the lowest such number, or files a new issue when none is open. The title holds the mean and the limit for a person, and no reader uses it as a key, because the roadmap Service can change a title and a person can change the labels. +- **The alarm stays red.** The command still exits 1 over the limit, with or without the issue. The issue holds the work, and the red row shows the state of `main`. +- **No issue without a full read.** A short read or a mean inside the limit makes no search and no write. +- **A record per module, in the tree.** `tests/module_durations.json` maps the path of each test module to its mean seconds, in tenths of a second, one module a line. Every runner reads the same file from the same commit, so the four shards compute one split. The split needs a weight per module, not per test. +- **Fallback by lines at the recorded rate.** A module that the record does not hold weighs its lines times the recorded seconds per line of the recorded modules of the tree. A large new module stays heavy, and a tree with no record splits by lines as before. A recorded module that the tree does not hold is in no shard and is not in the rate. +- **The mean over the runs that ran a module.** Runner speed changes from job to job, and the mean of 20 runs smooths it. A module that a run did not run, such as one of a failed shard, takes no zero into its mean. +- **The writer reads CI, and a person or agent commits.** `devops ci durations` reads the reports of the last 20 runs, the same window as the alarm, and writes the file. No job of CI writes to `main`. + +## Rejected alternatives + +- **pytest-split.** It selects tests after it collects the whole suite in each shard. #3810 measured 31.8 s of CPU in each of 16 workers for that collection, 13.5% of a run. Its file holds each test (about 19,000 lines). +- **Download the reports in each shard at run time.** The four shards would read the newest run at different times, and two runners that read two runs compute two splits that drop or repeat modules (#4250, scope of 2026-11-11). +- **The mean weight for a new module.** The replay found no gain over the lines at the recorded rate, and a module of 2,000 lines would weigh the same as one of 20 lines. +- **A fifth shard.** #4473 closed as not planned: each shard adds jobs under the cap of 20 concurrent jobs of the account. The replay shows that four balanced shards reach 284 s. +- **The title as the key of the issue.** The roadmap Service retitles issues, so the next run would file a second issue. +- **A list of every open issue.** The repository holds about 750 open issues, 8 pages a run; one search request finds the alarm line. diff --git a/openspec/changes/archive/2026-11-13-5247-the-duration-alarm-fires-at-360/proposal.md b/openspec/changes/archive/2026-11-13-5247-the-duration-alarm-fires-at-360/proposal.md new file mode 100644 index 0000000000..8613f37d2a --- /dev/null +++ b/openspec/changes/archive/2026-11-13-5247-the-duration-alarm-fires-at-360/proposal.md @@ -0,0 +1,51 @@ +# Proposal: #5247 + +## Why + +AGENTS.md rule 5 makes a check that averages more than 5 minutes a P0 bug. On 2026-10-23 the owner allowed 1 minute of tolerance for the variation of the runners, but `devops ci job-time` still fails at 300 s, and a breach files no issue: the daily `Test Job Duration` job only turns red. On 2026-11-13 it read a mean of 316 s for `Tests & Coverage` on `main`, so `main` is red and this is a P0 bug. The cause of the time is the split of the four test shards by lines of test code: a short module with slow tests makes one shard long, and each change of the tree moves modules between shards. In one run the four shards took 160 s to 341 s. The pin of pytest-split stays in the dev group with no use. Closes #5247. + +## What Changes + +- `devops ci job-time` fails when the mean is over 360 s by default: the 300 s target of AGENTS.md rule 5 (`CONST_CI_TEST_BUDGET_SECONDS`) plus 60 s of tolerance (`CONST_CI_TEST_BUDGET_TOLERANCE_SECONDS`). The warning of a local gate stays at 300 s. +- `devops ci job-time --file-issue`: when all the wanted runs were read and the mean is over the limit, the command comments on the open issue whose body holds the alarm line of the check, or files one with the labels `type/bug`, `scope/ci`, `status/new` and `priority/p0-critical`. The issue holds a Priority, so intake does not place it, and refine reads only the items with the Status New or Ready, so the job sets the Status New that intake gives a new item. The issue search finds the line, so a changed title or label files no second issue. +- The job `job-time` of `ci.yml` runs with `--file-issue` and gets `issues: write`. +- `shard_test_files` weighs each test module by its recorded seconds in `tests/module_durations.json`. A module that the record does not hold weighs its lines at the recorded seconds per line. With no record, every module weighs its lines, as before. +- The new command `devops ci durations` writes the record from the JUnit reports of the shards of the last 20 push runs of `main`, which `ci.yml` already uploads (#4673). `gh run download` gets the artifacts. The JUnit reader of `ci/fail_to_pass.py` now keeps the time of each test. +- `GitHubClient` gets `get_run_artifact_names` and `create_issue`. +- The record of the last 20 runs is committed. +- The pin `pytest-split==0.11.0` and its lock entry go. +- AGENTS.md rule 5, docs/TESTING.md (Run time), the knowledge base task `ci_quality_gate.md` and the comments of `ci.yml` state the new limit, the issue and the split. +- A command, an option and a message change, so both capabilities carry a delta. The change fits one pull request. + +## Capabilities + +- `ci-job-time` (modified): the default limit, the P0 issue of a breach, and the permissions of the job. +- `ci-test-shards` (modified): the split by recorded seconds, and the command that writes the record. + +## Impact + +- A replay of the last 20 runs of `main` gives a mean of 284 s with the new split, under the 300 s target, against the 316 s that the runs took. +- The `Test Job Duration` job can write issues of this repository. It writes at most one comment or one issue each day. +- A new test module joins a shard with no other step. A stale record only unbalances the shards and drops no test. +- No setting, secret or repository setting changes. The required checks keep their names. + +## Feasibility + +- Command run on 2026-11-13, `uv run devops ci job-time` at `main` 54cf0a526: 20 runs, mean 316 s, mean queue 7 s, exit 1 against the limit of 300 s. The scheduled run 43370174775 failed with the same text (evidence comment on #5247). +- Actions API, `GET /repos/dan-petty/devops-cli/actions/runs//artifacts` for each of the 20 runs: each run holds `coverage-shard-1` to `coverage-shard-4`, and each artifact holds `junit.xml`. Each `testcase` has a `time` and a `classname` that names the module path with dots. All the tests of the 80 reports map to the 1,194 test modules of the tree. +- Actions API, jobs of the same runs: the shard jobs took 157 s to 341 s, the join job 35 s to 52 s. A shard job is about 44 s of setup plus the pytest session, and the session is about 18 s plus 0.28 of the summed test seconds of the shard (fit over the 80 shards). +- Replay of the 20 runs (scratch script over the downloaded reports): each shard keeps the setup and the residual of its own runner, and only its modules change. The split of each run reproduces the 316 s. The split by lines of the current tree gives 298 s. The split by recorded seconds, with the weights of each run taken from the other 19 runs, gives 284 s. A perfect balance gives about 274 s. +- `gh run download --pattern` unpacks each matched artifact into a folder of its name. The run of `uv run devops ci durations --runs 20` that wrote the committed record used it. +- The issue search finds text inside an HTML comment of a body (#2419). `review/filed_findings.py` and `research/sweep.py` find their issues the same way. +- Source of the roadmap at `main`: intake decides only an open issue that holds no Priority (`_is_candidate` in `roadmap/intake/intake.py`), and refine reads only the open items with the Status New or Ready (`_refinable` in `roadmap/refine/refine.py`). So an alarm issue with a Priority and no Status would stay outside the roadmap. It gets `status/new`. +- The owner's words of 2026-10-23, which #4250 quotes: a mean over 5 minutes, with 1 minute of tolerance for build variation, is a P0 blocking bug. +- `git grep pytest-split` at `main` finds the pin, the lock entry and a recorded census fixture only. The shard command holds no `--splits` (spec `ci-test-shards`). +- `tests/invariants/test_agents_md.py` passes with AGENTS.md at 6,499 of 6,500 characters. + +## Existing Tool Considered + +- pytest-split 0.11.0 (MIT, last release 2026-02-03) splits by stored durations, but it selects the tests of a group after it collects the whole suite. Each xdist worker of each shard then collects every file, which cost 13.5% of the CPU of a run (#3810). Its `.test_durations` file holds each test, about 19,000 lines. It covers no part of this change, so its pin goes. +- gh (`gh run download`) downloads and unpacks the artifacts, through `run_gh`, which paces it. The JUnit reader of `ci/fail_to_pass.py` (stdlib `html.parser`) reads the times, and pydantic reads the record. +- The issue search of GitHub, through `GitHubClient.search_issue_bodies`, finds the open alarm issue, as the review and research filers do. +- Built instead: the weight of a module, the record and its writer, and the alarm issue. Cost: about 150,000 tokens and 3 hours to build; upkeep is a run of `devops ci durations` when the alarm nears the limit. +- Deleted: the rule that the split stores no data, and the pin and lock entry of pytest-split. diff --git a/openspec/changes/archive/2026-11-13-5247-the-duration-alarm-fires-at-360/specs/ci-job-time/spec.md b/openspec/changes/archive/2026-11-13-5247-the-duration-alarm-fires-at-360/specs/ci-job-time/spec.md new file mode 100644 index 0000000000..52489d48e2 --- /dev/null +++ b/openspec/changes/archive/2026-11-13-5247-the-duration-alarm-fires-at-360/specs/ci-job-time/spec.md @@ -0,0 +1,75 @@ +## MODIFIED Requirements + +### Requirement: The mean time of the test job over its last runs is checked +The `devops ci job-time` command SHALL read from the GitHub Actions API the time of a named check in the last completed `push` runs of a workflow on a branch. By default it SHALL read the check `Tests & Coverage` of `ci.yml` on `main`, 20 runs, with a limit of 360 seconds: 300 seconds and 60 seconds of tolerance. The command SHALL exit 0 when the mean of the runs is not over the limit, and exit 1 when it is. It SHALL print the time of each run read and the mean. + +#### Scenario: The mean is inside the limit +- **WHEN** the last 20 runs of the job took 100 seconds each and the user runs `devops ci job-time` +- **THEN** the command exits 0 and the output names the mean of 100 seconds and the limit of 360 seconds + +#### Scenario: The mean is over the target and inside the tolerance +- **WHEN** the last 20 runs of the job took 330 seconds each and the user runs `devops ci job-time` +- **THEN** the command exits 0 + +#### Scenario: The mean is over the limit +- **WHEN** the last 20 runs of the job took 400 seconds each and the user runs `devops ci job-time` +- **THEN** the command exits 1 and the output names the mean of 400 seconds and says that it is over the limit + +#### Scenario: The mean is on the limit +- **WHEN** the mean of the runs is exactly the limit +- **THEN** the command exits 0 + +#### Scenario: One slow run among fast ones +- **WHEN** 19 of the 20 runs took 250 seconds and one took 400 seconds +- **THEN** the mean is 257.5 seconds and the command exits 0 + +#### Scenario: The count and the limit are options +- **WHEN** the user runs the command with `--runs 2 --limit 120` and the last two runs took 100 and 200 seconds +- **THEN** the command exits 1, and with `--limit 150` it exits 0 + +### Requirement: The workflow runs the check on main +The workflow `ci.yml` SHALL hold a job that runs `devops ci job-time --file-issue` on its daily schedule and on a manual run, and on no other event. No job SHALL wait for it. The job SHALL read the history of `main` with a token that can only read the repository contents and the Actions runs and write issues. The concurrency group of `ci.yml` SHALL hold the event name, so that a push to `main` does not cancel the schedule run. + +#### Scenario: The daily schedule +- **WHEN** the schedule starts `ci.yml` +- **THEN** the run has a job `Test Job Duration` that runs `devops ci job-time --file-issue` + +#### Scenario: A push to main +- **WHEN** a commit is pushed to `main` +- **THEN** the run has no job `Test Job Duration`, so the run is green when its other jobs pass + +#### Scenario: A pull request +- **WHEN** a pull request is opened or updated +- **THEN** the run has no job `Test Job Duration` + +#### Scenario: A push during the schedule run +- **WHEN** a commit is pushed to `main` while the schedule run of `ci.yml` runs +- **THEN** the push run is in another concurrency group, and the schedule run is not cancelled + +## ADDED Requirements + +### Requirement: A mean over the limit has one P0 issue +With `--file-issue` and a full read over the limit, the command SHALL comment on the lowest open issue whose body holds the line `` of the check, which an issue search for `devops-ci-job-time` finds. With no such open issue, it SHALL file one that ends with that line and has the labels `type/bug`, `scope/ci`, `status/new` and `priority/p0-critical`. It SHALL print the address of the issue and still exit 1. + +#### Scenario: No open issue holds the alarm +- **WHEN** the mean of 20 runs is 400 seconds, and the only issue with the line of the check is closed, and the user runs `devops ci job-time --file-issue` +- **THEN** the command files one issue titled `fix(ci): Tests & Coverage averages 400 s, over the 360 s limit` with the four labels and a body that ends with the line, and exits 1 + +#### Scenario: An open issue holds the alarm +- **WHEN** the mean is over the limit and an open issue holds the line of the check under a title that a person changed +- **THEN** the command comments on that issue and files no issue + +#### Scenario: An issue holds the alarm of another check +- **WHEN** the only open issues hold the line of another check or the word `devops-ci-job-time` in other text +- **THEN** they do not count as the alarm issue of the check + +### Requirement: No issue request without a breach +With `--file-issue`, a mean inside the limit or a short read SHALL make no search and no write. A dry run SHALL list the search, the comment and the new issue, each with its condition, and make no request. + +#### Scenario: No breach +- **WHEN** the mean is inside the limit, or only 3 of 20 runs could be read +- **THEN** the command searches no issue and writes nothing + +#### Scenario: Dry run with the issue +- **WHEN** the user runs `devops ci job-time --file-issue --dry-run` +- **THEN** the plan lists the issue search, the comment and the new issue, and GitHub receives no request diff --git a/openspec/changes/archive/2026-11-13-5247-the-duration-alarm-fires-at-360/specs/ci-test-shards/spec.md b/openspec/changes/archive/2026-11-13-5247-the-duration-alarm-fires-at-360/specs/ci-test-shards/spec.md new file mode 100644 index 0000000000..5e9f786133 --- /dev/null +++ b/openspec/changes/archive/2026-11-13-5247-the-duration-alarm-fires-at-360/specs/ci-test-shards/spec.md @@ -0,0 +1,51 @@ +## MODIFIED Requirements + +### Requirement: Each shard collects only its own test files +The shards SHALL partition the test modules of `tests/`: each module SHALL be in exactly one shard, and no shard SHALL be empty. The split SHALL be the same in every call. It SHALL be computed from the files of the checkout alone: the test modules and the record `tests/module_durations.json`. + +#### Scenario: Four shards cover every test module once +- **WHEN** the module lists of shards 1 to 4 of 4 are built for the tree +- **THEN** every test module of `tests/` is in exactly one list, and no list is empty + +#### Scenario: The split is the same in every call +- **WHEN** the module list of a shard is built twice, in any order of the shards +- **THEN** the two lists are equal + +#### Scenario: The split has no stored input +- **WHEN** the modules of a tree without `tests/module_durations.json` are dealt to two shards +- **THEN** the lists come from the line counts of the files, the heaviest file going first to the shard with the fewest lines so far + +## ADDED Requirements + +### Requirement: The shards balance the recorded seconds +The split SHALL weigh each test module by its seconds in `tests/module_durations.json`. A module that the record does not hold SHALL weigh its lines times the recorded seconds per line of the recorded modules of the tree. A recorded module that the tree does not hold SHALL be in no shard and SHALL NOT count in that rate. The modules SHALL go, heaviest first and then by path, to the shard with the least weight so far, and a tie SHALL go to the lower shard. + +#### Scenario: A short module with a long recorded time +- **WHEN** a module of 10 lines has a record of 300 seconds and three modules of 500 lines each have 10 seconds, and the modules are dealt to two shards +- **THEN** the short module is alone in its shard and the three other modules share the other shard + +#### Scenario: A module without a record +- **WHEN** two recorded modules of 100 lines each have 100 and 10 seconds, a third module of 100 lines has no record, and the modules are dealt to two shards +- **THEN** the third module weighs 55 seconds and shares a shard with the module of 10 seconds + +#### Scenario: A deleted module in the record +- **WHEN** the record holds a module that the tree does not hold +- **THEN** no shard holds it, and its seconds do not change the weight of a module without a record + +### Requirement: The record is written from the shard reports of CI +`devops ci durations` SHALL read the last 20 push runs of `ci.yml` on `main` where `Tests & Coverage` ran to an end. It SHALL download their `coverage-shard-*` artifacts with `gh run download` and read the time of each test from the JUnit XML reports. It SHALL write the mean seconds of each module of the tree over the runs that ran it to `tests/module_durations.json`, in tenths of a second. + +#### Scenario: Two runs with reports and one without +- **WHEN** run 2 holds two shard reports, run 1 one report, and run 3 only an expired shard artifact, and the user runs `devops ci durations --runs 3` +- **THEN** gh downloads the artifacts of runs 2 and 1 only, and the record holds the mean of each module over the runs that ran it + +### Requirement: No record without a report +When no run read holds a shard artifact that GitHub still keeps, `devops ci durations` SHALL exit 1 and write no record. A dry run SHALL list its requests and the download, and make none. + +#### Scenario: No run holds a report +- **WHEN** the shard artifacts of every run read are expired +- **THEN** the command exits 1, writes no record and downloads nothing + +#### Scenario: Dry run +- **WHEN** the user runs `devops ci durations --dry-run` +- **THEN** the plan names the listing of runs, the jobs and artifacts of each run and the download, and no request is made diff --git a/openspec/changes/archive/2026-11-13-5247-the-duration-alarm-fires-at-360/tasks.md b/openspec/changes/archive/2026-11-13-5247-the-duration-alarm-fires-at-360/tasks.md new file mode 100644 index 0000000000..72cccf30bb --- /dev/null +++ b/openspec/changes/archive/2026-11-13-5247-the-duration-alarm-fires-at-360/tasks.md @@ -0,0 +1,34 @@ +# Tasks + +## 1. Behavior: the alarm limit and the P0 issue + +- [x] 1.1 Add the failing tests: the default limit is 360 s (330 s and 360 s pass, 361 s fails), `--file-issue` files one P0 issue when no open issue holds the alarm line, comments on the open one and files no second, makes no request inside the limit or on a short read, and the dry run lists the search and both writes; the job of `ci.yml` runs with `--file-issue` and `issues: write` + - Verification: `$ uv run devops ci test tests/github/test_ci_job_time.py` +- [x] 1.2 Add `CONST_CI_TEST_BUDGET_TOLERANCE_SECONDS` and `CONST_CI_JOB_TIME_LIMIT_SECONDS`, `raise_alarm` in `ci/job_time.py`, `GitHubClient.create_issue`, the option `--file-issue` and its messages, and the permission and option in `ci.yml` + - Verification: `$ uv run devops ci test tests/github/test_ci_job_time.py tests/commands/test_ci.py` +- [x] 1.3 Check the workflow + - Verification: `$ uv run devops ci --only actionlint,zizmor` + +## 2. Behavior: the split by recorded seconds and its record + +- [x] 2.1 Add the failing tests: a short module with a long recorded time is alone in its shard, a module without a record weighs its lines at the recorded rate, a deleted module is ignored, the committed record maps test modules to seconds, and `devops ci durations` writes the mean of each module over the runs that hold reports, skips a run without shard artifacts, exits 1 with none, and lists its requests in a dry run + - Verification: `$ uv run devops ci test tests/commands/test_ci_shard.py tests/ci/test_ci_durations.py` +- [x] 2.2 Weigh the modules in `shard_test_files` by `recorded_durations`, keep the time of each test in the JUnit reader, add `ci/durations.py`, `GitHubClient.get_run_artifact_names` and the command `devops ci durations` + - Verification: `$ uv run devops ci test tests/commands/test_ci_shard.py tests/ci/test_ci_durations.py tests/ci/test_fail_to_pass.py` + +## 3. Data: the record of the last 20 runs + +- [x] 3.1 Write `tests/module_durations.json` from the last 20 push runs of `main`, and mark it generated in `.gitattributes` + - Verification: `$ uv run devops ci test tests/commands/test_ci_shard.py` + +## 4. Deletion: the unused pytest-split pin + +- [x] 4.1 Remove `pytest-split==0.11.0` from the dev group and lock again + - Verification: `! git grep -n pytest-split -- pyproject.toml uv.lock` + +## 5. Documents + +- [x] 5.1 State the limit, the tolerance, the P0 issue and the split in AGENTS.md rule 5, docs/TESTING.md (Run time), the knowledge base task `ci_quality_gate.md` and the comments of `ci.yml`, and regenerate the command reference + - Verification: `$ uv run devops docs generate --check` + +- Pending a person: review the diff in tuicr (tuicr -r origin/main..HEAD). diff --git a/openspec/specs/ci-job-time/spec.md b/openspec/specs/ci-job-time/spec.md index 94ea059f9f..ecbc812770 100644 --- a/openspec/specs/ci-job-time/spec.md +++ b/openspec/specs/ci-job-time/spec.md @@ -1,16 +1,20 @@ # ci-job-time Specification ## Purpose -How `devops ci job-time` finds out whether a CI job, by default the test job, still averages less than five minutes over its last runs on `main`, so that AGENTS.md rule 5 is checked on the history of the runner and not on the one run of a pull request. +How `devops ci job-time` finds out whether a CI job, by default the test job, still averages less than five minutes, with one minute of tolerance, over its last runs on `main`, so that AGENTS.md rule 5 is checked on the history of the runner and not on the one run of a pull request. ## Requirements ### Requirement: The mean time of the test job over its last runs is checked -The `devops ci job-time` command SHALL read from the GitHub Actions API the time of a named check in the last completed `push` runs of a workflow on a branch. By default it SHALL read the check `Tests & Coverage` of `ci.yml` on `main`, 20 runs, with a limit of 300 seconds. The command SHALL exit 0 when the mean of the runs is not over the limit, and exit 1 when it is. It SHALL print the time of each run read and the mean. +The `devops ci job-time` command SHALL read from the GitHub Actions API the time of a named check in the last completed `push` runs of a workflow on a branch. By default it SHALL read the check `Tests & Coverage` of `ci.yml` on `main`, 20 runs, with a limit of 360 seconds: 300 seconds and 60 seconds of tolerance. The command SHALL exit 0 when the mean of the runs is not over the limit, and exit 1 when it is. It SHALL print the time of each run read and the mean. #### Scenario: The mean is inside the limit - **WHEN** the last 20 runs of the job took 100 seconds each and the user runs `devops ci job-time` -- **THEN** the command exits 0 and the output names the mean of 100 seconds and the limit of 300 seconds +- **THEN** the command exits 0 and the output names the mean of 100 seconds and the limit of 360 seconds + +#### Scenario: The mean is over the target and inside the tolerance +- **WHEN** the last 20 runs of the job took 330 seconds each and the user runs `devops ci job-time` +- **THEN** the command exits 0 #### Scenario: The mean is over the limit - **WHEN** the last 20 runs of the job took 400 seconds each and the user runs `devops ci job-time` @@ -92,11 +96,11 @@ With `--dry-run` the command SHALL make no request to GitHub. It SHALL list the - **THEN** the command exits 0, GitHub receives no request, and the output names the listing of the runs of `ci.yml` ### Requirement: The workflow runs the check on main -The workflow `ci.yml` SHALL hold a job that runs `devops ci job-time` on its daily schedule and on a manual run, and on no other event. No job SHALL wait for it. The job SHALL read the history of `main` with a token that can only read the repository contents and the Actions runs. The concurrency group of `ci.yml` SHALL hold the event name, so that a push to `main` does not cancel the schedule run. +The workflow `ci.yml` SHALL hold a job that runs `devops ci job-time --file-issue` on its daily schedule and on a manual run, and on no other event. No job SHALL wait for it. The job SHALL read the history of `main` with a token that can only read the repository contents and the Actions runs and write issues. The concurrency group of `ci.yml` SHALL hold the event name, so that a push to `main` does not cancel the schedule run. #### Scenario: The daily schedule - **WHEN** the schedule starts `ci.yml` -- **THEN** the run has a job `Test Job Duration` that runs `devops ci job-time` +- **THEN** the run has a job `Test Job Duration` that runs `devops ci job-time --file-issue` #### Scenario: A push to main - **WHEN** a commit is pushed to `main` @@ -109,3 +113,29 @@ The workflow `ci.yml` SHALL hold a job that runs `devops ci job-time` on its dai #### Scenario: A push during the schedule run - **WHEN** a commit is pushed to `main` while the schedule run of `ci.yml` runs - **THEN** the push run is in another concurrency group, and the schedule run is not cancelled + +### Requirement: A mean over the limit has one P0 issue +With `--file-issue` and a full read over the limit, the command SHALL comment on the lowest open issue whose body holds the line `` of the check, which an issue search for `devops-ci-job-time` finds. With no such open issue, it SHALL file one that ends with that line and has the labels `type/bug`, `scope/ci`, `status/new` and `priority/p0-critical`. It SHALL print the address of the issue and still exit 1. + +#### Scenario: No open issue holds the alarm +- **WHEN** the mean of 20 runs is 400 seconds, and the only issue with the line of the check is closed, and the user runs `devops ci job-time --file-issue` +- **THEN** the command files one issue titled `fix(ci): Tests & Coverage averages 400 s, over the 360 s limit` with the four labels and a body that ends with the line, and exits 1 + +#### Scenario: An open issue holds the alarm +- **WHEN** the mean is over the limit and an open issue holds the line of the check under a title that a person changed +- **THEN** the command comments on that issue and files no issue + +#### Scenario: An issue holds the alarm of another check +- **WHEN** the only open issues hold the line of another check or the word `devops-ci-job-time` in other text +- **THEN** they do not count as the alarm issue of the check + +### Requirement: No issue request without a breach +With `--file-issue`, a mean inside the limit or a short read SHALL make no search and no write. A dry run SHALL list the search, the comment and the new issue, each with its condition, and make no request. + +#### Scenario: No breach +- **WHEN** the mean is inside the limit, or only 3 of 20 runs could be read +- **THEN** the command searches no issue and writes nothing + +#### Scenario: Dry run with the issue +- **WHEN** the user runs `devops ci job-time --file-issue --dry-run` +- **THEN** the plan lists the issue search, the comment and the new issue, and GitHub receives no request diff --git a/openspec/specs/ci-test-shards/spec.md b/openspec/specs/ci-test-shards/spec.md index 888368d720..cffcc448b2 100644 --- a/openspec/specs/ci-test-shards/spec.md +++ b/openspec/specs/ci-test-shards/spec.md @@ -71,7 +71,7 @@ When the join check `Tests & Coverage` and a shard check `Tests & Coverage (shar - **THEN** the watch reports the shard check, and the fix step reads the log of that shard ### Requirement: Each shard collects only its own test files -The shards SHALL partition the test modules of `tests/`: each module SHALL be in exactly one shard, and no shard SHALL be empty. The split SHALL be the same in every call. It SHALL be computed from the files of the checkout alone, with no stored input. +The shards SHALL partition the test modules of `tests/`: each module SHALL be in exactly one shard, and no shard SHALL be empty. The split SHALL be the same in every call. It SHALL be computed from the files of the checkout alone: the test modules and the record `tests/module_durations.json`. #### Scenario: Four shards cover every test module once - **WHEN** the module lists of shards 1 to 4 of 4 are built for the tree @@ -82,8 +82,8 @@ The shards SHALL partition the test modules of `tests/`: each module SHALL be in - **THEN** the two lists are equal #### Scenario: The split has no stored input -- **WHEN** the modules of a tree are dealt to two shards -- **THEN** the lists come from the line counts of the files alone, the heaviest file going first to the shard with the fewest lines so far +- **WHEN** the modules of a tree without `tests/module_durations.json` are dealt to two shards +- **THEN** the lists come from the line counts of the files, the heaviest file going first to the shard with the fewest lines so far ### Requirement: A shard reports the time of each test and the reason of each skip The command of a shard SHALL hold `-rfEs` and `--junitxml=.data/junit.xml`, so that its log gives the reason of each skip and still names the failed and error tests, and the report holds each test of the shard with its time. The job `test-shard` of `ci.yml` SHALL upload the report in the artifact that holds `.data/.coverage`. @@ -95,3 +95,36 @@ The command of a shard SHALL hold `-rfEs` and `--junitxml=.data/junit.xml`, so t #### Scenario: The upload step is read - **WHEN** the upload step of the job `test-shard` of `ci.yml` is read - **THEN** its paths are the `data_file` of `[tool.coverage.run]` in `pyproject.toml` and the report path of the shard command + +### Requirement: The shards balance the recorded seconds +The split SHALL weigh each test module by its seconds in `tests/module_durations.json`. A module that the record does not hold SHALL weigh its lines times the recorded seconds per line of the recorded modules of the tree. A recorded module that the tree does not hold SHALL be in no shard and SHALL NOT count in that rate. The modules SHALL go, heaviest first and then by path, to the shard with the least weight so far, and a tie SHALL go to the lower shard. + +#### Scenario: A short module with a long recorded time +- **WHEN** a module of 10 lines has a record of 300 seconds and three modules of 500 lines each have 10 seconds, and the modules are dealt to two shards +- **THEN** the short module is alone in its shard and the three other modules share the other shard + +#### Scenario: A module without a record +- **WHEN** two recorded modules of 100 lines each have 100 and 10 seconds, a third module of 100 lines has no record, and the modules are dealt to two shards +- **THEN** the third module weighs 55 seconds and shares a shard with the module of 10 seconds + +#### Scenario: A deleted module in the record +- **WHEN** the record holds a module that the tree does not hold +- **THEN** no shard holds it, and its seconds do not change the weight of a module without a record + +### Requirement: The record is written from the shard reports of CI +`devops ci durations` SHALL read the last 20 push runs of `ci.yml` on `main` where `Tests & Coverage` ran to an end. It SHALL download their `coverage-shard-*` artifacts with `gh run download` and read the time of each test from the JUnit XML reports. It SHALL write the mean seconds of each module of the tree over the runs that ran it to `tests/module_durations.json`, in tenths of a second. + +#### Scenario: Two runs with reports and one without +- **WHEN** run 2 holds two shard reports, run 1 one report, and run 3 only an expired shard artifact, and the user runs `devops ci durations --runs 3` +- **THEN** gh downloads the artifacts of runs 2 and 1 only, and the record holds the mean of each module over the runs that ran it + +### Requirement: No record without a report +When no run read holds a shard artifact that GitHub still keeps, `devops ci durations` SHALL exit 1 and write no record. A dry run SHALL list its requests and the download, and make none. + +#### Scenario: No run holds a report +- **WHEN** the shard artifacts of every run read are expired +- **THEN** the command exits 1, writes no record and downloads nothing + +#### Scenario: Dry run +- **WHEN** the user runs `devops ci durations --dry-run` +- **THEN** the plan names the listing of runs, the jobs and artifacts of each run and the download, and no request is made diff --git a/pyproject.toml b/pyproject.toml index be0071e358..a59c346b92 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -109,7 +109,6 @@ dev = [ "pytest-cov==7.1.0", "diff-cover==11.0.1", "pytest-xdist==3.8.0", - "pytest-split==0.11.0", "pytest-randomly==5.1.0", "pytest-timeout==2.4.0", "bandit==1.9.4", diff --git a/src/devops_cli/ai/knowledge_base/devops_cli/tasks/ci_quality_gate.md b/src/devops_cli/ai/knowledge_base/devops_cli/tasks/ci_quality_gate.md index d05b1b450a..c9d247888e 100644 --- a/src/devops_cli/ai/knowledge_base/devops_cli/tasks/ci_quality_gate.md +++ b/src/devops_cli/ai/knowledge_base/devops_cli/tasks/ci_quality_gate.md @@ -80,7 +80,7 @@ devops ci ## 6. General Standards & Reference Guidelines -- **Gate**: The fast static checks pass before a push, and the required checks of CI pass before a merge. A check that averages more than 5 minutes is a P0 bug. +- **Gate**: The fast static checks pass before a push, and the required checks of CI pass before a merge. A check that averages over the time limit of AGENTS.md rule 5 is a P0 bug ([docs/TESTING.md](../../../../../../docs/TESTING.md#run-time) gives the limit). - **Coverage Floor**: The line coverage of `src/devops_cli/` must stay at or above `fail_under` in `pyproject.toml`. A pull request must also cover most of its changed lines (the `Changed-Line Coverage` step of CI). --- diff --git a/src/devops_cli/ci/durations.py b/src/devops_cli/ci/durations.py new file mode 100644 index 0000000000..7ee25c9216 --- /dev/null +++ b/src/devops_cli/ci/durations.py @@ -0,0 +1,151 @@ +"""The recorded seconds of each test module, which balance the test shards of CI (#5247). + +The split of the test shards by lines of test code put a short module with slow tests in a shard +that then took longest, and each change of the tree moved modules between shards (#4250). Each +shard of `ci.yml` uploads a JUnit XML report with the time of each of its tests, in the artifact +`coverage-shard-` (#4673). `record_durations` reads these reports of the last runs of the test +check on a branch, adds the seconds of the tests of each module, and takes the mean of each module +over the runs that ran it. `write_durations` writes the means to `CONST_CI_TEST_DURATIONS_PATH`, +which `core.test_selection.shard_test_files` reads. gh downloads and unpacks the artifacts. +""" + +from __future__ import annotations + +import json +import math +import tempfile +from collections.abc import Collection, Iterable, Mapping, Sequence +from dataclasses import dataclass +from pathlib import Path, PurePosixPath +from typing import TYPE_CHECKING, Final + +from devops_cli.ci.fail_to_pass import parse_junit_xml +from devops_cli.config.constants import ( + CONST_CI_SHARD_JUNIT_PATH, + CONST_CI_TEST_DURATIONS_PATH, + CONST_PYTHON_FILE_SUFFIX, +) +from devops_cli.github.rate_limiter import run_gh + +if TYPE_CHECKING: + from devops_cli.ci.fail_to_pass import TestCaseOutcome + from devops_cli.github.client import GitHubClient + +# The artifact of each test shard of `ci.yml` is `coverage-shard-`: it holds the coverage data +# and the JUnit XML report of the shard. +SHARD_ARTIFACT_PREFIX: Final[str] = "coverage-shard-" +_REPORT_NAME: Final[str] = PurePosixPath(CONST_CI_SHARD_JUNIT_PATH).name +# The artifacts of one run hold about 15 MB. +_DOWNLOAD_TIMEOUT_SECONDS: Final[float] = 300.0 +# The record keeps tenths of a second: a finer value only changes more lines at each refresh. +_DECIMALS: Final[int] = 1 + + +@dataclass(frozen=True) +class DurationsRecord: + """The runs whose shard reports were read, and the mean seconds of each test module.""" + + runs: tuple[int, ...] + durations: dict[str, float] + + +def module_of(classname: str, modules: Collection[str]) -> str | None: + """The test module of the JUnit `classname` of a test, as a path of `modules`; None when no + module of `modules` holds it. Pytest writes the path of the module with dots for slashes and + no suffix, then the class of the test when it has one (`tests.a.test_x.TestCase`).""" + parts = classname.split(".") + for end in range(len(parts), 0, -1): + path = "/".join(parts[:end]) + CONST_PYTHON_FILE_SUFFIX + if path in modules: + return path + return None + + +def module_seconds( + outcomes: Iterable[TestCaseOutcome], modules: Collection[str] +) -> dict[str, float]: + """The sum of the seconds of the tests of each module of `modules` in `outcomes`. A test of a + module that `modules` does not hold counts nowhere.""" + found: dict[str, list[float]] = {} + for outcome in outcomes: + module = module_of(outcome.classname, modules) + if module is not None: + found.setdefault(module, []).append(outcome.seconds) + return {module: math.fsum(seconds) for module, seconds in found.items()} + + +def mean_durations(runs: Sequence[Mapping[str, float]]) -> dict[str, float]: + """The mean seconds of each module over the runs that ran it, in tenths of a second and in + the order of the paths.""" + found: dict[str, list[float]] = {} + for run in runs: + for module, seconds in run.items(): + found.setdefault(module, []).append(seconds) + return { + module: round(math.fsum(seconds) / len(seconds), _DECIMALS) + for module, seconds in sorted(found.items()) + } + + +def write_durations(root: Path, durations: Mapping[str, float]) -> Path: + """Write `durations` to `CONST_CI_TEST_DURATIONS_PATH` under `root`, one module a line in the + order of the paths, and return the path.""" + path = root / CONST_CI_TEST_DURATIONS_PATH + text = json.dumps(dict(sorted(durations.items())), indent=2) + path.write_text(f"{text}\n", encoding="utf-8") + return path + + +def download_shard_reports(repo: str, run_id: int, directory: Path) -> list[Path]: + """Download the shard artifacts of the run `run_id` of `repo` into `directory` with + `gh run download`, which unpacks each one into a folder of its name; return the paths of the + JUnit XML reports that they hold, in order. A failed download raises.""" + run_gh( + [ + "run", + "download", + str(run_id), + "--repo", + repo, + "--dir", + str(directory), + "--pattern", + f"{SHARD_ARTIFACT_PREFIX}*", + ], + check=True, + timeout=_DOWNLOAD_TIMEOUT_SECONDS, + ) + return sorted(directory.glob(f"{SHARD_ARTIFACT_PREFIX}*/{_REPORT_NAME}")) + + +def record_durations( + client: GitHubClient, + repo: str, + *, + workflow: str, + branch: str, + job: str, + runs: int, + modules: Collection[str], +) -> DurationsRecord: + """The mean seconds of each module of `modules` in the shard reports of the last `runs` push + runs of `workflow` on `branch` where the check `job` ran to an end. A run whose artifacts + GitHub no longer holds gives no report and is left out.""" + per_run: list[dict[str, float]] = [] + read: list[int] = [] + for run in client.get_job_run_times( + repo, workflow=workflow, branch=branch, job=job, count=runs + ): + names = client.get_run_artifact_names(repo, run.run_id) + if not any(name.startswith(SHARD_ARTIFACT_PREFIX) for name in names): + continue + with tempfile.TemporaryDirectory(prefix="devops-durations-") as folder: + reports = download_shard_reports(repo, run.run_id, Path(folder)) + outcomes = [ + outcome + for report in reports + for outcome in parse_junit_xml(report.read_text(encoding="utf-8")) + ] + per_run.append(module_seconds(outcomes, modules)) + read.append(run.run_id) + return DurationsRecord(runs=tuple(read), durations=mean_durations(per_run)) diff --git a/src/devops_cli/ci/fail_to_pass.py b/src/devops_cli/ci/fail_to_pass.py index c516e10247..de09a90493 100644 --- a/src/devops_cli/ci/fail_to_pass.py +++ b/src/devops_cli/ci/fail_to_pass.py @@ -35,7 +35,7 @@ from html.parser import HTMLParser from pathlib import Path, PurePath, PurePosixPath -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field from devops_cli.ci.changed_tests import ParsedTests, is_test_changed, parse_tests from devops_cli.config.constants import ( @@ -85,6 +85,9 @@ class TestCaseOutcome(BaseModel): name: str status: str message: str = "" + # The `time` of the testcase: the seconds of its setup, call and teardown, which only + # `devops ci durations` reads, so the report of a replay leaves it out (#5247). + seconds: float = Field(default=0.0, exclude=True) @property def test_id(self) -> str: @@ -244,6 +247,7 @@ def __init__(self) -> None: super().__init__() self.outcomes: list[TestCaseOutcome] = [] self._current_case: tuple[str, str] | None = None + self._current_seconds: str = "" self._current_status: str = "passed" self._current_message: str = "" self.root_closed = False @@ -252,6 +256,7 @@ def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]]) -> None attr_map = {key: (val or "") for key, val in attrs} if tag == "testcase" and self._current_case is None: self._current_case = (attr_map.get("classname", ""), attr_map.get("name", "")) + self._current_seconds = attr_map.get("time", "") self._current_status = "passed" self._current_message = "" elif self._current_case is not None and tag in CONST_FAIL_TO_PASS_JUNIT_TAG_STATUS: @@ -269,6 +274,7 @@ def handle_endtag(self, tag: str) -> None: name=name, status=self._current_status, message=self._current_message, + seconds=float(self._current_seconds or 0), ) ) self._current_case = None diff --git a/src/devops_cli/ci/job_time.py b/src/devops_cli/ci/job_time.py index 6356452973..10185b11b2 100644 --- a/src/devops_cli/ci/job_time.py +++ b/src/devops_cli/ci/job_time.py @@ -1,19 +1,35 @@ """Whether a CI job stays inside its time budget, read from its last runs on a branch (#2699). -AGENTS.md rule 5 makes a check that averages more than 5 minutes a P0 bug. A pull request cannot -show that: its own run is one sample. The check reads the last runs of the job on the branch from -GitHub's Actions API instead, and passes only when it read all that it asked for and their mean is -inside the limit. The time in the queue is reported, but the limit does not apply to it (#4634). +AGENTS.md rule 5 makes a check that averages more than 5 minutes a P0 bug, and the owner allows +1 minute more for the variation of the runners (2026-10-23). A pull request cannot show the mean: +its own run is one sample. The check reads the last runs of the job on the branch from GitHub's +Actions API instead, and passes only when it read all that it asked for and their mean is inside +the limit. The time in the queue is reported, but the limit does not apply to it (#4634). When the +mean is over the limit, `raise_alarm` comments on the open alarm issue of the check, or files one +with the priority P0, so one breach has one issue (#5247). """ from __future__ import annotations from dataclasses import dataclass -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Final if TYPE_CHECKING: from devops_cli.github.client import GitHubClient, JobRunTime +# The labels of the alarm issue: a mean over the limit is a P0 bug of CI (owner, 2026-10-23). +# The issue holds a Priority, so intake does not place it. It gets the Status New that intake +# gives each new item, because refine reads only the items with the Status New or Ready. +_ALARM_LABELS: Final[tuple[str, ...]] = ( + "type/bug", + "scope/ci", + "status/new", + "priority/p0-critical", +) +# The word that the issue search finds in the body of an alarm issue, inside `alarm_marker`. +ALARM_MARKER: Final[str] = "devops-ci-job-time" +_ALARM_TITLE: Final[str] = "fix(ci): {job} averages {mean:.0f} s, over the {limit:.0f} s limit" + @dataclass(frozen=True) class JobTimeReport: @@ -60,3 +76,67 @@ def check_job_time( `repo` where it ran to an end.""" runs = client.get_job_run_times(repo, workflow=workflow, branch=branch, job=job, count=wanted) return JobTimeReport(job=job, wanted=wanted, limit_seconds=limit_seconds, runs=tuple(runs)) + + +@dataclass(frozen=True) +class Alarm: + """The alarm issue of a check: its number, and whether this run filed it or commented on it.""" + + number: int + filed: bool + + +def alarm_marker(job: str, *, workflow: str, branch: str) -> str: + """The line in the body of the alarm issue of `job` of `workflow` on `branch`, which no + reader sees and which tells the issue of one check from the issue of another.""" + return f"" + + +def alarm_text(report: JobTimeReport, repo: str, *, workflow: str, branch: str) -> str: + """The text of the alarm issue or of its comment: the mean, the limit and each run read.""" + rows = "".join( + f"| [{run.run_id}](https://github.com/{repo}/actions/runs/{run.run_id}) " + f"| {run.seconds:.0f} | {run.queue_seconds:.0f} |\n" + for run in report.runs + ) + return ( + f"`devops ci job-time` found that the last {report.wanted} runs of `{report.job}` of " + f"`{workflow}` on `{branch}` took {report.mean_seconds:.0f} s on average. The limit is " + f"{report.limit_seconds:.0f} 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).\n\n" + f"The jobs also waited {report.mean_queue_seconds:.0f} s on average for a runner. The " + "limit does not count this time.\n\n" + "| Run | Seconds | Queue seconds |\n| ---: | ---: | ---: |\n" + f"{rows}" + ) + + +def raise_alarm( + client: GitHubClient, repo: str, report: JobTimeReport, *, workflow: str, branch: str +) -> Alarm: + """Comment on the open alarm issue of the check of `report`, the lowest number when more than + one is open, or file one with the priority P0 when none is open (#5247). + + The issue search finds the issues whose body holds `ALARM_MARKER`, and only an open issue + whose body holds the `alarm_marker` of the check counts. So a run while the mean stays over + the limit comments, and files no second issue, also after a person changed the title or the + labels. After the issue is closed, the next breach files a new issue. + """ + marker = alarm_marker(report.job, workflow=workflow, branch=branch) + text = alarm_text(report, repo, workflow=workflow, branch=branch) + held = sorted( + hit.number + for hit in client.search_issue_bodies(repo, ALARM_MARKER) + if hit.state == "open" and marker in (hit.body or "") + ) + if held: + client.create_issue_comment(repo, held[0], text) + return Alarm(number=held[0], filed=False) + title = _ALARM_TITLE.format( + job=report.job, mean=report.mean_seconds, limit=report.limit_seconds + ) + number = client.create_issue( + repo, title=title, body=f"{text}\n{marker}\n", labels=_ALARM_LABELS + ) + return Alarm(number=number, filed=True) diff --git a/src/devops_cli/commands/ci.py b/src/devops_cli/commands/ci.py index 7431086e19..26319bc688 100644 --- a/src/devops_cli/commands/ci.py +++ b/src/devops_cli/commands/ci.py @@ -25,12 +25,14 @@ from devops_cli.config.constants import ( CONST_AST_GREP_SCAN_ARGS, CONST_BANDIT_INI_NAME, + CONST_CI_JOB_TIME_LIMIT_SECONDS, CONST_CI_RUN_STOP_SIGNAL_NAMES, CONST_CI_SHARD_JUNIT_PATH, CONST_CI_SHARD_SUMMARY_CHARS, CONST_CI_SLOWEST_TESTS_SHOWN, CONST_CI_SUBCOMMAND_SHOWS_HELP_META_KEY, CONST_CI_TEST_BUDGET_SECONDS, + CONST_CI_TEST_DURATIONS_PATH, CONST_CI_TEST_JOB_NAME, CONST_CI_WORKFLOW_FILE, CONST_EXIT_CANCELLED, @@ -76,7 +78,7 @@ from devops_cli.telemetry.instruments import CI_CHECKS_TOTAL, CI_GATE_SLOT_WAIT, emit if TYPE_CHECKING: - from devops_cli.ci.job_time import JobTimeReport + from devops_cli.ci.job_time import Alarm, JobTimeReport from devops_cli.ci.mutate import MutationTarget from devops_cli.core.test_selection import SuiteImports @@ -2558,10 +2560,14 @@ def job_time( ] = DEFAULT_CI_JOB_TIME_RUNS, limit: Annotated[ float, typer.Option("--limit", min=1, help=HELP.ci.job_time_limit) - ] = CONST_CI_TEST_BUDGET_SECONDS, + ] = CONST_CI_JOB_TIME_LIMIT_SECONDS, + file_issue: Annotated[ + bool, typer.Option("--file-issue", help=HELP.ci.job_time_file_issue) + ] = False, dry_run: Annotated[bool, typer.Option("--dry-run", help=HELP.options.dry_run)] = False, ) -> None: - """Fail when the last runs of a CI job averaged more than the limit (#2699).""" + """Fail when the last runs of a CI job averaged more than the limit (#2699), and with + `--file-issue` comment on or file its P0 issue (#5247).""" from devops_cli.core.repo import find_repo_root, get_repo_origin_name target = repo or get_repo_origin_name(find_repo_root(Path.cwd())) @@ -2569,13 +2575,16 @@ def job_time( print_error(MESSAGES.ci.job_time_no_repo) raise typer.Exit(1) if dry_run or is_dry_run(): - _render_job_time_plan(target, workflow=workflow, branch=branch, job=job, runs=runs) + _render_job_time_plan( + target, workflow=workflow, branch=branch, job=job, runs=runs, file_issue=file_issue + ) return - from devops_cli.ci.job_time import check_job_time + from devops_cli.ci.job_time import check_job_time, raise_alarm from devops_cli.github.session import get_github_session + client = get_github_session().client report = check_job_time( - get_github_session().client, + client, target, workflow=workflow, branch=branch, @@ -2584,21 +2593,142 @@ def job_time( limit_seconds=limit, ) _print_job_time_report(report, workflow=workflow, branch=branch) + if file_issue and report.complete and not report.passes: + alarm = raise_alarm(client, target, report, workflow=workflow, branch=branch) + _print_alarm(alarm, repo=target) if not report.passes: raise typer.Exit(1) -def _render_job_time_plan(repo: str, *, workflow: str, branch: str, job: str, runs: int) -> None: +def _print_alarm(alarm: Alarm, *, repo: str) -> None: + """Say which issue now holds the breach, and whether this run filed it.""" + said = MESSAGES.ci.job_time_issue_filed if alarm.filed else MESSAGES.ci.job_time_issue_commented + print_info(said.format(repo=repo, number=alarm.number), safe=True) + + +def _render_job_time_plan( + repo: str, *, workflow: str, branch: str, job: str, runs: int, file_issue: bool +) -> None: """List the requests of `job-time` without making them (#412).""" base = f"/repos/{repo}/actions" + planned = [ + PlannedRequest(method="GET", target=f"{base}/workflows/{workflow}/runs"), + PlannedRequest( + method="GET", + target=f"{base}/runs//jobs", + repeat=f"for each run, until {runs} runs hold an ended {job}", + ), + ] + if file_issue: + from devops_cli.ci.job_time import ALARM_MARKER + + over = "the mean is over the limit" + planned += [ + PlannedRequest( + method="GET", + target=f'/search/issues?q="{ALARM_MARKER}" in:body is:issue repo:{repo}', + condition=over, + ), + PlannedRequest( + method="POST", + target=f"/repos/{repo}/issues//comments", + condition=f"{over} and an open issue holds the alarm of {job}", + ), + PlannedRequest( + method="POST", + target=f"/repos/{repo}/issues", + condition=f"{over} and no open issue holds the alarm of {job}", + ), + ] render_request_plan( MESSAGES.ci.job_time_dry_run_heading.format(job=job, workflow=workflow, branch=branch), + planned, + ) + + +@app.command(name="durations", help=HELP.ci.durations) +@dry_run_class("request-plan") +def durations( + repo: Annotated[str | None, typer.Option("--repo", "-R", help=HELP.ci.job_time_repo)] = None, + workflow: Annotated[ + str, typer.Option("--workflow", help=HELP.ci.job_time_workflow) + ] = CONST_CI_WORKFLOW_FILE, + branch: Annotated[ + str, typer.Option("--branch", "-b", help=HELP.ci.job_time_branch) + ] = CONST_GIT_MAIN_BRANCH, + runs: Annotated[ + int, typer.Option("--runs", min=1, help=HELP.ci.durations_runs) + ] = DEFAULT_CI_JOB_TIME_RUNS, + dry_run: Annotated[bool, typer.Option("--dry-run", help=HELP.options.dry_run)] = False, +) -> None: + """Write the recorded seconds of each test module from the shard reports of CI (#5247).""" + from devops_cli.core.repo import find_repo_root, get_repo_origin_name + + root = _get_project_root() + target = repo or get_repo_origin_name(find_repo_root(Path.cwd())) + if target is None: + print_error(MESSAGES.ci.job_time_no_repo) + raise typer.Exit(1) + if dry_run or is_dry_run(): + _render_durations_plan(target, workflow=workflow, branch=branch, runs=runs) + return + from devops_cli.ci.durations import record_durations, write_durations + from devops_cli.core.test_selection import directory_modules + from devops_cli.github.session import get_github_session + + record = record_durations( + get_github_session().client, + target, + workflow=workflow, + branch=branch, + job=CONST_CI_TEST_JOB_NAME, + runs=runs, + modules=frozenset(directory_modules(CONST_TESTS_ROOT_DIR, root)), + ) + if not record.runs: + print_error(MESSAGES.ci.durations_none.format(workflow=workflow, branch=branch)) + raise typer.Exit(1) + write_durations(root, record.durations) + print_success( + MESSAGES.ci.durations_written.format( + modules=len(record.durations), + runs=len(record.runs), + path=CONST_CI_TEST_DURATIONS_PATH, + ) + ) + + +def _render_durations_plan(repo: str, *, workflow: str, branch: str, runs: int) -> None: + """List the requests of `durations` without making them (#412).""" + from devops_cli.ci.durations import SHARD_ARTIFACT_PREFIX + + base = f"/repos/{repo}/actions" + each = f"for each of the last {runs} runs that hold an ended {CONST_CI_TEST_JOB_NAME}" + render_request_plan( + MESSAGES.ci.durations_dry_run_heading.format( + workflow=workflow, branch=branch, path=CONST_CI_TEST_DURATIONS_PATH + ), [ PlannedRequest(method="GET", target=f"{base}/workflows/{workflow}/runs"), + PlannedRequest(method="GET", target=f"{base}/runs//jobs", repeat=each), + PlannedRequest(method="GET", target=f"{base}/runs//artifacts", repeat=each), PlannedRequest( - method="GET", - target=f"{base}/runs//jobs", - repeat=f"for each run, until {runs} runs hold an ended {job}", + method="RUN", + target="gh run download", + argv=( + "gh", + "run", + "download", + "", + "--repo", + repo, + "--dir", + "", + "--pattern", + f"{SHARD_ARTIFACT_PREFIX}*", + ), + condition="the run still holds a shard artifact", + repeat=each, ), ], ) diff --git a/src/devops_cli/config/constants.py b/src/devops_cli/config/constants.py index 853b82518e..ce10d71982 100644 --- a/src/devops_cli/config/constants.py +++ b/src/devops_cli/config/constants.py @@ -724,10 +724,19 @@ # of this many entries. CONST_CI_TEST_BUDGET_SECONDS: Final[float] = 300.0 CONST_CI_SLOWEST_TESTS_SHOWN: Final[int] = 10 +# The owner allows 1 minute over the budget for the variation of the runners (2026-10-23), so the +# alarm of `devops ci job-time` fails, and files its P0 issue, only above the sum (#5247). +CONST_CI_TEST_BUDGET_TOLERANCE_SECONDS: Final[float] = 60.0 +CONST_CI_JOB_TIME_LIMIT_SECONDS: Final[float] = ( + CONST_CI_TEST_BUDGET_SECONDS + CONST_CI_TEST_BUDGET_TOLERANCE_SECONDS +) # A test shard of CI writes the time of each of its tests to this JUnit XML report, beside the # coverage data (`data_file` of pyproject.toml), and `ci.yml` uploads both as the artifact of the -# shard (#4673). The split by measured time reads it (#4250). The path is relative to the checkout. +# shard (#4673). `devops ci durations` reads it. The path is relative to the checkout. CONST_CI_SHARD_JUNIT_PATH: Final[str] = ".data/junit.xml" +# The recorded seconds of each test module, which `devops ci durations` writes from the reports +# above and the split of the test shards reads (#5247). The path is relative to the checkout. +CONST_CI_TEST_DURATIONS_PATH: Final[str] = "tests/module_durations.json" # The `-r` summary of a test shard: the reason of each skip (s) in the log (#4673). `-r` replaces # the default `fE` of pytest, so the shard asks again for the failed (f) and error (E) tests. CONST_CI_SHARD_SUMMARY_CHARS: Final[str] = "fEs" diff --git a/src/devops_cli/core/test_selection.py b/src/devops_cli/core/test_selection.py index c20d71c72f..8c89a68f7c 100644 --- a/src/devops_cli/core/test_selection.py +++ b/src/devops_cli/core/test_selection.py @@ -10,6 +10,7 @@ from __future__ import annotations import ast +import math import os import re from collections.abc import Callable, Iterable, Mapping, Sequence @@ -17,7 +18,10 @@ from functools import cached_property, partial from pathlib import Path +from pydantic import NonNegativeFloat, TypeAdapter + from devops_cli.config.constants import ( + CONST_CI_TEST_DURATIONS_PATH, CONST_CONFTEST_FILENAME, CONST_FULL_RUN_TRIGGER_NAMES, CONST_PYTEST_FIXTURE_NAME, @@ -29,6 +33,9 @@ ) from devops_cli.core.import_graph import build_import_graph, module_name +# The record of `CONST_CI_TEST_DURATIONS_PATH`: the path of each test module and its seconds. +_DURATIONS: TypeAdapter[dict[str, float]] = TypeAdapter(dict[str, NonNegativeFloat]) + @dataclass class TestSelection: @@ -335,27 +342,48 @@ def directory_modules(directory: str, root: Path) -> list[str]: ) +def recorded_durations(root: Path) -> dict[str, float]: + """The recorded seconds of each test module, as paths from the repository root, from the file + `CONST_CI_TEST_DURATIONS_PATH` under `root` that `devops ci durations` writes (#5247); none + when the tree holds no such file. A file that is no map of paths to seconds raises + `pydantic.ValidationError`.""" + path = root / CONST_CI_TEST_DURATIONS_PATH + if not path.is_file(): + return {} + return _DURATIONS.validate_json(path.read_bytes()) + + def shard_test_files(shard: int, shards: int, root: Path) -> list[str]: """The sorted repo-relative paths of the test modules of shard `shard` of `shards` (#2371). - The modules go one by one, heaviest first (most lines, then path), to the shard with the fewest - lines so far, and a tie goes to the lower shard. The split reads only the tree, so every runner - computes the same lists and no stored data can go out of date. + A module weighs its recorded seconds (`recorded_durations`, #5247). A module that the record + does not hold weighs its lines at the seconds per line of the recorded modules, and with no + recorded module every module weighs its lines. The modules go one by one, heaviest first + (then by path), to the shard with the least weight so far, and a tie goes to the lower shard. + Every runner reads the same tree and the same record, so every runner computes the same lists. + A stale record only unbalances the shards: each module of the tree is in one shard, and a + recorded module that the tree no longer holds is in none. """ def line_count(module: str) -> int: with (root / module).open("rb") as handle: return sum(1 for _ in handle) + lines = {module: line_count(module) for module in directory_modules(CONST_TESTS_ROOT_DIR, root)} + recorded = { + module: seconds for module, seconds in recorded_durations(root).items() if module in lines + } + recorded_lines = sum(lines[module] for module in recorded) + rate = math.fsum(recorded.values()) / recorded_lines if recorded_lines else 1.0 weighted = sorted( - ((line_count(module), module) for module in directory_modules(CONST_TESTS_ROOT_DIR, root)), + ((recorded.get(module, count * rate), module) for module, count in lines.items()), key=lambda item: (-item[0], item[1]), ) - weights = [0] * shards + weights = [0.0] * shards parts: list[list[str]] = [[] for _ in range(shards)] - for lines, module in weighted: + for weight, module in weighted: lightest = weights.index(min(weights)) - weights[lightest] += lines + weights[lightest] += weight parts[lightest].append(module) return sorted(parts[shard - 1]) diff --git a/src/devops_cli/github/client.py b/src/devops_cli/github/client.py index 644c0bfd92..50de3ce915 100755 --- a/src/devops_cli/github/client.py +++ b/src/devops_cli/github/client.py @@ -5,7 +5,7 @@ import base64 import binascii import json -from collections.abc import Mapping +from collections.abc import Mapping, Sequence from datetime import datetime from http import HTTPStatus from typing import TYPE_CHECKING, Any, NamedTuple @@ -294,6 +294,20 @@ class _RunJobs(BaseModel): jobs: list[_JobTiming] +class _RunArtifact(BaseModel): + """One artifact of a run: its name, and whether GitHub deleted its files at the end of its + retention.""" + + name: str + expired: bool = False + + +class _CreatedIssue(BaseModel): + """What GitHub says of an issue that it made: its number.""" + + number: int + + class _FileContents(BaseModel): """What the contents endpoint says of a path that is not a directory: GitHub gives a file its content in base64, and one over 1 MB an empty content with the encoding `none`.""" @@ -624,6 +638,18 @@ def _job_run_time(self, repo: str, run_id: int, job: str) -> JobRunTime | None: span = (last.completed_at - first).total_seconds() return JobRunTime(run_id=run_id, seconds=seconds, queue_seconds=span - seconds) + def get_run_artifact_names(self, repo: str, run_id: int) -> list[str]: + """The names of the artifacts of the workflow run `run_id` that GitHub still holds: an + artifact past its retention is left out (#5247).""" + path = _repo_path( + repo, f"actions/runs/{run_id}/artifacts?per_page={DEFAULT_GH_REST_PER_PAGE}" + ) + artifacts = ( + _read_as(_RunArtifact, item, path=path) + for item in self._session.paginate(path, iterable_key="artifacts") + ) + return [artifact.name for artifact in artifacts if not artifact.expired] + # ── Issue reads of the stage planner (#3238) ────────────────────────────── def get_issue(self, repo: str, number: int) -> IssueView: @@ -669,6 +695,14 @@ def search_open_items(self, repo: str, terms: str, *, limit: int) -> list[OpenIt path = f"/search/issues?{urlencode({'q': query, 'per_page': limit})}" return _read_as(_OpenItemPage, self._session.rest("GET", path), path=path).items + def create_issue(self, repo: str, *, title: str, body: str, labels: Sequence[str]) -> int: + """File an issue with `title`, `body` and `labels` in `repo`; return its number.""" + path = _repo_path(repo, "issues") + payload = {"title": title, "body": body, "labels": list(labels)} + return _read_as( + _CreatedIssue, self._session.rest("POST", path, body=payload), path=path + ).number + def create_issue_comment(self, repo: str, number: int, body: str) -> None: """Post `body` as a comment on the issue or pull request `number`.""" path = _repo_path(repo, f"issues/{number}/comments") diff --git a/src/devops_cli/lang/en/help.py b/src/devops_cli/lang/en/help.py index 96fee17b60..02b2ef9764 100644 --- a/src/devops_cli/lang/en/help.py +++ b/src/devops_cli/lang/en/help.py @@ -984,7 +984,23 @@ class CICommandHelp: job_time_workflow: str = "Workflow file that holds the job." job_time_branch: str = "Branch whose push runs are read." job_time_runs: str = "How many of the last runs the mean covers." - job_time_limit: str = "Most seconds the mean of the runs may be." + job_time_limit: str = ( + "Most seconds the mean of the runs may be. Default: the 300 s of AGENTS.md rule 5 and " + "the 60 s of tolerance that the owner allows for the variation of the runners." + ) + job_time_file_issue: str = ( + "When the mean is over the limit, comment on the open issue of the check, or file one " + "with the priority P0 when none is open. The search for the open issue reads the line " + "that the command writes in the body of the issue, so a changed title or label files no " + "second issue." + ) + durations: str = ( + "Write the mean seconds of each test module to tests/module_durations.json, from the JUnit " + "reports of the test shards of the last push runs of a workflow on a branch. The split " + "of the test shards weighs each module by these seconds. gh downloads the artifacts of " + "each run. A run whose artifacts GitHub no longer holds is left out." + ) + durations_runs: str = "How many of the last runs with an ended Tests & Coverage check to read." @dataclass(frozen=True) diff --git a/src/devops_cli/lang/en/messages.py b/src/devops_cli/lang/en/messages.py index 6a8c8061ce..0d738b788c 100644 --- a/src/devops_cli/lang/en/messages.py +++ b/src/devops_cli/lang/en/messages.py @@ -2170,6 +2170,19 @@ class CIMessages: job_time_dry_run_heading: str = ( "Would read the time of {job} in the last runs of {workflow} on {branch}" ) + job_time_issue_filed: str = "Filed the P0 issue https://github.com/{repo}/issues/{number}." + job_time_issue_commented: str = ( + "Commented on the open P0 issue https://github.com/{repo}/issues/{number}." + ) + durations_written: str = ( + "Wrote the mean seconds of {modules} test modules from {runs} runs to {path}." + ) + durations_none: str = ( + "No run of {workflow} on {branch} holds a shard report, so no durations were written." + ) + durations_dry_run_heading: str = ( + "Would write {path} from the shard reports of the last runs of {workflow} on {branch}" + ) coverage_index_tree_changed: str = ( "Files changed during the run; index not saved:\n{files}\n" "Re-run `devops ci coverage --build-index` on a clean working tree." diff --git a/tests/ci/test_ci_durations.py b/tests/ci/test_ci_durations.py new file mode 100644 index 0000000000..127fafedbd --- /dev/null +++ b/tests/ci/test_ci_durations.py @@ -0,0 +1,240 @@ +"""Tests for `devops ci durations`: the recorded seconds of each test module, which balance the +test shards of CI (#5247). + +GitHub's API is the fake of the `github_api` fixture, and `gh run download` is the process fake, +which writes the JUnit reports that the test gives into the folder of the download. +""" + +from __future__ import annotations + +import json +from pathlib import Path +from typing import TYPE_CHECKING, Any + +import pytest + +from devops_cli.ci import fail_to_pass +from devops_cli.ci.durations import mean_durations, module_of, module_seconds, write_durations +from devops_cli.config.constants import CONST_CI_TEST_DURATIONS_PATH +from devops_cli.core.test_selection import recorded_durations +from tests.support.fakes.github import github_json +from tests.support.fakes.process import ProcessAnswer, ProcessCall, ProcessFake + +if TYPE_CHECKING: + from collections.abc import Callable + + from tests.support.fakes.github import GitHubApiFake + +_REPO = "octocat/Hello-World" +_RUNS = ( + f"/repos/{_REPO}/actions/workflows/ci.yml/runs" + "?branch=main&event=push&status=completed&per_page=100" +) +_JOB = "Tests & Coverage" +_MODULES = frozenset({"tests/a/test_x.py", "tests/test_y.py"}) + + +def _case(classname: str, seconds: float) -> fail_to_pass.TestCaseOutcome: + return fail_to_pass.TestCaseOutcome( + classname=classname, name="test_it", status="passed", seconds=seconds + ) + + +@pytest.mark.parametrize( + ("classname", "module"), + [ + pytest.param("tests.a.test_x", "tests/a/test_x.py", id="function"), + pytest.param("tests.a.test_x.TestCase", "tests/a/test_x.py", id="class"), + pytest.param("tests.a.test_x.TestCase.TestInner", "tests/a/test_x.py", id="nested-class"), + pytest.param("tests.test_gone", None, id="deleted-module"), + ], +) +def test_the_classname_of_a_test_names_its_module(classname: str, module: str | None) -> None: + """Pytest writes the module path with dots, then the class of the test when it has one.""" + assert module_of(classname, _MODULES) == module + + +def test_the_seconds_of_the_tests_of_a_module_add_up() -> None: + """Two tests of one module took 2.5 s and 1.5 s, so the module took 4 s. A test of a module + that the tree no longer holds counts nowhere.""" + outcomes = [ + _case("tests.a.test_x", 2.5), + _case("tests.a.test_x.TestCase", 1.5), + _case("tests.test_y", 0.25), + _case("tests.test_gone", 99.0), + ] + + assert module_seconds(outcomes, _MODULES) == {"tests/a/test_x.py": 4.0, "tests/test_y.py": 0.25} + + +def test_the_mean_of_a_module_covers_only_the_runs_that_ran_it() -> None: + """A module that one of two runs ran keeps the time of that run, and the means are in tenths + of a second, in the order of the paths.""" + runs = [{"tests/test_y.py": 10.04, "tests/a/test_x.py": 3.0}, {"tests/test_y.py": 20.0}] + + assert list(mean_durations(runs).items()) == [ + ("tests/a/test_x.py", 3.0), + ("tests/test_y.py", 15.0), + ] + + +def test_the_written_record_is_what_the_split_reads(tmp_path: Path) -> None: + """The record holds one module a line in the order of the paths, and the split reads the + same seconds back.""" + (tmp_path / "tests").mkdir() + durations = {"tests/test_y.py": 1.5, "tests/a/test_x.py": 20.0} + + path = write_durations(tmp_path, durations) + + assert ( + path.read_text(encoding="utf-8"), + recorded_durations(tmp_path), + ) == ( + '{\n "tests/a/test_x.py": 20.0,\n "tests/test_y.py": 1.5\n}\n', + durations, + ) + + +def _report(*cases: tuple[str, float]) -> str: + """A JUnit XML report as pytest writes it, with one test of each class name and time.""" + rows = "".join( + f'' + for n, (classname, seconds) in enumerate(cases) + ) + return ( + '' + f'{rows}' + ) + + +def _route_runs(api: GitHubApiFake, artifacts: dict[int, list[dict[str, Any]]]) -> None: + """One completed run for each entry of `artifacts`, newest first, whose check ran to an end, + with those artifacts.""" + runs = [{"id": run_id} for run_id in artifacts] + api.route("GET", _RUNS, github_json({"total_count": len(runs), "workflow_runs": runs})) + job = { + "name": _JOB, + "conclusion": "success", + "started_at": "2026-11-13T04:54:05Z", + "completed_at": "2026-11-13T04:59:35Z", + } + for run_id, listed in artifacts.items(): + api.route( + "GET", + f"/repos/{_REPO}/actions/runs/{run_id}/jobs?per_page=100", + github_json({"total_count": 1, "jobs": [job]}), + ) + api.route( + "GET", + f"/repos/{_REPO}/actions/runs/{run_id}/artifacts?per_page=100", + github_json({"total_count": len(listed), "artifacts": listed}), + ) + + +def _artifact(name: str, *, expired: bool = False) -> dict[str, Any]: + return {"name": name, "expired": expired} + + +def _serve_downloads(process_fake: ProcessFake, reports: dict[str, dict[str, str]]) -> None: + """Answer `gh run download ... --dir ` by writing the report of each artifact + of `reports[run_id]` into `//junit.xml`, as gh unpacks a pattern.""" + + def download(call: ProcessCall) -> ProcessAnswer: + argv = list(call.argv) + folder = Path(argv[argv.index("--dir") + 1]) + for artifact, text in reports[argv[3]].items(): + (folder / artifact).mkdir(parents=True) + (folder / artifact / "junit.xml").write_text(text, encoding="utf-8") + return ProcessAnswer() + + process_fake.answer(("gh", "run", "download"), download) + + +def _checkout(root: Path, monkeypatch: pytest.MonkeyPatch) -> None: + """A checkout at `root` with the modules of `_MODULES`, as the current directory.""" + (root / ".git").mkdir() + (root / "pyproject.toml").write_text("[project]\nname = 'sample'\n", encoding="utf-8") + for module in _MODULES: + (root / module).parent.mkdir(parents=True, exist_ok=True) + (root / module).write_text("def test_it() -> None:\n pass\n", encoding="utf-8") + monkeypatch.chdir(root) + + +def test_the_command_writes_the_mean_seconds_of_the_shard_reports_of_each_run( + github_api: GitHubApiFake, + process_fake: ProcessFake, + cli: Callable[..., Any], + tmp_path: Path, + monkeypatch: pytest.MonkeyPatch, +) -> None: + """Run 2 holds two shard reports and run 1 one: the record holds the mean of each module over + the runs that ran it. Run 3 holds no shard artifact that GitHub still keeps, so gh downloads + nothing of it.""" + _checkout(tmp_path, monkeypatch) + _route_runs( + github_api, + { + 3: [_artifact("coverage-shard-1", expired=True), _artifact("service-image")], + 2: [_artifact("coverage-shard-1"), _artifact("coverage-shard-2")], + 1: [_artifact("coverage-shard-1")], + }, + ) + _serve_downloads( + process_fake, + { + "2": { + "coverage-shard-1": _report(("tests.a.test_x", 3.0), ("tests.a.test_x", 1.0)), + "coverage-shard-2": _report(("tests.test_y", 10.0)), + }, + "1": {"coverage-shard-1": _report(("tests.test_y", 20.0), ("tests.test_gone", 5.0))}, + }, + ) + + result = cli("ci", "durations", "--repo", _REPO, "--runs", "3") + + downloads = [ + call.argv[3] for call in process_fake.calls if call.argv[1:3] == ("run", "download") + ] + assert ( + result.exit_code, + json.loads((tmp_path / CONST_CI_TEST_DURATIONS_PATH).read_text(encoding="utf-8")), + downloads, + "2 test modules from 2 runs" in " ".join(result.output.split()), + ) == (0, {"tests/a/test_x.py": 4.0, "tests/test_y.py": 15.0}, ["2", "1"], True) + + +def test_the_command_exits_1_and_writes_nothing_when_no_run_holds_a_report( + github_api: GitHubApiFake, + process_fake: ProcessFake, + cli: Callable[..., Any], + tmp_path: Path, + monkeypatch: pytest.MonkeyPatch, +) -> None: + """GitHub keeps the artifacts of a run for 7 days: with none left, no record is written.""" + _checkout(tmp_path, monkeypatch) + _route_runs(github_api, {1: [_artifact("coverage-shard-1", expired=True)]}) + + result = cli("ci", "durations", "--repo", _REPO, "--runs", "1") + + assert ( + result.exit_code, + (tmp_path / CONST_CI_TEST_DURATIONS_PATH).exists(), + process_fake.calls, + ) == (1, False, []) + + +def test_a_dry_run_lists_the_reads_and_the_download_and_makes_none( + github_api: GitHubApiFake, process_fake: ProcessFake, cli: Callable[..., Any] +) -> None: + """The plan names the listing of runs, the jobs and artifacts of each run, and the download.""" + result = cli("ci", "durations", "--repo", _REPO, "--dry-run") + + said = " ".join(result.output.split()) + assert ( + result.exit_code, + github_api.requested, + process_fake.calls, + "actions/workflows/ci.yml/runs" in said, + "/artifacts" in said, + "gh run download" in said, + ) == (0, [], [], True, True, True) diff --git a/tests/ci/test_fail_to_pass.py b/tests/ci/test_fail_to_pass.py index c76f2d4126..40b0bf2ec6 100644 --- a/tests/ci/test_fail_to_pass.py +++ b/tests/ci/test_fail_to_pass.py @@ -3,6 +3,7 @@ from __future__ import annotations import importlib +import os import shlex import shutil import subprocess @@ -1356,7 +1357,8 @@ def head_source_interpreter( of #5306 does, and changes a check module of the gate row `probe`. The gate row runs for real, with an interpreter that finds `devops_cli` in the `src/` of the head, as the editable install of the checkout does: PYTHONPATH holds that `src/`, after the folder that the row runs in and - before `site-packages`. Returns the checkout.""" + before `site-packages`. The PYTHONPATH of the test run follows it: in the Service image, its + `sitecustomize` gives the row pytest (`service-image-test.yml`). Returns the checkout.""" repo = tmp_path / "repo" (repo / ".git").mkdir(parents=True) runner_source = (REPO_ROOT / "tests" / "gate" / "runner.py").read_text(encoding="utf-8") @@ -1373,7 +1375,11 @@ def head_source_interpreter( replay_state.base_files = {"src/devops_cli/__init__.py": 'MANIFESTS = ("a.yaml",)\n'} replay_state.base_files["k8s/a.yaml"] = "" replay_state.changed_test_files = ("src/devops_cli/__init__.py", "k8s/b.yaml", ADDED_CHECK) - head_source = {"PYTHONPATH": str(repo / "src")} + head_source = { + "PYTHONPATH": os.pathsep.join( + filter(None, [str(repo / "src"), os.environ.get("PYTHONPATH")]) + ) + } def run_for_real(call: ProcessCall) -> subprocess.CompletedProcess[str]: env = build_subprocess_env( diff --git a/tests/commands/test_ci_shard.py b/tests/commands/test_ci_shard.py index f3bf5ca65d..5b0e2ff6e4 100644 --- a/tests/commands/test_ci_shard.py +++ b/tests/commands/test_ci_shard.py @@ -8,6 +8,7 @@ from __future__ import annotations +import json import re import tomllib from pathlib import Path @@ -19,7 +20,8 @@ from devops_cli.ci.cache import resolve_ci_cache_path from devops_cli.ci.fail_to_pass import parse_junit_xml from devops_cli.commands.ci import app, get_check_spec -from devops_cli.core.test_selection import directory_modules, shard_test_files +from devops_cli.config.constants import CONST_CI_TEST_DURATIONS_PATH +from devops_cli.core.test_selection import directory_modules, is_test_module, shard_test_files from devops_cli.dry_run import set_dry_run from tests.support.fakes.process import ProcessFake from tests.support.paths import REPO_ROOT @@ -179,9 +181,80 @@ def test_the_split_is_the_same_in_every_call_and_in_any_order_of_asking() -> Non assert first == [reversed_order[shard] for shard in (1, 2, 3, 4)] +def _tree(root: Path, lines: dict[str, int], durations: dict[str, float] | None = None) -> None: + """Write test modules of `lines` lines each under `root`, and the recorded seconds of + `durations` at the path that the split reads, when given.""" + for module, count in lines.items(): + path = root / module + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text("x = 1\n" * count) + if durations is not None: + (root / CONST_CI_TEST_DURATIONS_PATH).write_text(json.dumps(durations), encoding="utf-8") + + +def test_a_short_module_with_a_long_recorded_time_is_alone_in_its_shard(tmp_path: Path) -> None: + """A module of 10 lines that took 300 s weighs more than three modules of 500 lines that took + 10 s each, so it fills one shard and the three others share the second (#5247).""" + long_modules = {f"tests/test_{name}.py": 500 for name in "abc"} + _tree( + tmp_path, + {"tests/test_slow.py": 10, **long_modules}, + {"tests/test_slow.py": 300.0, **dict.fromkeys(long_modules, 10.0)}, + ) + + assert [shard_test_files(shard, 2, tmp_path) for shard in (1, 2)] == [ + ["tests/test_slow.py"], + ["tests/test_a.py", "tests/test_b.py", "tests/test_c.py"], + ] + + +def test_a_module_without_a_recorded_time_weighs_its_lines_at_the_recorded_rate( + tmp_path: Path, +) -> None: + """The recorded modules hold 200 lines for 110 s, so a new module of 100 lines weighs 55 s: + less than the module of 100 s and more than the module of 10 s, so it joins the light one.""" + _tree( + tmp_path, + {"tests/test_a.py": 100, "tests/test_b.py": 100, "tests/test_c.py": 100}, + {"tests/test_a.py": 100.0, "tests/test_b.py": 10.0}, + ) + + assert [shard_test_files(shard, 2, tmp_path) for shard in (1, 2)] == [ + ["tests/test_a.py"], + ["tests/test_b.py", "tests/test_c.py"], + ] + + +def test_a_recorded_module_that_the_tree_no_longer_holds_is_ignored(tmp_path: Path) -> None: + """The file still names a deleted module: the split gives it to no shard, and its seconds + do not change the rate of the lines of a new module.""" + _tree( + tmp_path, + {"tests/test_a.py": 10, "tests/test_b.py": 10, "tests/test_c.py": 10}, + {"tests/test_gone.py": 9000.0, "tests/test_a.py": 30.0, "tests/test_b.py": 20.0}, + ) + + assert [shard_test_files(shard, 2, tmp_path) for shard in (1, 2)] == [ + ["tests/test_a.py"], + ["tests/test_b.py", "tests/test_c.py"], + ] + + +def test_the_committed_durations_are_seconds_of_test_modules() -> None: + """The committed file maps the path of a test module to the seconds it took, so a typing + error fails here and not in the four shards of CI.""" + recorded = json.loads((REPO_ROOT / CONST_CI_TEST_DURATIONS_PATH).read_text(encoding="utf-8")) + + assert ( + bool(recorded), + [path for path in recorded if not is_test_module(path)], + [path for path, seconds in recorded.items() if not isinstance(seconds, (int, float))], + ) == (True, [], []) + + def test_the_split_deals_the_heaviest_file_to_the_lightest_shard(tmp_path: Path) -> None: - """Files go heaviest first to the shard with the fewest lines so far, and a tie goes to the - lower shard. Lines of the files stand for the cost, so no stored data can go out of date.""" + """With no recorded seconds, files go heaviest first to the shard with the fewest lines so + far, and a tie goes to the lower shard.""" tests = tmp_path / "tests" tests.mkdir() for name, lines in {"test_a.py": 5, "test_b.py": 4, "test_c.py": 3, "test_d.py": 3}.items(): diff --git a/tests/github/test_ci_job_time.py b/tests/github/test_ci_job_time.py index abe12e6213..dbee0eb5a3 100644 --- a/tests/github/test_ci_job_time.py +++ b/tests/github/test_ci_job_time.py @@ -9,15 +9,18 @@ from __future__ import annotations import json +import time from typing import TYPE_CHECKING, Any +from urllib.parse import urlencode import pytest import yaml from devops_cli.ci.job_time import JobTimeReport, check_job_time from devops_cli.github.client import JobRunTime +from devops_cli.github.rate_limiter import get_github_rate_limiter from devops_cli.github.session import get_github_session -from tests.support.fakes.github import github_json, next_page +from tests.support.fakes.github import github_json, next_page, quota_headers from tests.support.paths import FIXTURES, REPO_ROOT if TYPE_CHECKING: @@ -274,7 +277,7 @@ def test_the_check_reads_the_runs_through_the_client(github_api: GitHubApiFake) def test_the_command_exits_0_and_names_the_mean_when_the_job_is_inside_the_limit( github_api: GitHubApiFake, cli: Callable[..., Any] ) -> None: - """Twenty runs of 100 s average 100 s, well inside the default limit of 300 s.""" + """Twenty runs of 100 s average 100 s, well inside the default limit of 360 s.""" _route_runs(github_api, [100.0] * 20) result = cli("ci", "job-time", "--repo", _REPO) @@ -282,10 +285,30 @@ def test_the_command_exits_0_and_names_the_mean_when_the_job_is_inside_the_limit assert ( result.exit_code, "took 100 s on average" in _said(result), - "limit is 300 s" in _said(result), + "limit is 360 s" in _said(result), ) == (0, True, True) +@pytest.mark.parametrize( + ("seconds", "exit_code"), + [ + pytest.param(330.0, 0, id="over-the-target-inside-the-tolerance"), + pytest.param(360.0, 0, id="on-the-limit"), + pytest.param(361.0, 1, id="over-the-tolerance"), + ], +) +def test_the_default_limit_is_the_target_of_300_s_and_60_s_of_tolerance( + github_api: GitHubApiFake, cli: Callable[..., Any], seconds: float, exit_code: int +) -> None: + """The owner allows 1 minute over the 5 minutes of AGENTS.md rule 5 for the variation of the + runners (2026-10-23), so the alarm fails only above 360 s (#5247).""" + _route_runs(github_api, [seconds] * 20) + + result = cli("ci", "job-time", "--repo", _REPO) + + assert (result.exit_code, "limit is 360 s" in _said(result)) == (exit_code, True) + + def test_the_command_exits_1_and_names_the_mean_when_the_job_is_over_the_limit( github_api: GitHubApiFake, cli: Callable[..., Any] ) -> None: @@ -485,11 +508,144 @@ def test_a_dry_run_lists_the_requests_and_makes_none( ) +_ALARM_SEARCH = "/search/issues?" + urlencode( + {"q": f'"devops-ci-job-time" in:body is:issue repo:{_REPO}', "per_page": 100, "page": 1} +) +_ALARM_LINE = "" + + +def _route_alarm_search(api: GitHubApiFake, *issues: dict[str, Any]) -> None: + """Answer the issue search for the alarm marker with `issues`.""" + get_github_rate_limiter().update_quota( + "search", remaining=30, limit=30, reset_epoch=time.time() + 60.0 + ) + payload = {"total_count": len(issues), "incomplete_results": False, "items": list(issues)} + api.route( + "GET", + _ALARM_SEARCH, + github_json(payload, headers=quota_headers(29, resource="search", limit=30)), + ) + + +def _issue(number: int, state: str, body: str) -> dict[str, Any]: + return {"number": number, "state": state, "state_reason": None, "body": body} + + +def _posted(api: GitHubApiFake) -> list[tuple[str, dict[str, Any]]]: + """The path and the JSON body of each POST that the API received.""" + return [ + (request.url.path, json.loads(request.content)) + for request in api.sent + if request.method == "POST" + ] + + +def test_a_mean_over_the_limit_files_one_p0_issue_when_none_is_open( + github_api: GitHubApiFake, cli: Callable[..., Any] +) -> None: + """No open issue holds the alarm of the check, so the run files one with the priority P0 and + the Status New, which refine reads, as intake gives a new item. Its body names the mean, the + limit and each run, and ends with the line that finds it the next day (#5247).""" + _route_runs(github_api, [400.0] * 20) + _route_alarm_search(github_api, _issue(7, "closed", f"Fixed.\n{_ALARM_LINE}")) + github_api.route("POST", f"/repos/{_REPO}/issues", github_json({"number": 42}, status=201)) + + result = cli("ci", "job-time", "--repo", _REPO, "--file-issue") + + [(path, issue)] = _posted(github_api) + assert ( + result.exit_code, + path, + issue["title"], + issue["labels"], + "took 400 s on average. The limit is 360 s." in issue["body"], + "actions/runs/100) | 400 | 0 |" in issue["body"], + issue["body"].endswith(f"{_ALARM_LINE}\n"), + f"https://github.com/{_REPO}/issues/42" in _said(result), + ) == ( + 1, + f"/repos/{_REPO}/issues", + "fix(ci): Tests & Coverage averages 400 s, over the 360 s limit", + ["type/bug", "scope/ci", "status/new", "priority/p0-critical"], + True, + True, + True, + True, + ) + + +def test_a_mean_over_the_limit_comments_on_the_open_issue_and_files_no_second_one( + github_api: GitHubApiFake, cli: Callable[..., Any] +) -> None: + """Issue 12 holds the alarm of the check and is open, so the run comments on it. Issue 9 + holds the alarm of another check, and issue 13 holds the word in other text: neither + counts.""" + _route_runs(github_api, [400.0] * 20) + other = "" + _route_alarm_search( + github_api, + _issue(9, "open", other), + _issue(13, "open", "The devops-ci-job-time alarm is noisy."), + _issue(12, "open", f"Renamed by a person.\n{_ALARM_LINE}"), + ) + github_api.route( + "POST", f"/repos/{_REPO}/issues/12/comments", github_json({"id": 1}, status=201) + ) + + result = cli("ci", "job-time", "--repo", _REPO, "--file-issue") + + [(path, comment)] = _posted(github_api) + assert ( + result.exit_code, + path, + "took 400 s on average" in comment["body"], + f"https://github.com/{_REPO}/issues/12" in _said(result), + ) == (1, f"/repos/{_REPO}/issues/12/comments", True, True) + + +@pytest.mark.parametrize( + "seconds", + [ + pytest.param([100.0] * 20, id="inside-the-limit"), + pytest.param([400.0] * 3, id="short-read"), + ], +) +def test_no_issue_is_searched_or_filed_without_a_full_read_over_the_limit( + github_api: GitHubApiFake, cli: Callable[..., Any], seconds: list[float] +) -> None: + """A mean inside the limit is no breach, and the mean of 3 of 20 runs says nothing yet, so + the run searches no issue and writes nothing.""" + _route_runs(github_api, seconds) + + cli("ci", "job-time", "--repo", _REPO, "--file-issue") + + assert ( + [line for line in github_api.requested if "search" in line], + _posted(github_api), + ) == ([], []) + + +def test_a_dry_run_with_the_issue_lists_the_search_and_both_writes_and_makes_none( + github_api: GitHubApiFake, cli: Callable[..., Any] +) -> None: + """The plan lists the issue search, the comment and the new issue, each with its condition.""" + result = cli("ci", "job-time", "--repo", _REPO, "--file-issue", "--dry-run") + + said = _said(result) + assert ( + result.exit_code, + github_api.requested, + "/search/issues" in said, + f"POST /repos/{_REPO}/issues//comments" in said, + f"POST /repos/{_REPO}/issues " in said, + ) == (0, [], True, True, True) + + def test_the_workflow_runs_the_check_on_the_schedule_and_by_hand_and_no_job_waits_for_it() -> None: """The job reads main's history, which no run of a push or a pull request changes. It runs on the daily schedule and on a manual run only, so no push run of main turns red for the mean of - other runs (#4634). It reads with a token that can read the Actions runs and nothing else, and - is the `needs` of no other job.""" + other runs (#4634). Its token can read the Actions runs and write issues, so it files or + comments on the P0 issue of a breach (#5247), and it is the `needs` of no other job.""" workflow = yaml.safe_load((REPO_ROOT / ".github" / "workflows" / "ci.yml").read_text("utf-8")) job = workflow["jobs"]["job-time"] waiting = [ @@ -503,8 +659,8 @@ def test_the_workflow_runs_the_check_on_the_schedule_and_by_hand_and_no_job_wait waiting, ) == ( "github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'", - {"contents": "read", "actions": "read"}, - ['uv run devops ci job-time --repo "$GITHUB_REPOSITORY"'], + {"contents": "read", "actions": "read", "issues": "write"}, + ['uv run devops ci job-time --repo "$GITHUB_REPOSITORY" --file-issue'], [], ) diff --git a/tests/module_durations.json b/tests/module_durations.json new file mode 100644 index 0000000000..bc00e6fd0c --- /dev/null +++ b/tests/module_durations.json @@ -0,0 +1,1196 @@ +{ + "tests/ai/agents/test_ai_agent_capabilities.py": 0.2, + "tests/ai/agents/test_embedding_config_retention.py": 0.2, + "tests/ai/agents/test_pydantic_ai_concurrency.py": 0.1, + "tests/ai/agents/test_pydantic_ai_exceptions.py": 0.1, + "tests/ai/agents/test_security_sandbox_and_protection.py": 0.5, + "tests/ai/analyze/test_ai_analyze_outlines.py": 0.1, + "tests/ai/analyze/test_ai_init.py": 0.0, + "tests/ai/analyze/test_review_path_classes.py": 0.1, + "tests/ai/ast/test_ai_ast_cli.py": 0.8, + "tests/ai/ast/test_ast_more_languages.py": 0.1, + "tests/ai/ast/test_treesitter_engine.py": 0.5, + "tests/ai/ast/test_treesitter_native_symbols.py": 0.1, + "tests/ai/benchmark/test_ai_benchmark.py": 4.8, + "tests/ai/benchmark/test_data_dir_configuration.py": 0.1, + "tests/ai/benchmark/test_embedding_benchmark.py": 10.2, + "tests/ai/benchmark/test_embedding_benchmark_failure.py": 0.5, + "tests/ai/benchmark/test_k8s_llm_gateway.py": 11.6, + "tests/ai/client/test_agent_factory.py": 0.7, + "tests/ai/client/test_ai_chat_reply_stream.py": 2.0, + "tests/ai/client/test_ai_client_credentials.py": 1.1, + "tests/ai/client/test_ai_client_error_reason.py": 2.0, + "tests/ai/client/test_ai_client_factory.py": 0.1, + "tests/ai/client/test_ai_client_finish_reasons.py": 1.7, + "tests/ai/client/test_ai_client_network.py": 0.8, + "tests/ai/client/test_ai_client_providers_and_embeddings.py": 3.4, + "tests/ai/client/test_ai_client_retries.py": 0.7, + "tests/ai/client/test_ai_client_security.py": 0.7, + "tests/ai/client/test_ai_client_structured.py": 1.7, + "tests/ai/client/test_ai_client_telemetry.py": 0.9, + "tests/ai/client/test_ai_gateway_base_url.py": 0.1, + "tests/ai/client/test_ai_request_priority.py": 0.1, + "tests/ai/client/test_ai_served_by.py": 1.4, + "tests/ai/client/test_ai_streaming.py": 0.8, + "tests/ai/client/test_ai_task_implement.py": 0.1, + "tests/ai/client/test_batch_2_review_defects.py": 0.2, + "tests/ai/client/test_claude_provider.py": 0.9, + "tests/ai/client/test_example_config_loopback_endpoints.py": 0.2, + "tests/ai/client/test_gateway_caller_headers.py": 0.4, + "tests/ai/client/test_model_contract.py": 0.4, + "tests/ai/client/test_ollama_dynamic_leasing.py": 0.2, + "tests/ai/client/test_per_call_sampling.py": 0.8, + "tests/ai/client/test_reply_server.py": 0.6, + "tests/ai/client/test_response_cache.py": 1.1, + "tests/ai/client/test_review_reply_caps.py": 0.1, + "tests/ai/client/test_roadmap_agent_run.py": 1.1, + "tests/ai/client/test_schema_reflection.py": 0.1, + "tests/ai/client/test_url_credential_masking.py": 2.1, + "tests/ai/controller/test_ai_controller.py": 3.1, + "tests/ai/diff/test_difftastic.py": 0.3, + "tests/ai/harness/test_harness_slots.py": 1.2, + "tests/ai/library/test_docs_ingest_local.py": 0.0, + "tests/ai/library/test_docs_ingest_remote.py": 0.1, + "tests/ai/library/test_drift_findings.py": 0.1, + "tests/ai/library/test_drift_report_saving.py": 0.0, + "tests/ai/library/test_library_contract_store.py": 0.0, + "tests/ai/library/test_package_introspection.py": 0.7, + "tests/ai/library/test_signature_extraction.py": 0.0, + "tests/ai/mcp/test_ai_ask_jev_tool.py": 0.3, + "tests/ai/mcp/test_ai_benchmark_mcp_tool.py": 2.9, + "tests/ai/mcp/test_ai_fetch_page_tool.py": 0.1, + "tests/ai/mcp/test_ai_gateway.py": 4.3, + "tests/ai/mcp/test_ai_prewarm.py": 6.1, + "tests/ai/mcp/test_ai_test_gen.py": 1.0, + "tests/ai/mcp/test_dispatcher_contract.py": 0.4, + "tests/ai/mcp/test_k8s_logql.py": 0.7, + "tests/ai/mcp/test_mcp_argument_refusal.py": 0.5, + "tests/ai/mcp/test_mcp_dispatch_logging.py": 0.1, + "tests/ai/mcp/test_mcp_dispatcher.py": 0.2, + "tests/ai/mcp/test_mcp_domain_hydration.py": 0.0, + "tests/ai/mcp/test_mcp_exposure_table.py": 14.2, + "tests/ai/mcp/test_mcp_http.py": 0.3, + "tests/ai/mcp/test_mcp_messages.py": 0.0, + "tests/ai/mcp/test_mcp_prompts_and_resources.py": 0.0, + "tests/ai/mcp/test_mcp_read_only_write_options.py": 0.2, + "tests/ai/mcp/test_mcp_roadmap_tools.py": 0.0, + "tests/ai/mcp/test_mcp_roles.py": 0.3, + "tests/ai/mcp/test_mcp_run_command.py": 0.0, + "tests/ai/mcp/test_mcp_scan_tools.py": 0.2, + "tests/ai/mcp/test_mcp_server_start.py": 0.1, + "tests/ai/mcp/test_mcp_telemetry_profile.py": 0.0, + "tests/ai/mcp/test_mcp_tool_argv.py": 0.1, + "tests/ai/mcp/test_mcp_tool_listing.py": 0.0, + "tests/ai/mcp/test_mcp_tool_registry.py": 0.8, + "tests/ai/mcp/test_mcp_tool_schemas.py": 0.2, + "tests/ai/mcp/test_mcp_tool_secrets.py": 0.2, + "tests/ai/mcp/test_path_confinement.py": 10.5, + "tests/ai/mcp/test_tf_cost_tools.py": 0.1, + "tests/ai/models/test_pydantic_ai_ollama.py": 0.1, + "tests/ai/personas/test_custom_personas.py": 0.0, + "tests/ai/personas/test_personas.py": 0.1, + "tests/ai/rag/test_chunker_properties.py": 3.8, + "tests/ai/rag/test_codebase_hygiene_and_shims.py": 0.4, + "tests/ai/rag/test_collection_search_concurrency.py": 0.2, + "tests/ai/rag/test_embedder_seam.py": 0.0, + "tests/ai/rag/test_embedding_batching.py": 1.3, + "tests/ai/rag/test_embedding_cache.py": 1.3, + "tests/ai/rag/test_embedding_dimension.py": 0.3, + "tests/ai/rag/test_embedding_disk_cache.py": 1.1, + "tests/ai/rag/test_embedding_model_compatibility.py": 0.1, + "tests/ai/rag/test_embedding_models.py": 0.5, + "tests/ai/rag/test_embedding_provider_failures.py": 0.4, + "tests/ai/rag/test_embedding_providers.py": 0.5, + "tests/ai/rag/test_embedding_spend_records.py": 0.8, + "tests/ai/rag/test_example_config_loopback_rag.py": 0.2, + "tests/ai/rag/test_hybrid_search.py": 0.1, + "tests/ai/rag/test_index_drift.py": 0.8, + "tests/ai/rag/test_index_purge_and_recovery.py": 0.3, + "tests/ai/rag/test_indexing_failure_and_resume.py": 0.4, + "tests/ai/rag/test_investigation_context.py": 0.2, + "tests/ai/rag/test_investigation_pause.py": 0.1, + "tests/ai/rag/test_investigation_stop.py": 0.1, + "tests/ai/rag/test_knowledge_base_sync.py": 2.2, + "tests/ai/rag/test_library_store_wiring.py": 0.1, + "tests/ai/rag/test_metadata_extraction.py": 0.0, + "tests/ai/rag/test_multi_project_indexing.py": 1.0, + "tests/ai/rag/test_persona_query_expansion.py": 0.1, + "tests/ai/rag/test_polyglot_chunking.py": 1.9, + "tests/ai/rag/test_qdrant_api_key_from_keyring.py": 0.2, + "tests/ai/rag/test_qdrant_cluster_addressing.py": 0.4, + "tests/ai/rag/test_qdrant_collection_setup.py": 0.2, + "tests/ai/rag/test_qdrant_request_telemetry.py": 0.4, + "tests/ai/rag/test_qdrant_server_label.py": 3.6, + "tests/ai/rag/test_qdrant_timeout_setting.py": 0.2, + "tests/ai/rag/test_query_stage_telemetry.py": 0.3, + "tests/ai/rag/test_rag_component_wiring.py": 0.1, + "tests/ai/rag/test_rag_ingest.py": 2.3, + "tests/ai/rag/test_rag_qdrant.py": 2.0, + "tests/ai/rag/test_retriever_filters.py": 0.1, + "tests/ai/rag/test_semantic_chunking.py": 0.2, + "tests/ai/rag/test_workspace_indexing.py": 1.0, + "tests/ai/research/test_ai_research_analogies.py": 1.4, + "tests/ai/research/test_ai_research_forage.py": 1.0, + "tests/ai/research/test_ai_research_marginalia.py": 0.7, + "tests/ai/research/test_ai_research_mental_model.py": 2.5, + "tests/ai/research/test_ai_research_socratic.py": 1.9, + "tests/ai/retries/test_pydantic_ai_retries.py": 0.0, + "tests/ai/review/test_ai_review_pool.py": 0.3, + "tests/ai/review/test_category_metrics.py": 0.3, + "tests/ai/review/test_cited_code.py": 0.2, + "tests/ai/review/test_contract_injection.py": 0.0, + "tests/ai/review/test_coverage_gaps.py": 1.8, + "tests/ai/review/test_docs_review_loop.py": 0.9, + "tests/ai/review/test_executable_criteria.py": 0.2, + "tests/ai/review/test_pipeline.py": 0.4, + "tests/ai/review/test_pre_analysis_scope.py": 0.4, + "tests/ai/review/test_review.py": 0.9, + "tests/ai/review/test_review_admission.py": 0.5, + "tests/ai/review/test_review_backend_activity.py": 0.2, + "tests/ai/review/test_review_benchmark.py": 0.8, + "tests/ai/review/test_review_console_report.py": 2.7, + "tests/ai/review/test_review_deduplication.py": 0.0, + "tests/ai/review/test_review_defects_comments.py": 0.1, + "tests/ai/review/test_review_defects_infra.py": 0.2, + "tests/ai/review/test_review_defects_languages.py": 0.2, + "tests/ai/review/test_review_defenses_and_verification.py": 0.1, + "tests/ai/review/test_review_exporter.py": 0.4, + "tests/ai/review/test_review_history.py": 0.3, + "tests/ai/review/test_review_path.py": 0.5, + "tests/ai/review/test_review_path_routing.py": 1.1, + "tests/ai/review/test_review_pipeline.py": 2.2, + "tests/ai/review/test_review_profile.py": 1.8, + "tests/ai/review/test_review_project_conventions.py": 0.1, + "tests/ai/review/test_review_regression_harness.py": 0.4, + "tests/ai/review/test_review_report_integrity.py": 0.2, + "tests/ai/review/test_review_report_summary.py": 0.4, + "tests/ai/review/test_review_repos.py": 0.1, + "tests/ai/review/test_review_runner.py": 0.4, + "tests/ai/review/test_review_sample_validation.py": 0.6, + "tests/ai/review/test_review_samples.py": 0.3, + "tests/ai/review/test_review_security_tools.py": 0.4, + "tests/ai/review/test_review_static_analyzers.py": 1.4, + "tests/ai/review/test_review_symbol_delta.py": 0.3, + "tests/ai/review/test_review_taxonomy_and_severity.py": 0.7, + "tests/ai/review/test_review_template_sweep.py": 1.1, + "tests/ai/review/test_review_tool_sandbox.py": 0.4, + "tests/ai/review/test_runner.py": 1.7, + "tests/ai/review/test_support_builders.py": 0.1, + "tests/ai/settings/test_pydantic_ai_settings.py": 0.0, + "tests/ai/spec/test_ai_spec.py": 3.7, + "tests/ai/spend/test_ai_spend_cli.py": 12.5, + "tests/ai/spend/test_ai_spend_dispatch.py": 1.4, + "tests/ai/spend/test_ai_spend_ledger.py": 2.4, + "tests/ai/spend/test_ai_spend_payoff.py": 0.0, + "tests/ai/spend/test_ai_spend_pricing.py": 1.6, + "tests/ai/spend/test_ai_spend_prometheus.py": 0.6, + "tests/ai/spend/test_hosted_group_prices.py": 0.2, + "tests/ai/spend/test_pricing_registry_overrides.py": 0.4, + "tests/ai/test_ai_capability.py": 0.0, + "tests/ai/test_ai_client_style_request.py": 0.8, + "tests/ai/test_ai_diagram.py": 0.4, + "tests/ai/test_ai_explain.py": 0.1, + "tests/ai/test_ai_fixer.py": 0.3, + "tests/ai/test_ai_gateway_portkey.py": 0.3, + "tests/ai/test_ai_gateway_probes.py": 0.3, + "tests/ai/test_ai_gateway_render.py": 0.3, + "tests/ai/test_ai_gateway_tune.py": 1.2, + "tests/ai/test_ai_inspection.py": 2.2, + "tests/ai/test_ai_model_sampling.py": 0.3, + "tests/ai/test_ai_prompt_eval.py": 0.3, + "tests/ai/test_ai_task_loader.py": 0.0, + "tests/ai/test_context_budget.py": 0.1, + "tests/ai/test_context_packer.py": 0.6, + "tests/ai/test_finding_repetition_compression.py": 0.1, + "tests/ai/test_jev.py": 0.4, + "tests/ai/test_jev_edge_fake.py": 0.0, + "tests/ai/test_jev_gateway_route.py": 0.1, + "tests/ai/test_jev_one_model_many_requests.py": 0.2, + "tests/ai/test_k8s_gpu_matrix.py": 0.5, + "tests/ai/test_kb.py": 1.1, + "tests/ai/test_lexical_ranking.py": 0.0, + "tests/ai/test_llm_pool_metrics.py": 1.3, + "tests/ai/test_model_bundle.py": 0.0, + "tests/ai/test_page_text.py": 1.7, + "tests/ai/test_prompt_programmatic_functions.py": 0.1, + "tests/ai/test_pydantic_ai_format_prompt.py": 0.0, + "tests/ai/test_pydantic_ai_function_signature.py": 0.1, + "tests/ai/test_pydantic_ai_profiles_and_providers.py": 1.2, + "tests/ai/test_pydantic_ai_workflows.py": 0.1, + "tests/ai/test_repomap.py": 0.9, + "tests/ai/test_review_advisory_backing.py": 0.0, + "tests/ai/test_review_defects.py": 1.0, + "tests/ai/test_review_finding_losses.py": 0.2, + "tests/ai/test_review_location_paths.py": 0.1, + "tests/ai/test_review_loop_hardening.py": 0.0, + "tests/ai/test_review_prompt_guardrails.py": 0.0, + "tests/ai/test_review_session_store.py": 0.2, + "tests/ai/test_review_state.py": 0.0, + "tests/ai/test_review_verification.py": 0.1, + "tests/ai/test_run_comparison.py": 4.8, + "tests/ai/test_run_store.py": 1.8, + "tests/ai/test_service_client_configured_urls.py": 0.8, + "tests/ai/test_structural_positional_oracles.py": 0.0, + "tests/ai/test_thinking.py": 0.1, + "tests/ai/test_thinking_providers.py": 1.4, + "tests/ai/test_tool_executor_contract.py": 1.0, + "tests/ai/test_verdict_writers.py": 0.1, + "tests/ai/test_web_search.py": 3.4, + "tests/ai/test_web_search_searxng.py": 1.7, + "tests/ai/tools/test_default_tools_follow_the_mcp_server.py": 0.2, + "tests/ai/tools/test_persona_tools.py": 0.0, + "tests/ai/tools/test_tool_definition.py": 0.0, + "tests/ai/toolsets/test_function_toolset.py": 0.0, + "tests/ai/toolsets/test_toolset_authoring.py": 0.0, + "tests/ai/toolsets/test_toolset_combinators.py": 0.0, + "tests/argo/test_argo_client.py": 0.1, + "tests/argo/test_argo_crd.py": 0.4, + "tests/argo/test_argo_credentials.py": 0.2, + "tests/argo/test_argo_fleet.py": 1.8, + "tests/argo/test_argo_gitops.py": 0.8, + "tests/argo/test_argo_helm_records.py": 0.4, + "tests/argo/test_gitops_fuzzing.py": 0.9, + "tests/argo/test_image_pins.py": 0.1, + "tests/argo/test_workflows.py": 0.1, + "tests/ci/test_cache_fuzzing.py": 0.5, + "tests/ci/test_changed_tests.py": 0.1, + "tests/ci/test_ci_cache.py": 0.5, + "tests/ci/test_ci_cache_fingerprint.py": 0.1, + "tests/ci/test_ci_diagnostics.py": 0.0, + "tests/ci/test_ci_gate_admission.py": 0.7, + "tests/ci/test_ci_gate_slots.py": 1.0, + "tests/ci/test_ci_mutate.py": 0.3, + "tests/ci/test_fail_to_pass.py": 5.5, + "tests/ci/test_release_download_retries.py": 0.3, + "tests/ci/test_typecheck.py": 0.0, + "tests/cloudflare/test_client.py": 0.2, + "tests/cloudflare/test_dns.py": 0.1, + "tests/commands/k8s/test_k8s.py": 4.9, + "tests/commands/k8s/test_k8s_agents_manifests.py": 0.7, + "tests/commands/k8s/test_k8s_bootstrap.py": 0.5, + "tests/commands/k8s/test_k8s_context.py": 0.8, + "tests/commands/k8s/test_k8s_crawl4ai_check.py": 2.0, + "tests/commands/k8s/test_k8s_deploy_stack_urls.py": 0.3, + "tests/commands/k8s/test_k8s_devops_stack.py": 0.3, + "tests/commands/k8s/test_k8s_gitea.py": 0.1, + "tests/commands/k8s/test_k8s_gpu_placement.py": 2.3, + "tests/commands/k8s/test_k8s_logging_stack.py": 1.0, + "tests/commands/k8s/test_k8s_logs_loki_url.py": 0.4, + "tests/commands/k8s/test_k8s_mattermost.py": 0.1, + "tests/commands/k8s/test_k8s_monitoring_integration.py": 0.8, + "tests/commands/k8s/test_k8s_network_policies.py": 2.4, + "tests/commands/k8s/test_k8s_networking.py": 1.5, + "tests/commands/k8s/test_k8s_ollama_prune.py": 0.6, + "tests/commands/k8s/test_k8s_proxy_addressing.py": 0.3, + "tests/commands/k8s/test_k8s_qdrant_security.py": 0.4, + "tests/commands/k8s/test_k8s_rag_ingest_manifests.py": 0.2, + "tests/commands/k8s/test_k8s_rbac_audit.py": 0.2, + "tests/commands/k8s/test_k8s_run_job.py": 0.5, + "tests/commands/k8s/test_k8s_runtime_cmd.py": 0.1, + "tests/commands/k8s/test_k8s_searxng_check.py": 3.3, + "tests/commands/k8s/test_k8s_tempo.py": 0.3, + "tests/commands/k8s/test_k8s_tls.py": 0.4, + "tests/commands/k8s/test_k8s_volume_reclaim.py": 1.1, + "tests/commands/k8s/test_stack_dashboards.py": 0.8, + "tests/commands/k8s/test_subsystem_containment_and_redaction.py": 0.1, + "tests/commands/test_ai_ask_jev.py": 4.5, + "tests/commands/test_ai_audit_library_usage.py": 1.0, + "tests/commands/test_ai_cmd.py": 7.7, + "tests/commands/test_ai_fetch_page.py": 2.4, + "tests/commands/test_ai_ingest_docs.py": 1.2, + "tests/commands/test_ai_ingest_library.py": 4.0, + "tests/commands/test_ai_local_dry_run.py": 18.0, + "tests/commands/test_ai_model_gateway_dry_run.py": 6.5, + "tests/commands/test_ai_rag_commands.py": 11.0, + "tests/commands/test_ai_rag_ingest_analyze_dry_run.py": 8.4, + "tests/commands/test_ai_retrieve_rag_context.py": 1.0, + "tests/commands/test_ai_runs_cost_cache_dry_run.py": 11.9, + "tests/commands/test_all_commands_help_dryrun.py": 4.1, + "tests/commands/test_analyze.py": 2.6, + "tests/commands/test_argo.py": 1.6, + "tests/commands/test_argo_apps_status.py": 0.6, + "tests/commands/test_argo_dry_run.py": 2.5, + "tests/commands/test_branches.py": 0.4, + "tests/commands/test_ci.py": 16.6, + "tests/commands/test_ci_build_index.py": 0.3, + "tests/commands/test_ci_bwrap_row.py": 0.3, + "tests/commands/test_ci_domain_row.py": 0.1, + "tests/commands/test_ci_dry_run.py": 0.3, + "tests/commands/test_ci_gate_rows.py": 0.1, + "tests/commands/test_ci_maintain.py": 0.2, + "tests/commands/test_ci_repeat.py": 0.6, + "tests/commands/test_ci_shard.py": 4.9, + "tests/commands/test_cli_format_adoption.py": 1.1, + "tests/commands/test_cli_startup_imports.py": 0.1, + "tests/commands/test_cloudflare_commands.py": 1.4, + "tests/commands/test_cloudflare_dry_run.py": 0.6, + "tests/commands/test_command_error_exit.py": 0.2, + "tests/commands/test_config.py": 0.8, + "tests/commands/test_config_audit_keys.py": 6.0, + "tests/commands/test_config_cmd.py": 1.4, + "tests/commands/test_config_commands.py": 1.0, + "tests/commands/test_config_field_validation.py": 0.8, + "tests/commands/test_config_workspace_docs_dry_run.py": 0.6, + "tests/commands/test_dependency_audit.py": 0.1, + "tests/commands/test_devcontainer.py": 2.9, + "tests/commands/test_devcontainer_install_tools_dry_run.py": 0.6, + "tests/commands/test_docker.py": 3.1, + "tests/commands/test_docker_cache.py": 0.2, + "tests/commands/test_docker_cosign.py": 0.3, + "tests/commands/test_docker_dry_run.py": 0.7, + "tests/commands/test_docs_site.py": 0.3, + "tests/commands/test_entry_point.py": 0.4, + "tests/commands/test_environment_root_commands.py": 2.1, + "tests/commands/test_gh_cmd.py": 4.4, + "tests/commands/test_gh_issues_close.py": 0.9, + "tests/commands/test_github_milestones.py": 0.4, + "tests/commands/test_global_dry_run.py": 1.5, + "tests/commands/test_grafana.py": 0.4, + "tests/commands/test_infra_apply.py": 7.4, + "tests/commands/test_infra_onboard.py": 1.2, + "tests/commands/test_infra_plan.py": 1.4, + "tests/commands/test_infra_status.py": 0.6, + "tests/commands/test_install_tools.py": 0.5, + "tests/commands/test_instruction_generator.py": 0.8, + "tests/commands/test_k8s_audit.py": 0.4, + "tests/commands/test_k8s_bootstrap_mattermost.py": 0.5, + "tests/commands/test_k8s_dry_run.py": 1.8, + "tests/commands/test_k8s_manifest_dry_run.py": 1.6, + "tests/commands/test_k8s_validate.py": 0.4, + "tests/commands/test_kustomize.py": 0.1, + "tests/commands/test_library_vector_tier.py": 2.4, + "tests/commands/test_load_and_pipeline.py": 0.3, + "tests/commands/test_mcp_serve.py": 0.1, + "tests/commands/test_mcp_serve_stdio_and_sse.py": 0.2, + "tests/commands/test_mcp_tools_and_schema_export.py": 0.3, + "tests/commands/test_memory_profiler.py": 37.3, + "tests/commands/test_net_construct_rules.py": 0.0, + "tests/commands/test_new.py": 0.5, + "tests/commands/test_openspec_scaffold.py": 0.1, + "tests/commands/test_passthrough_arguments.py": 0.0, + "tests/commands/test_pr.py": 6.8, + "tests/commands/test_pr_cmd.py": 1.8, + "tests/commands/test_pr_describe.py": 0.4, + "tests/commands/test_pr_dry_run.py": 1.5, + "tests/commands/test_pr_evidence.py": 0.4, + "tests/commands/test_pr_form_check.py": 1.2, + "tests/commands/test_pr_hardening_report.py": 0.6, + "tests/commands/test_pr_other_repository.py": 0.3, + "tests/commands/test_pr_status.py": 0.8, + "tests/commands/test_pr_title_labels.py": 0.8, + "tests/commands/test_pr_update.py": 6.8, + "tests/commands/test_prometheus.py": 0.7, + "tests/commands/test_rag.py": 0.7, + "tests/commands/test_repos.py": 2.2, + "tests/commands/test_research_advisories.py": 0.3, + "tests/commands/test_research_inventory.py": 2.1, + "tests/commands/test_review.py": 0.3, + "tests/commands/test_review_adjudication.py": 0.6, + "tests/commands/test_review_dry_run.py": 7.3, + "tests/commands/test_review_fetch_databases.py": 0.3, + "tests/commands/test_review_invalid_session_file.py": 0.3, + "tests/commands/test_review_pr_post.py": 1.5, + "tests/commands/test_review_pre_analysis_only.py": 0.2, + "tests/commands/test_review_removed_options.py": 0.1, + "tests/commands/test_review_rules_pack.py": 0.4, + "tests/commands/test_review_scope.py": 1.7, + "tests/commands/test_review_stage_flags.py": 0.8, + "tests/commands/test_roadmap_consolidate_cmd.py": 1.5, + "tests/commands/test_roadmap_eval_grades.py": 1.3, + "tests/commands/test_roadmap_eval_implement.py": 3.0, + "tests/commands/test_roadmap_eval_intake.py": 0.2, + "tests/commands/test_roadmap_eval_jev.py": 0.5, + "tests/commands/test_roadmap_eval_screen.py": 0.4, + "tests/commands/test_roadmap_plan_check_cmd.py": 2.0, + "tests/commands/test_roadmap_plan_recheck_cmd.py": 2.2, + "tests/commands/test_roadmap_review.py": 0.5, + "tests/commands/test_roadmap_step_fix_plan.py": 1.3, + "tests/commands/test_ruff_complexity_cap.py": 0.3, + "tests/commands/test_sandbox_dry_run.py": 1.0, + "tests/commands/test_sandbox_lifecycle.py": 0.7, + "tests/commands/test_sandbox_logs.py": 0.7, + "tests/commands/test_sandbox_metrics.py": 0.9, + "tests/commands/test_sandbox_network_policy.py": 2.4, + "tests/commands/test_scan.py": 0.6, + "tests/commands/test_scan_alerts.py": 0.2, + "tests/commands/test_scan_dry_run.py": 0.4, + "tests/commands/test_scan_injection.py": 0.3, + "tests/commands/test_scan_outcomes_and_gating.py": 0.9, + "tests/commands/test_security_bandit.py": 0.5, + "tests/commands/test_security_zizmor.py": 0.5, + "tests/commands/test_survey_cmd.py": 0.6, + "tests/commands/test_telemetry_cmd.py": 0.2, + "tests/commands/test_telemetry_monitoring_dry_run.py": 0.4, + "tests/commands/test_telemetry_profile.py": 0.5, + "tests/commands/test_test_runner.py": 0.9, + "tests/commands/test_test_selection.py": 2.5, + "tests/commands/test_tf.py": 0.6, + "tests/commands/test_tf_cost.py": 0.4, + "tests/commands/test_tf_dry_run.py": 1.2, + "tests/commands/test_tf_notify_plan.py": 0.1, + "tests/commands/test_tls_cmd.py": 2.0, + "tests/commands/test_uv.py": 0.5, + "tests/commands/test_valkey.py": 4.5, + "tests/commands/test_valkey_vault_dry_run.py": 0.5, + "tests/commands/test_vault_cmd.py": 1.2, + "tests/commands/test_workload_sandbox.py": 0.3, + "tests/commands/test_workspace.py": 0.7, + "tests/commands/test_zero_plaintext_invariants.py": 0.0, + "tests/config/test_ai_task_settings_paths.py": 1.3, + "tests/config/test_command_builders.py": 0.0, + "tests/config/test_config_file_mode.py": 0.0, + "tests/config/test_config_file_that_is_not_yaml.py": 1.4, + "tests/config/test_config_file_yaml_1_2.py": 0.1, + "tests/config/test_config_key_removal.py": 0.7, + "tests/config/test_config_keys.py": 0.1, + "tests/config/test_config_save_round_trip.py": 0.3, + "tests/config/test_config_write_history.py": 0.2, + "tests/config/test_config_yaml_load_errors.py": 0.1, + "tests/config/test_decision_point_settings.py": 0.2, + "tests/config/test_headless_auth.py": 0.0, + "tests/config/test_infra_repos_setting.py": 0.1, + "tests/config/test_isolation_tripwire.py": 16.6, + "tests/config/test_k8s_devops_runtime.py": 0.2, + "tests/config/test_keyring_contract.py": 0.1, + "tests/config/test_loki_url.py": 0.1, + "tests/config/test_metadata.py": 0.0, + "tests/config/test_removed_settings_fields.py": 0.0, + "tests/config/test_round_trip.py": 0.0, + "tests/config/test_service_url_defaults.py": 0.0, + "tests/config/test_setting_overrides_reach_their_readers.py": 0.7, + "tests/config/test_setting_sources.py": 0.2, + "tests/config/test_settings.py": 0.1, + "tests/config/test_settings_cache.py": 0.1, + "tests/config/test_stage_task_setting.py": 0.0, + "tests/config/test_tuicr_config.py": 0.0, + "tests/config/test_unknown_config_keys.py": 0.2, + "tests/core/test_audit_logger.py": 0.0, + "tests/core/test_audit_stream.py": 0.0, + "tests/core/test_caller.py": 0.0, + "tests/core/test_cleanup_fuzzing.py": 1.4, + "tests/core/test_clock_contract.py": 0.1, + "tests/core/test_code_metrics.py": 0.1, + "tests/core/test_consolidation_binaries.py": 0.0, + "tests/core/test_consolidation_core_paths.py": 0.1, + "tests/core/test_consolidation_process_json.py": 0.0, + "tests/core/test_core_repo.py": 0.0, + "tests/core/test_coverage_index.py": 0.2, + "tests/core/test_data_dir_worktrees.py": 2.5, + "tests/core/test_docs_command_resolver.py": 3.9, + "tests/core/test_docs_routine_tasks.py": 0.0, + "tests/core/test_draws.py": 0.0, + "tests/core/test_gh_dash_config.py": 0.2, + "tests/core/test_git_contract.py": 0.6, + "tests/core/test_git_recording.py": 0.0, + "tests/core/test_gitignore_evaluation.py": 0.1, + "tests/core/test_k8s_local_path_placement.py": 0.8, + "tests/core/test_non_public_ip_table.py": 0.5, + "tests/core/test_numeric_hosts.py": 0.1, + "tests/core/test_openspec_command.py": 0.6, + "tests/core/test_process.py": 8.4, + "tests/core/test_process_async_runner.py": 0.0, + "tests/core/test_process_contract.py": 0.2, + "tests/core/test_process_hardening.py": 1.5, + "tests/core/test_public_export_surface.py": 5.6, + "tests/core/test_renovate_config.py": 2.4, + "tests/core/test_repos_worktrees_add.py": 11.9, + "tests/core/test_review_dry_run_preview.py": 0.0, + "tests/core/test_roadmap_implement_checks.py": 38.2, + "tests/core/test_roadmap_implement_planned_run.py": 19.8, + "tests/core/test_scan_complexity.py": 0.2, + "tests/core/test_subprocess_env_boundary.py": 3.5, + "tests/core/test_subprocess_env_file_write.py": 0.3, + "tests/core/test_subprocess_env_gh_kubectl.py": 0.2, + "tests/core/test_subprocess_env_go_yarn.py": 0.1, + "tests/core/test_subprocess_env_telemetry.py": 0.0, + "tests/core/test_subprocess_env_uv_npm.py": 0.4, + "tests/core/test_telemetry_deduplication.py": 0.1, + "tests/core/test_template_rendering.py": 0.2, + "tests/core/test_third_party_telemetry.py": 0.2, + "tests/core/test_validation.py": 1.2, + "tests/core/test_workspace_cleanup.py": 0.1, + "tests/crypto/test_crypto_tls.py": 1.5, + "tests/crypto/test_ssh.py": 2.8, + "tests/design/test_contrast.py": 0.0, + "tests/design/test_design_spec.py": 0.0, + "tests/design/test_palettes.py": 0.1, + "tests/design/test_tokens.py": 0.0, + "tests/docker/test_cosign.py": 0.1, + "tests/docker/test_engine_build_cache.py": 0.1, + "tests/docker/test_engine_connection.py": 0.0, + "tests/docker/test_engine_containers.py": 0.1, + "tests/docker/test_engine_contract.py": 0.4, + "tests/docker/test_engine_endpoint.py": 0.4, + "tests/docker/test_engine_facts.py": 0.1, + "tests/docker/test_engine_networks.py": 0.0, + "tests/docker/test_engine_projection.py": 0.0, + "tests/docker/test_registry_tag_digest.py": 0.2, + "tests/docker/test_sandbox.py": 0.2, + "tests/docs/test_docs.py": 15.6, + "tests/docs/test_docs_adr_records.py": 0.2, + "tests/docs/test_docs_inventory.py": 8.8, + "tests/docs/test_docs_knowledge_base_argv.py": 1.1, + "tests/docs/test_docs_source_argv_collector.py": 2.0, + "tests/docs/test_docs_synced_blocks.py": 0.0, + "tests/docs/test_exceptions.py": 0.1, + "tests/docs/test_site.py": 0.2, + "tests/dry_run/test_dry_run_command_decorator.py": 0.0, + "tests/dry_run/test_dry_run_result_bounds.py": 0.0, + "tests/dry_run/test_dry_run_state.py": 0.0, + "tests/git/test_ai_task_metadata.py": 1.7, + "tests/git/test_branch_current_hook.py": 0.5, + "tests/git/test_branch_form.py": 0.1, + "tests/git/test_git_commit_snapshot.py": 0.1, + "tests/git/test_git_operations.py": 0.2, + "tests/git/test_git_worktree.py": 0.0, + "tests/git/test_known_hosts_properties.py": 1.9, + "tests/git/test_repos_worktrees.py": 1.4, + "tests/git/test_repos_worktrees_reclaim.py": 2.9, + "tests/git/test_repos_worktrees_reclaim_scope.py": 2.1, + "tests/git/test_review_worktree_regression.py": 0.1, + "tests/git/test_ssh_host_keys.py": 0.2, + "tests/github/test_ci_job_time.py": 1.5, + "tests/github/test_defect_classifier.py": 0.1, + "tests/github/test_gh_api_status_branch_protection_secrets_dry_run.py": 1.7, + "tests/github/test_gh_issues_milestones.py": 2.2, + "tests/github/test_gh_issues_milestones_labels_runs_dry_run.py": 2.5, + "tests/github/test_gh_project_views_pages_dry_run.py": 3.3, + "tests/github/test_gh_project_workflows.py": 6.3, + "tests/github/test_github_api_metrics.py": 0.4, + "tests/github/test_github_api_pages.py": 0.2, + "tests/github/test_github_app_identity.py": 1.9, + "tests/github/test_github_branch_protection.py": 4.1, + "tests/github/test_github_client.py": 5.9, + "tests/github/test_github_client_issue_reads.py": 0.4, + "tests/github/test_github_contract.py": 0.8, + "tests/github/test_github_errors.py": 0.9, + "tests/github/test_github_issues.py": 8.9, + "tests/github/test_github_labels.py": 0.0, + "tests/github/test_github_metrics.py": 4.9, + "tests/github/test_github_pages.py": 0.5, + "tests/github/test_github_pr_monitor.py": 0.7, + "tests/github/test_github_pr_threads.py": 16.3, + "tests/github/test_github_project_read.py": 0.1, + "tests/github/test_github_projects.py": 3.0, + "tests/github/test_github_projects_reconcile.py": 1.3, + "tests/github/test_github_rate_limiter.py": 5.2, + "tests/github/test_github_secrets.py": 5.3, + "tests/github/test_github_session.py": 4.9, + "tests/github/test_github_session_timeouts.py": 0.1, + "tests/github/test_github_ssh.py": 0.7, + "tests/github/test_hook_deliveries.py": 0.3, + "tests/github/test_item_grounding.py": 0.2, + "tests/github/test_merge_readiness.py": 3.4, + "tests/github/test_pr_check_verdict.py": 0.8, + "tests/github/test_pr_evidence.py": 0.4, + "tests/github/test_rate_limit_view.py": 0.0, + "tests/github/test_repo_ref.py": 3.6, + "tests/github/test_review_filed_findings.py": 0.1, + "tests/github/test_service_limits.py": 2.8, + "tests/grafana/test_grafana_client.py": 0.1, + "tests/grafana/test_grafana_dashboards.py": 0.7, + "tests/grafana/test_service_dashboard.py": 0.3, + "tests/http/test_dns_contract.py": 0.2, + "tests/http/test_egress_resolver.py": 0.0, + "tests/http/test_entry.py": 0.2, + "tests/http/test_entry_contract.py": 0.8, + "tests/http/test_gateway_review_stall.py": 1.8, + "tests/http/test_http.py": 0.0, + "tests/http/test_http_async_client.py": 0.0, + "tests/http/test_http_connection_pool.py": 0.1, + "tests/http/test_http_egress.py": 3.7, + "tests/infra/test_access.py": 0.0, + "tests/infra/test_apply.py": 0.1, + "tests/infra/test_nodes.py": 0.2, + "tests/infra/test_onboard.py": 2.7, + "tests/infra/test_plan.py": 0.1, + "tests/infra/test_repo_tree.py": 0.0, + "tests/infra/test_status.py": 0.1, + "tests/invariants/test_adr_records.py": 0.6, + "tests/invariants/test_agents_md.py": 2.6, + "tests/invariants/test_architectural_invariants.py": 14.5, + "tests/invariants/test_change_folders.py": 0.7, + "tests/invariants/test_committed_addresses.py": 1.0, + "tests/invariants/test_configmap_rollout_rule.py": 0.0, + "tests/invariants/test_configured_domain_check.py": 0.2, + "tests/invariants/test_construct_gate_check.py": 1.1, + "tests/invariants/test_devcontainer_config.py": 0.1, + "tests/invariants/test_dry_run_class_ratchet.py": 3.0, + "tests/invariants/test_hermetic_floor.py": 21.5, + "tests/invariants/test_host_path_roots.py": 0.0, + "tests/invariants/test_image_layers.py": 0.1, + "tests/invariants/test_k8s_argocd_apps.py": 1.8, + "tests/invariants/test_k8s_crawl4ai.py": 0.7, + "tests/invariants/test_k8s_manifests.py": 1.3, + "tests/invariants/test_k8s_mcp_server_policies.py": 0.5, + "tests/invariants/test_k8s_searxng.py": 0.4, + "tests/invariants/test_living_specs.py": 0.1, + "tests/invariants/test_mcp_server_image.py": 0.3, + "tests/invariants/test_pull_request_template.py": 0.0, + "tests/invariants/test_roadmap_eval_fixtures.py": 0.1, + "tests/invariants/test_roadmap_stage_measure_doc.py": 0.0, + "tests/invariants/test_roadmap_workflow_doc.py": 2.8, + "tests/invariants/test_runner_hooks.py": 0.1, + "tests/invariants/test_runner_image.py": 0.3, + "tests/invariants/test_service_image.py": 0.1, + "tests/invariants/test_skills.py": 0.1, + "tests/invariants/test_source_tree.py": 17.6, + "tests/invariants/test_suite_refuses_real_programs.py": 0.1, + "tests/invariants/test_swallowed_failures_check.py": 0.0, + "tests/invariants/test_task_prompts_check.py": 0.0, + "tests/invariants/test_workflow_contracts.py": 4.9, + "tests/k8s/test_cluster_secret_plan.py": 0.2, + "tests/k8s/test_cluster_secret_push.py": 0.3, + "tests/k8s/test_crawl4ai_check.py": 0.1, + "tests/k8s/test_environment.py": 0.1, + "tests/k8s/test_gitea_doctor.py": 1.1, + "tests/k8s/test_gpu_thresholds.py": 0.8, + "tests/k8s/test_http_connection_pool.py": 0.1, + "tests/k8s/test_image_pins.py": 1.0, + "tests/k8s/test_k8s_argocd_gate.py": 0.2, + "tests/k8s/test_k8s_argocd_overrides.py": 0.1, + "tests/k8s/test_k8s_cluster_job_api.py": 0.7, + "tests/k8s/test_k8s_configmap.py": 0.4, + "tests/k8s/test_k8s_configmap_keys.py": 0.3, + "tests/k8s/test_k8s_context_resolution.py": 0.2, + "tests/k8s/test_k8s_credentials.py": 1.7, + "tests/k8s/test_k8s_doctor.py": 1.0, + "tests/k8s/test_k8s_logs_diff_chaos.py": 1.5, + "tests/k8s/test_k8s_models.py": 0.3, + "tests/k8s/test_k8s_ollama_models.py": 0.1, + "tests/k8s/test_k8s_ollama_prune.py": 0.1, + "tests/k8s/test_k8s_pod_log_text.py": 1.5, + "tests/k8s/test_k8s_policy.py": 0.1, + "tests/k8s/test_k8s_port_forward_daemon.py": 0.8, + "tests/k8s/test_k8s_proxy_reachability.py": 0.5, + "tests/k8s/test_k8s_security_stream.py": 0.8, + "tests/k8s/test_k8s_service.py": 0.7, + "tests/k8s/test_k8s_service_proxy.py": 0.6, + "tests/k8s/test_k8s_template.py": 0.6, + "tests/k8s/test_k8s_tunnel.py": 1.1, + "tests/k8s/test_k8s_valkey_stack.py": 1.0, + "tests/k8s/test_k8s_volume_move.py": 1.4, + "tests/k8s/test_kubernetes_contract.py": 1.0, + "tests/k8s/test_loki_url_setting.py": 0.2, + "tests/k8s/test_searxng_check.py": 0.2, + "tests/k8s/test_service_probe.py": 0.1, + "tests/lang/test_language_catalogs.py": 0.0, + "tests/models/test_prometheus_models.py": 0.0, + "tests/models/test_resource_schemas.py": 0.1, + "tests/openspec/test_openspec_archive.py": 0.2, + "tests/openspec/test_openspec_gate.py": 1.2, + "tests/openspec/test_openspec_new.py": 0.7, + "tests/openspec/test_openspec_project.py": 0.0, + "tests/openspec/test_openspec_tool.py": 0.2, + "tests/output/test_network_table_color.py": 0.4, + "tests/output/test_output.py": 5.0, + "tests/output/test_streaming_serializer.py": 0.0, + "tests/project/test_profile.py": 0.1, + "tests/prometheus/test_dashboard_queries.py": 1.0, + "tests/prometheus/test_implement_failure_labels.py": 0.1, + "tests/prometheus/test_k8s_monitoring_alerting.py": 16.7, + "tests/prometheus/test_k8s_monitoring_dashboards.py": 0.4, + "tests/prometheus/test_prometheus_client.py": 0.1, + "tests/prometheus/test_promql_analysis.py": 0.4, + "tests/release/test_release_merge_guards.py": 0.2, + "tests/release/test_release_merge_pick.py": 0.4, + "tests/research/test_advisories.py": 2.2, + "tests/research/test_github_advisories.py": 0.4, + "tests/research/test_inventory.py": 1.7, + "tests/research/test_inventory_repository.py": 4.6, + "tests/research/test_kev.py": 0.2, + "tests/research/test_sweep.py": 0.5, + "tests/research/test_version_match.py": 0.2, + "tests/research/test_watch_list.py": 0.1, + "tests/review/test_kb_manuals_metadata.py": 0.7, + "tests/review/test_report.py": 0.3, + "tests/review/test_review_diff.py": 0.1, + "tests/review/test_review_group_analysis.py": 6.5, + "tests/review/test_review_intake_handoff.py": 1.5, + "tests/review/test_review_json_fuzzing.py": 2.6, + "tests/review/test_review_manifests.py": 0.0, + "tests/review/test_review_on_merged_code.py": 1.1, + "tests/review/test_review_page_line_numbers.py": 0.0, + "tests/review/test_review_prompt_adversaries.py": 0.6, + "tests/review/test_review_syntax_masking.py": 0.0, + "tests/review/test_review_targets_stay_inside_the_repository.py": 0.0, + "tests/review/test_review_tool_binary_digest.py": 0.1, + "tests/review/test_review_untrusted_tree.py": 1.6, + "tests/review/test_session_loader.py": 0.0, + "tests/review/test_suppression.py": 0.0, + "tests/review/test_verdict_polarity.py": 0.1, + "tests/roadmap/implement/test_roadmap_implement_amend.py": 0.1, + "tests/roadmap/implement/test_roadmap_implement_amend_job.py": 8.1, + "tests/roadmap/implement/test_roadmap_implement_checkpoint.py": 70.6, + "tests/roadmap/implement/test_roadmap_implement_command.py": 13.1, + "tests/roadmap/implement/test_roadmap_implement_consecutive_failures.py": 0.1, + "tests/roadmap/implement/test_roadmap_implement_deadline.py": 4.1, + "tests/roadmap/implement/test_roadmap_implement_deadline_settings.py": 0.1, + "tests/roadmap/implement/test_roadmap_implement_eval_fixtures.py": 0.1, + "tests/roadmap/implement/test_roadmap_implement_eval_properties.py": 0.4, + "tests/roadmap/implement/test_roadmap_implement_eval_run.py": 3.9, + "tests/roadmap/implement/test_roadmap_implement_extension.py": 3.4, + "tests/roadmap/implement/test_roadmap_implement_fix_scope.py": 0.1, + "tests/roadmap/implement/test_roadmap_implement_fix_scope_stop.py": 4.8, + "tests/roadmap/implement/test_roadmap_implement_git_isolation.py": 6.8, + "tests/roadmap/implement/test_roadmap_implement_hooks.py": 1.5, + "tests/roadmap/implement/test_roadmap_implement_job.py": 134.3, + "tests/roadmap/implement/test_roadmap_implement_job_extension.py": 6.1, + "tests/roadmap/implement/test_roadmap_implement_job_recorded_tests.py": 7.2, + "tests/roadmap/implement/test_roadmap_implement_job_result.py": 1.2, + "tests/roadmap/implement/test_roadmap_implement_job_scoped.py": 59.7, + "tests/roadmap/implement/test_roadmap_implement_job_table.py": 9.5, + "tests/roadmap/implement/test_roadmap_implement_job_trace.py": 18.2, + "tests/roadmap/implement/test_roadmap_implement_limits.py": 2.1, + "tests/roadmap/implement/test_roadmap_implement_negative_search.py": 4.3, + "tests/roadmap/implement/test_roadmap_implement_outside.py": 2.7, + "tests/roadmap/implement/test_roadmap_implement_phase_marks.py": 69.4, + "tests/roadmap/implement/test_roadmap_implement_plan_reason.py": 2.2, + "tests/roadmap/implement/test_roadmap_implement_planned.py": 9.5, + "tests/roadmap/implement/test_roadmap_implement_project_steps.py": 27.7, + "tests/roadmap/implement/test_roadmap_implement_prompt.py": 0.1, + "tests/roadmap/implement/test_roadmap_implement_pull.py": 0.9, + "tests/roadmap/implement/test_roadmap_implement_push_current.py": 14.1, + "tests/roadmap/implement/test_roadmap_implement_read_pipe.py": 4.3, + "tests/roadmap/implement/test_roadmap_implement_record_readers.py": 0.1, + "tests/roadmap/implement/test_roadmap_implement_records.py": 0.1, + "tests/roadmap/implement/test_roadmap_implement_resplit.py": 14.4, + "tests/roadmap/implement/test_roadmap_implement_scoped_ci.py": 0.4, + "tests/roadmap/implement/test_roadmap_implement_selection.py": 21.9, + "tests/roadmap/implement/test_roadmap_implement_shell_policy.py": 5.6, + "tests/roadmap/implement/test_roadmap_implement_shell_refusal.py": 7.3, + "tests/roadmap/implement/test_roadmap_implement_size.py": 0.2, + "tests/roadmap/implement/test_roadmap_implement_step.py": 37.0, + "tests/roadmap/implement/test_roadmap_implement_step_attempts.py": 2.1, + "tests/roadmap/implement/test_roadmap_implement_step_classes.py": 0.1, + "tests/roadmap/implement/test_roadmap_implement_step_commit.py": 0.4, + "tests/roadmap/implement/test_roadmap_implement_step_fail_to_pass.py": 6.2, + "tests/roadmap/implement/test_roadmap_implement_step_failure_class.py": 1.9, + "tests/roadmap/implement/test_roadmap_implement_step_fix_paths.py": 1.5, + "tests/roadmap/implement/test_roadmap_implement_step_format.py": 5.7, + "tests/roadmap/implement/test_roadmap_implement_step_hooks.py": 5.7, + "tests/roadmap/implement/test_roadmap_implement_step_output_cap.py": 3.1, + "tests/roadmap/implement/test_roadmap_implement_step_own_text.py": 9.4, + "tests/roadmap/implement/test_roadmap_implement_step_parser.py": 1.3, + "tests/roadmap/implement/test_roadmap_implement_step_repair.py": 9.7, + "tests/roadmap/implement/test_roadmap_implement_step_rules.py": 0.8, + "tests/roadmap/implement/test_roadmap_implement_step_test_form.py": 5.4, + "tests/roadmap/implement/test_roadmap_implement_step_tests_kept.py": 11.6, + "tests/roadmap/implement/test_roadmap_implement_step_ticks.py": 13.4, + "tests/roadmap/implement/test_roadmap_implement_step_trace.py": 4.6, + "tests/roadmap/implement/test_roadmap_implement_step_typecheck.py": 2.0, + "tests/roadmap/implement/test_roadmap_implement_strays.py": 7.3, + "tests/roadmap/implement/test_roadmap_implement_submit.py": 53.0, + "tests/roadmap/implement/test_roadmap_implement_test_form.py": 0.1, + "tests/roadmap/implement/test_roadmap_implement_test_names.py": 0.1, + "tests/roadmap/implement/test_roadmap_implement_timeouts.py": 0.9, + "tests/roadmap/implement/test_roadmap_implement_token_isolation.py": 3.4, + "tests/roadmap/implement/test_roadmap_implement_tool_log.py": 3.8, + "tests/roadmap/implement/test_roadmap_implement_trace.py": 0.1, + "tests/roadmap/implement/test_roadmap_implement_trace_table.py": 0.0, + "tests/roadmap/implement/test_roadmap_implement_typed_result.py": 24.1, + "tests/roadmap/implement/test_roadmap_implement_verification_reason.py": 9.9, + "tests/roadmap/implement/test_roadmap_implement_wip.py": 3.7, + "tests/roadmap/implement/test_roadmap_implement_wip_job.py": 11.4, + "tests/roadmap/intake/test_roadmap_intake_agent_candidates.py": 0.9, + "tests/roadmap/intake/test_roadmap_intake_checks.py": 0.0, + "tests/roadmap/intake/test_roadmap_intake_command.py": 1.6, + "tests/roadmap/intake/test_roadmap_intake_dry_run.py": 1.0, + "tests/roadmap/intake/test_roadmap_intake_duplicates.py": 0.8, + "tests/roadmap/intake/test_roadmap_intake_evidence.py": 0.2, + "tests/roadmap/intake/test_roadmap_intake_failure_class.py": 0.4, + "tests/roadmap/intake/test_roadmap_intake_github_requests.py": 0.4, + "tests/roadmap/intake/test_roadmap_intake_item_changed.py": 0.2, + "tests/roadmap/intake/test_roadmap_intake_jev.py": 1.4, + "tests/roadmap/intake/test_roadmap_intake_jev_shadow.py": 0.6, + "tests/roadmap/intake/test_roadmap_intake_job_result.py": 0.0, + "tests/roadmap/intake/test_roadmap_intake_labels_file.py": 0.1, + "tests/roadmap/intake/test_roadmap_intake_mcp_mirror.py": 0.5, + "tests/roadmap/intake/test_roadmap_intake_model_reply.py": 0.1, + "tests/roadmap/intake/test_roadmap_intake_placement.py": 0.1, + "tests/roadmap/intake/test_roadmap_intake_reason_comment.py": 0.1, + "tests/roadmap/intake/test_roadmap_intake_shortlist.py": 0.4, + "tests/roadmap/intake/test_roadmap_intake_sub_issues.py": 0.5, + "tests/roadmap/intake/test_roadmap_intake_title_labels.py": 0.3, + "tests/roadmap/intake/test_roadmap_intake_untrusted_text.py": 0.1, + "tests/roadmap/intake/test_roadmap_intake_write_failures.py": 0.3, + "tests/roadmap/project_review/test_review_facts.py": 0.1, + "tests/roadmap/project_review/test_review_window.py": 0.1, + "tests/roadmap/refine/test_roadmap_refine_authors.py": 0.3, + "tests/roadmap/refine/test_roadmap_refine_blocked.py": 0.3, + "tests/roadmap/refine/test_roadmap_refine_cited_paths.py": 0.4, + "tests/roadmap/refine/test_roadmap_refine_command.py": 0.2, + "tests/roadmap/refine/test_roadmap_refine_comment_cap.py": 0.2, + "tests/roadmap/refine/test_roadmap_refine_context.py": 0.4, + "tests/roadmap/refine/test_roadmap_refine_covers_check.py": 2.2, + "tests/roadmap/refine/test_roadmap_refine_decisions.py": 0.3, + "tests/roadmap/refine/test_roadmap_refine_deferred.py": 1.0, + "tests/roadmap/refine/test_roadmap_refine_failure_class.py": 1.3, + "tests/roadmap/refine/test_roadmap_refine_failure_record.py": 5.7, + "tests/roadmap/refine/test_roadmap_refine_gateway_failures.py": 2.4, + "tests/roadmap/refine/test_roadmap_refine_investigation.py": 10.6, + "tests/roadmap/refine/test_roadmap_refine_investigation_window.py": 0.1, + "tests/roadmap/refine/test_roadmap_refine_item_option.py": 0.1, + "tests/roadmap/refine/test_roadmap_refine_job_failure.py": 2.2, + "tests/roadmap/refine/test_roadmap_refine_job_result.py": 0.2, + "tests/roadmap/refine/test_roadmap_refine_next_step.py": 0.3, + "tests/roadmap/refine/test_roadmap_refine_one_write.py": 0.2, + "tests/roadmap/refine/test_roadmap_refine_person_wait.py": 0.5, + "tests/roadmap/refine/test_roadmap_refine_placeholder.py": 0.5, + "tests/roadmap/refine/test_roadmap_refine_proposal.py": 0.1, + "tests/roadmap/refine/test_roadmap_refine_questions.py": 0.2, + "tests/roadmap/refine/test_roadmap_refine_recorded_wait.py": 0.4, + "tests/roadmap/refine/test_roadmap_refine_round.py": 0.7, + "tests/roadmap/refine/test_roadmap_refine_sanitize.py": 0.9, + "tests/roadmap/refine/test_roadmap_refine_selection.py": 1.0, + "tests/roadmap/refine/test_roadmap_refine_stage_return.py": 0.4, + "tests/roadmap/refine/test_roadmap_refine_title_type.py": 0.1, + "tests/roadmap/refine/test_roadmap_refine_trust.py": 3.2, + "tests/roadmap/refine/test_roadmap_refine_waits.py": 0.2, + "tests/roadmap/refine/test_roadmap_refine_web_search.py": 0.2, + "tests/roadmap/refine/test_roadmap_refine_write_stops.py": 0.3, + "tests/roadmap/stage/test_roadmap_stage_apply.py": 32.4, + "tests/roadmap/stage/test_roadmap_stage_citation_quote.py": 0.1, + "tests/roadmap/stage/test_roadmap_stage_command.py": 5.0, + "tests/roadmap/stage/test_roadmap_stage_command_citations.py": 2.7, + "tests/roadmap/stage/test_roadmap_stage_constants.py": 1.0, + "tests/roadmap/stage/test_roadmap_stage_content.py": 0.6, + "tests/roadmap/stage/test_roadmap_stage_context.py": 0.1, + "tests/roadmap/stage/test_roadmap_stage_cost_units.py": 0.0, + "tests/roadmap/stage/test_roadmap_stage_criteria.py": 0.1, + "tests/roadmap/stage/test_roadmap_stage_criterion_dropped.py": 1.2, + "tests/roadmap/stage/test_roadmap_stage_eval_cases.py": 0.3, + "tests/roadmap/stage/test_roadmap_stage_eval_command.py": 11.6, + "tests/roadmap/stage/test_roadmap_stage_eval_facts_context.py": 10.6, + "tests/roadmap/stage/test_roadmap_stage_eval_gates.py": 13.6, + "tests/roadmap/stage/test_roadmap_stage_eval_run.py": 4.8, + "tests/roadmap/stage/test_roadmap_stage_eval_usage.py": 0.0, + "tests/roadmap/stage/test_roadmap_stage_failure_class.py": 7.8, + "tests/roadmap/stage/test_roadmap_stage_findings.py": 1.7, + "tests/roadmap/stage/test_roadmap_stage_form.py": 0.6, + "tests/roadmap/stage/test_roadmap_stage_gates.py": 1.4, + "tests/roadmap/stage/test_roadmap_stage_github.py": 0.5, + "tests/roadmap/stage/test_roadmap_stage_item_writes.py": 6.1, + "tests/roadmap/stage/test_roadmap_stage_jev_screen.py": 2.7, + "tests/roadmap/stage/test_roadmap_stage_job.py": 9.8, + "tests/roadmap/stage/test_roadmap_stage_job_result.py": 2.6, + "tests/roadmap/stage/test_roadmap_stage_kind.py": 0.2, + "tests/roadmap/stage/test_roadmap_stage_manifest.py": 0.0, + "tests/roadmap/stage/test_roadmap_stage_measure.py": 3.3, + "tests/roadmap/stage/test_roadmap_stage_models.py": 0.2, + "tests/roadmap/stage/test_roadmap_stage_module_test_order.py": 0.0, + "tests/roadmap/stage/test_roadmap_stage_module_tests.py": 0.0, + "tests/roadmap/stage/test_roadmap_stage_move_prefix.py": 0.0, + "tests/roadmap/stage/test_roadmap_stage_move_references.py": 0.1, + "tests/roadmap/stage/test_roadmap_stage_moved.py": 0.6, + "tests/roadmap/stage/test_roadmap_stage_negative_search.py": 1.0, + "tests/roadmap/stage/test_roadmap_stage_orphan.py": 6.6, + "tests/roadmap/stage/test_roadmap_stage_overlap.py": 0.0, + "tests/roadmap/stage/test_roadmap_stage_own_change.py": 0.0, + "tests/roadmap/stage/test_roadmap_stage_paths.py": 1.0, + "tests/roadmap/stage/test_roadmap_stage_plan.py": 39.2, + "tests/roadmap/stage/test_roadmap_stage_plan_defect_limit.py": 2.9, + "tests/roadmap/stage/test_roadmap_stage_plan_record.py": 8.0, + "tests/roadmap/stage/test_roadmap_stage_plan_record_facts.py": 4.1, + "tests/roadmap/stage/test_roadmap_stage_planned.py": 2.8, + "tests/roadmap/stage/test_roadmap_stage_probe.py": 5.5, + "tests/roadmap/stage/test_roadmap_stage_prompt_rules.py": 0.8, + "tests/roadmap/stage/test_roadmap_stage_ready.py": 0.7, + "tests/roadmap/stage/test_roadmap_stage_ready_jev.py": 0.4, + "tests/roadmap/stage/test_roadmap_stage_reconcile.py": 1.5, + "tests/roadmap/stage/test_roadmap_stage_reference_coverage.py": 0.0, + "tests/roadmap/stage/test_roadmap_stage_refused_reply.py": 8.6, + "tests/roadmap/stage/test_roadmap_stage_registry.py": 0.1, + "tests/roadmap/stage/test_roadmap_stage_rejected.py": 10.6, + "tests/roadmap/stage/test_roadmap_stage_removal_references.py": 0.7, + "tests/roadmap/stage/test_roadmap_stage_repair_return.py": 5.4, + "tests/roadmap/stage/test_roadmap_stage_request.py": 0.9, + "tests/roadmap/stage/test_roadmap_stage_requirement_length.py": 0.0, + "tests/roadmap/stage/test_roadmap_stage_requirements.py": 0.0, + "tests/roadmap/stage/test_roadmap_stage_restore_scenarios.py": 2.0, + "tests/roadmap/stage/test_roadmap_stage_retry.py": 0.7, + "tests/roadmap/stage/test_roadmap_stage_retry_after.py": 0.9, + "tests/roadmap/stage/test_roadmap_stage_review_rounds.py": 3.1, + "tests/roadmap/stage/test_roadmap_stage_round_log.py": 0.7, + "tests/roadmap/stage/test_roadmap_stage_scenario_evidence.py": 0.1, + "tests/roadmap/stage/test_roadmap_stage_screen_eval.py": 0.1, + "tests/roadmap/stage/test_roadmap_stage_security.py": 0.1, + "tests/roadmap/stage/test_roadmap_stage_selection.py": 0.8, + "tests/roadmap/stage/test_roadmap_stage_self_acceptance.py": 0.0, + "tests/roadmap/stage/test_roadmap_stage_settings.py": 2.8, + "tests/roadmap/stage/test_roadmap_stage_specs.py": 0.1, + "tests/roadmap/stage/test_roadmap_stage_split.py": 0.0, + "tests/roadmap/stage/test_roadmap_stage_split_gates.py": 10.8, + "tests/roadmap/stage/test_roadmap_stage_task_verification.py": 1.4, + "tests/roadmap/stage/test_roadmap_stage_text_lines.py": 1.6, + "tests/roadmap/stage/test_roadmap_stage_title.py": 1.2, + "tests/roadmap/stage/test_roadmap_stage_toolbox.py": 13.2, + "tests/roadmap/stage/test_roadmap_stage_tools.py": 6.9, + "tests/roadmap/stage/test_roadmap_stage_trace_runs.py": 0.6, + "tests/roadmap/stage/test_roadmap_stage_trace_spans.py": 0.5, + "tests/roadmap/stage/test_roadmap_stage_trace_subject.py": 0.4, + "tests/roadmap/stage/test_roadmap_stage_verification.py": 12.5, + "tests/roadmap/stage/test_roadmap_stage_verify.py": 2.2, + "tests/roadmap/stage/test_roadmap_stage_verify_eval.py": 11.0, + "tests/roadmap/stage/test_roadmap_stage_window.py": 10.0, + "tests/roadmap/stage/test_roadmap_stage_write_stops.py": 1.4, + "tests/roadmap/stage/test_stage_run_allowlist.py": 6.8, + "tests/roadmap/steps/test_roadmap_fix_plan.py": 19.2, + "tests/roadmap/steps/test_roadmap_fix_plan_comment.py": 3.3, + "tests/roadmap/steps/test_roadmap_fix_plan_row.py": 1.1, + "tests/roadmap/stores/test_comment_repeat.py": 0.1, + "tests/roadmap/stores/test_listing_snapshot.py": 0.5, + "tests/roadmap/stores/test_roadmap_github_store_changes.py": 1.0, + "tests/roadmap/stores/test_roadmap_github_store_comments.py": 0.2, + "tests/roadmap/stores/test_roadmap_github_store_files.py": 0.0, + "tests/roadmap/stores/test_roadmap_github_store_history.py": 0.0, + "tests/roadmap/stores/test_roadmap_github_store_issue_writes.py": 0.0, + "tests/roadmap/stores/test_roadmap_github_store_items.py": 0.0, + "tests/roadmap/stores/test_roadmap_github_store_milestones.py": 0.1, + "tests/roadmap/stores/test_roadmap_github_store_paging.py": 0.7, + "tests/roadmap/stores/test_roadmap_github_store_read_failures.py": 0.1, + "tests/roadmap/stores/test_roadmap_github_store_record_writes.py": 1.6, + "tests/roadmap/stores/test_roadmap_github_store_repository.py": 0.1, + "tests/roadmap/stores/test_roadmap_store_body_with_marks.py": 0.0, + "tests/roadmap/stores/test_roadmap_store_contract.py": 0.8, + "tests/roadmap/stores/test_roadmap_store_fake.py": 0.0, + "tests/roadmap/stores/test_roadmap_store_install.py": 0.1, + "tests/roadmap/stores/test_roadmap_store_record_parse.py": 0.0, + "tests/roadmap/test_grounding.py": 0.1, + "tests/roadmap/test_jev_completeness.py": 0.2, + "tests/roadmap/test_jev_completeness_eval.py": 0.4, + "tests/roadmap/test_job_grade.py": 0.9, + "tests/roadmap/test_job_grade_report.py": 1.0, + "tests/roadmap/test_job_result.py": 0.0, + "tests/roadmap/test_pr_conflicts.py": 0.8, + "tests/roadmap/test_premise.py": 1.2, + "tests/roadmap/test_roadmap_adr.py": 0.4, + "tests/roadmap/test_roadmap_alternatives.py": 24.4, + "tests/roadmap/test_roadmap_alternatives_item_writes.py": 0.9, + "tests/roadmap/test_roadmap_alternatives_job_result.py": 0.0, + "tests/roadmap/test_roadmap_alternatives_one_write.py": 0.0, + "tests/roadmap/test_roadmap_alternatives_project_facts.py": 0.2, + "tests/roadmap/test_roadmap_alternatives_recheck.py": 0.2, + "tests/roadmap/test_roadmap_alternatives_search.py": 1.0, + "tests/roadmap/test_roadmap_claim.py": 0.3, + "tests/roadmap/test_roadmap_claim_command.py": 0.6, + "tests/roadmap/test_roadmap_command_help.py": 0.1, + "tests/roadmap/test_roadmap_commit_title.py": 0.1, + "tests/roadmap/test_roadmap_consolidate.py": 0.7, + "tests/roadmap/test_roadmap_consolidate_judge.py": 0.1, + "tests/roadmap/test_roadmap_consolidate_shortlist.py": 0.2, + "tests/roadmap/test_roadmap_decision_fit.py": 0.0, + "tests/roadmap/test_roadmap_decision_point.py": 0.3, + "tests/roadmap/test_roadmap_decision_step.py": 0.1, + "tests/roadmap/test_roadmap_decision_table.py": 0.0, + "tests/roadmap/test_roadmap_digest_clears.py": 0.1, + "tests/roadmap/test_roadmap_draft_readiness.py": 0.2, + "tests/roadmap/test_roadmap_dry_runs.py": 2.7, + "tests/roadmap/test_roadmap_duplicate_eval.py": 1.6, + "tests/roadmap/test_roadmap_explain.py": 18.6, + "tests/roadmap/test_roadmap_explain_command.py": 6.3, + "tests/roadmap/test_roadmap_failure.py": 1.0, + "tests/roadmap/test_roadmap_fence.py": 0.0, + "tests/roadmap/test_roadmap_inbox.py": 0.2, + "tests/roadmap/test_roadmap_inbox_command.py": 0.9, + "tests/roadmap/test_roadmap_inbox_requests.py": 0.1, + "tests/roadmap/test_roadmap_intervals.py": 0.1, + "tests/roadmap/test_roadmap_jev_eval.py": 2.0, + "tests/roadmap/test_roadmap_jev_shadow_report.py": 0.3, + "tests/roadmap/test_roadmap_labels_file.py": 0.1, + "tests/roadmap/test_roadmap_ledger_retry_after.py": 0.9, + "tests/roadmap/test_roadmap_limit_classes.py": 0.1, + "tests/roadmap/test_roadmap_mcp.py": 0.6, + "tests/roadmap/test_roadmap_nearest.py": 0.0, + "tests/roadmap/test_roadmap_onboard.py": 1.7, + "tests/roadmap/test_roadmap_page_fetch.py": 0.7, + "tests/roadmap/test_roadmap_plan_check.py": 14.9, + "tests/roadmap/test_roadmap_plan_read.py": 5.5, + "tests/roadmap/test_roadmap_plan_read_weakened.py": 0.4, + "tests/roadmap/test_roadmap_plan_recheck.py": 10.8, + "tests/roadmap/test_roadmap_plan_rewrite.py": 0.1, + "tests/roadmap/test_roadmap_planned.py": 0.8, + "tests/roadmap/test_roadmap_pull_form.py": 0.6, + "tests/roadmap/test_roadmap_pull_labels.py": 0.0, + "tests/roadmap/test_roadmap_release_comments.py": 0.2, + "tests/roadmap/test_roadmap_release_feed.py": 0.1, + "tests/roadmap/test_roadmap_release_roll.py": 0.3, + "tests/roadmap/test_roadmap_repair.py": 0.3, + "tests/roadmap/test_roadmap_repair_command.py": 0.5, + "tests/roadmap/test_roadmap_retitle.py": 0.5, + "tests/roadmap/test_roadmap_retitle_skip.py": 0.1, + "tests/roadmap/test_roadmap_retitle_type.py": 0.1, + "tests/roadmap/test_roadmap_return.py": 0.4, + "tests/roadmap/test_roadmap_run_adapter_imports.py": 3.6, + "tests/roadmap/test_roadmap_run_checkout.py": 0.3, + "tests/roadmap/test_roadmap_run_due_table.py": 0.8, + "tests/roadmap/test_roadmap_run_errors.py": 0.3, + "tests/roadmap/test_roadmap_run_failure_ledger.py": 0.2, + "tests/roadmap/test_roadmap_run_github_requests.py": 0.5, + "tests/roadmap/test_roadmap_run_intake_row.py": 0.4, + "tests/roadmap/test_roadmap_run_job_counts.py": 0.6, + "tests/roadmap/test_roadmap_run_job_rows.py": 0.6, + "tests/roadmap/test_roadmap_run_lanes.py": 0.6, + "tests/roadmap/test_roadmap_run_metrics.py": 1.0, + "tests/roadmap/test_roadmap_run_scoped_update.py": 0.8, + "tests/roadmap/test_roadmap_run_service.py": 0.2, + "tests/roadmap/test_roadmap_run_webhook_keys.py": 0.2, + "tests/roadmap/test_roadmap_runner_tools.py": 1.0, + "tests/roadmap/test_roadmap_schedule_unreadable.py": 0.0, + "tests/roadmap/test_roadmap_status_labels.py": 0.0, + "tests/roadmap/test_roadmap_status_round.py": 1.1, + "tests/roadmap/test_roadmap_status_rows.py": 0.2, + "tests/roadmap/test_roadmap_status_sync.py": 0.3, + "tests/roadmap/test_roadmap_step_files.py": 0.0, + "tests/roadmap/test_roadmap_step_rules.py": 0.8, + "tests/roadmap/test_roadmap_stop_clear.py": 1.1, + "tests/roadmap/test_roadmap_suspended_row_comment.py": 0.5, + "tests/roadmap/test_roadmap_tools.py": 0.1, + "tests/roadmap/test_roadmap_trust.py": 0.8, + "tests/roadmap/test_step_commit_title.py": 0.0, + "tests/sandbox/test_host_sandbox.py": 0.3, + "tests/sandbox/test_k8s_ipv6_and_proxy_boundaries.py": 1.6, + "tests/sandbox/test_sandbox_cgroup_metrics.py": 0.2, + "tests/sandbox/test_sandbox_deploy_pull.py": 0.1, + "tests/sandbox/test_sandbox_engine.py": 0.4, + "tests/sandbox/test_sandbox_metric_thresholds.py": 0.0, + "tests/sandbox/test_sandbox_metrics.py": 0.1, + "tests/sandbox/test_sandbox_models.py": 0.0, + "tests/sandbox/test_sandbox_network_config.py": 0.3, + "tests/sandbox/test_sandbox_policy.py": 0.6, + "tests/sandbox/test_sandbox_policy_properties.py": 1.8, + "tests/sandbox/test_sandbox_ports.py": 0.0, + "tests/sandbox/test_sandbox_probe.py": 0.7, + "tests/sandbox/test_sandbox_prometheus_metrics.py": 0.1, + "tests/sandbox/test_sandbox_registry.py": 0.0, + "tests/sandbox/test_sandbox_seccomp.py": 0.5, + "tests/sandbox/test_sandbox_tool_executor.py": 0.1, + "tests/sandbox/test_sandbox_trace_context.py": 0.2, + "tests/sandbox/test_sandbox_workspace.py": 2.3, + "tests/scaffold/test_edge_fixtures.py": 0.4, + "tests/scaffold/test_edits.py": 0.0, + "tests/security/test_aibom.py": 0.4, + "tests/security/test_alert_filer.py": 0.2, + "tests/security/test_builtin_tools.py": 2.3, + "tests/security/test_config_declarations.py": 0.2, + "tests/security/test_dependency_remediator.py": 0.3, + "tests/security/test_finding_correlation.py": 0.1, + "tests/security/test_finding_fingerprints.py": 0.1, + "tests/security/test_finding_normalization.py": 0.2, + "tests/security/test_golangci_lint_scanner.py": 0.1, + "tests/security/test_k8s_manifest_validation.py": 0.0, + "tests/security/test_kube_api_network_profile.py": 0.2, + "tests/security/test_network_security.py": 0.0, + "tests/security/test_osv_scanner.py": 0.3, + "tests/security/test_private_host_masking.py": 0.0, + "tests/security/test_prompt_injection.py": 0.0, + "tests/security/test_redaction_properties.py": 3.1, + "tests/security/test_reference_address_classes.py": 0.4, + "tests/security/test_reference_extraction.py": 0.6, + "tests/security/test_reference_false_positives.py": 0.6, + "tests/security/test_reference_literal_parsers.py": 0.1, + "tests/security/test_reference_name_classes.py": 0.6, + "tests/security/test_reference_report_order.py": 0.1, + "tests/security/test_review_canary.py": 0.3, + "tests/security/test_review_pipeline_go.py": 0.1, + "tests/security/test_review_ruff_mypy_evidence.py": 0.3, + "tests/security/test_review_rule_exclusions.py": 0.1, + "tests/security/test_review_score.py": 2.3, + "tests/security/test_review_tool_runs.py": 2.0, + "tests/security/test_runtime_input_guards.py": 0.0, + "tests/security/test_sarif_emission.py": 0.3, + "tests/security/test_sarif_fuzzing.py": 1.5, + "tests/security/test_sarif_ingestion.py": 0.2, + "tests/security/test_sbom.py": 0.3, + "tests/security/test_scan_gate.py": 0.0, + "tests/security/test_scan_report.py": 0.6, + "tests/security/test_scanner_base_and_registry.py": 0.5, + "tests/security/test_scanner_contract.py": 0.3, + "tests/security/test_scanner_tool_executor.py": 1.6, + "tests/security/test_secops.py": 0.2, + "tests/security/test_secret_redaction.py": 1.8, + "tests/security/test_secret_resolution.py": 0.3, + "tests/security/test_security_gitleaks.py": 0.4, + "tests/security/test_security_kubeconform.py": 0.2, + "tests/security/test_security_kubelinter.py": 0.1, + "tests/security/test_security_semgrep.py": 3.8, + "tests/security/test_security_threat_intel.py": 0.9, + "tests/security/test_security_uv_audit.py": 0.1, + "tests/security/test_semgrep_registry.py": 8.8, + "tests/security/test_suppression_policy.py": 0.1, + "tests/security/test_suppression_properties.py": 1.6, + "tests/security/test_tflint.py": 0.2, + "tests/security/test_tool_databases.py": 0.1, + "tests/security/test_trivy_config_ignore.py": 0.0, + "tests/security/test_vault_broker.py": 0.6, + "tests/security/test_vault_lease_revoke.py": 0.0, + "tests/security/test_vulnerability_lookup.py": 1.7, + "tests/server/routes/test_k8s_roadmap_service.py": 0.1, + "tests/server/test_mattermost_slash_command.py": 0.4, + "tests/server/test_server.py": 0.8, + "tests/server/test_server_service.py": 2.7, + "tests/server/test_service_log_trace_ids.py": 0.1, + "tests/server/test_service_manager.py": 0.0, + "tests/server/test_service_memory.py": 9.5, + "tests/server/test_service_state_unkept.py": 0.1, + "tests/survey/test_survey_capabilities.py": 0.0, + "tests/survey/test_survey_dependencies.py": 0.0, + "tests/telemetry/test_ai_chaos_model.py": 0.7, + "tests/telemetry/test_config_env_overrides.py": 0.3, + "tests/telemetry/test_consolidation_serialization.py": 0.1, + "tests/telemetry/test_export_queue.py": 0.0, + "tests/telemetry/test_library_spans.py": 0.5, + "tests/telemetry/test_otlp_export.py": 0.1, + "tests/telemetry/test_otlp_exporter_contract.py": 0.4, + "tests/telemetry/test_roadmap_intake_implement_metrics.py": 16.2, + "tests/telemetry/test_roadmap_row_seconds.py": 0.2, + "tests/telemetry/test_roadmap_stage_steps.py": 5.0, + "tests/telemetry/test_sandbox_traces.py": 0.2, + "tests/telemetry/test_service_counter_series.py": 0.1, + "tests/telemetry/test_service_status.py": 0.3, + "tests/telemetry/test_telemetry.py": 0.6, + "tests/telemetry/test_telemetry_collector_export.py": 0.2, + "tests/telemetry/test_telemetry_instruments.py": 9.6, + "tests/telemetry/test_telemetry_llm_content.py": 0.8, + "tests/telemetry/test_telemetry_logfire.py": 0.4, + "tests/telemetry/test_telemetry_logging_bridge.py": 0.0, + "tests/telemetry/test_telemetry_metrics.py": 0.2, + "tests/telemetry/test_telemetry_semconv.py": 0.4, + "tests/telemetry/test_telemetry_shutdown_sync.py": 0.0, + "tests/telemetry/test_trace_propagation.py": 0.6, + "tests/telemetry/test_trace_span_resolution.py": 0.0, + "tests/telemetry/test_usage_errors.py": 3.5, + "tests/telemetry/test_waterfall.py": 0.1, + "tests/tf/test_cost.py": 0.1, + "tests/tf/test_tf_analysis.py": 1.1, + "tests/tools_lock/test_k8s_argo_workflows.py": 0.1, + "tests/tools_lock/test_k8s_cloudflared.py": 0.1, + "tests/tools_lock/test_openspec_contract.py": 0.6, + "tests/tools_lock/test_tools_lock.py": 0.2, + "tests/ui/test_ui_cli_tab_resolution.py": 0.0, + "tests/ui/test_ui_dashboard_app.py": 3.0, + "tests/ui/test_ui_dashboard_cli.py": 0.4, + "tests/ui/test_ui_dashboard_state_store.py": 0.1, + "tests/ui/test_ui_docker_inventory.py": 0.6, + "tests/ui/test_ui_docker_provider.py": 0.0, + "tests/ui/test_ui_focus_follows_tab.py": 1.8, + "tests/ui/test_ui_help.py": 0.5, + "tests/ui/test_ui_keeping_place.py": 5.4, + "tests/ui/test_ui_projections.py": 0.1, + "tests/ui/test_ui_refresh_coordination.py": 0.0, + "tests/ui/test_ui_review_provider.py": 0.1, + "tests/ui/test_ui_review_session_discovery.py": 0.1, + "tests/ui/test_ui_row_keys.py": 0.0, + "tests/ui/test_ui_shutdown.py": 1.3, + "tests/ui/test_ui_snapshot_age_staleness.py": 0.0, + "tests/ui/test_ui_sparklines.py": 0.0, + "tests/ui/test_ui_telemetry_panel.py": 0.6, + "tests/ui/test_ui_telemetry_provider.py": 0.0, + "tests/ui/test_ui_telemetry_source.py": 0.0, + "tests/ui/test_ui_valkey_provider.py": 0.3, + "tests/ui/test_ui_virtualized_log_buffer.py": 0.2, + "tests/ui/test_ui_waterfall_modal.py": 0.3, + "tests/ui/test_ui_widget_app_integration.py": 2.0, + "tests/valkey/test_valkey_cache_tier.py": 0.2, + "tests/watchers/test_watchers.py": 0.1 +} diff --git a/uv.lock b/uv.lock index 411eec859f..803fb9aa2e 100644 --- a/uv.lock +++ b/uv.lock @@ -914,7 +914,6 @@ dev = [ { name = "pytest-cov" }, { name = "pytest-mock" }, { name = "pytest-randomly" }, - { name = "pytest-split" }, { name = "pytest-timeout" }, { name = "pytest-xdist" }, { name = "ruff" }, @@ -1033,7 +1032,6 @@ dev = [ { name = "pytest-cov", specifier = "==7.1.0" }, { name = "pytest-mock", specifier = "==3.17.0" }, { name = "pytest-randomly", specifier = "==5.1.0" }, - { name = "pytest-split", specifier = "==0.11.0" }, { name = "pytest-timeout", specifier = "==2.4.0" }, { name = "pytest-xdist", specifier = "==3.8.0" }, { name = "ruff", specifier = "==0.17.4" }, @@ -3571,18 +3569,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/67/ef/9979eae8db530930873d15fb16043ef6d72b5042f2636de4d85568eb3df4/pytest_randomly-5.1.0-py3-none-any.whl", hash = "sha256:fb9004e6821422291087d0294fd62f45ff304094db11fbdff8f2fe1ed20764d8", size = 8969, upload-time = "2026-11-08T23:48:11.833Z" }, ] -[[package]] -name = "pytest-split" -version = "0.11.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "pytest" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/2f/16/8af4c5f2ceb3640bb1f78dfdf5c184556b10dfe9369feaaad7ff1c13f329/pytest_split-0.11.0.tar.gz", hash = "sha256:8ebdb29cc72cc962e8eb1ec07db1eeb98ab25e215ed8e3216f6b9fc7ce0ec2b5", size = 13421, upload-time = "2026-02-03T09:14:31.469Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/ae/a1/d4423657caaa8be9b31e491592b49cebdcfd434d3e74512ce71f6ec39905/pytest_split-0.11.0-py3-none-any.whl", hash = "sha256:899d7c0f5730da91e2daf283860eb73b503259cb416851a65599368849c7f382", size = 11911, upload-time = "2026-02-03T09:14:33.708Z" }, -] - [[package]] name = "pytest-timeout" version = "2.4.0"