Skip to content

ci(gate): run the checks of committed files as devops ci rows - #3557

Merged
dan-petty merged 2 commits into
mainfrom
ci/2164-checks-as-ci-rows
Nov 5, 2026
Merged

dan-petty merged 2 commits into
mainfrom
ci/2164-checks-as-ci-rows

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Some pytest tests checked committed files and tool configuration. They started ruff, ast-grep, kubectl kustomize or a fresh interpreter, or they parsed every file under tests/, and each xdist worker repeated that work. By the rule of ADR 0007 as #2143 amends it, such a check is a row of devops ci.

The checks now run once, from tests/gate/:

  • lint also checks the resolved Ruff settings, the Ruff walk against tracked files, and the two caps.
  • constructs also runs ast-grep test and the construct gate check, with one scan for all rules.
  • New rows: k8s (each kustomization rendered once), test-tree, startup-imports (55 probes, four at a time, CPU time printed) and swallowed-failures.

The pytest files keep only cases that test the logic of a check with canned input or a small tree. The capability ci-gate-rows records the rule. Follow-up: #3550.

Closes #2164

Change: openspec/changes/archive/2026-11-05-2164-checks-of-committed-files-run-as-ci-rows/

Checks of the Ruff configuration, the ast-grep rules, the Kubernetes
manifests, the startup imports, the swallowed-failures ratchet and the
Python files under tests/ ran as pytest tests that start ruff, ast-grep,
kubectl or a fresh interpreter, or parse every file on each worker.
They are rows of devops ci now, in tests/gate/, and run once.
@dan-petty dan-petty added type/infra Type infra: the build, CI, images or cluster scope/gate The quality gate and its checks labels Nov 5, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Test results (host with a load of 8 to 40; the figures move with the load)

Failing case for each row (one change to a committed file, then the row, then the file restored):

Row Change Result
lint max-complexity = 11 in pyproject.toml exit 1: linter.mccabe.max_complexity: 11, not 10, and the probe finds no C901
constructs (ast-grep test) a valid case that breaks net-port-table exit 4: FAIL net-port-table
constructs (gate, severity) severity: warning in a rule exit 1: [net-port-table] severity: warning, not error
constructs (gate, scan) pattern of a rule no longer matches its violation exit 1: the scan names the rule
k8s suspend: false in k8s/devops/cronjob-runner.yaml exit 1: the runner check names the field
test-tree a helper under tests/support that prints on import exit 1: path:line of the statement
startup-imports import textual in devops_cli/entry.py exit 1: names textual and the ten slowest imports for each argv
swallowed-failures a new blind except in src/devops_cli/core/clock.py exit 1: S110 and BLE001 with the line

Full uv run devops ci --check --no-cache (7 m 50 s, all rows run at once): every new row passes. Row times under that load: lint 52 s, constructs 61 s, k8s 70 s, test-tree 147 s, startup-imports 117 s, swallowed-failures 67 s. Four tests fail on this host and on main alike (test_find_project_config_path_skips_directory, test_mark_only_commands_under_global_dry_run, test_get_ssh_key_prefix_resolution, test_the_direct_executor_refuses_a_network_profile...): they read /tmp/config.yaml, the checkout name and a local popeye.

Pytest run of the touched files (pytest -n 4, same 19 files before and the matching set after; two alternating pairs):

tests pytest time CPU time (user + system)
before, run 1 748 252.8 s 418.7 s
after, run 1 559 138.7 s 229.0 s
before, run 2 748 172.7 s 479.8 s
after, run 2 559 161.1 s 193.8 s

CPU time falls by 45 to 60 percent. The pytest time of the Tests & Coverage shards falls by the same share of these files; the rows moved to Static Analysis.

Startup row, CPU time of the probes, three runs (old file: 129, 93 and 76 s; row: 59, 70 and 71 s at a lower load). The goal of #2369 (half of the old CPU time) is not reached: #3550 holds it.

Job times. The first run of this pull request gives the CI times after the change. Before: see devops ci job-time on main. Rows added to Static Analysis: k8s, test-tree, startup-imports and swallowed-failures run at the same time as the other rows.

Acceptance notes. devops ci --help and the generated references list commands, not rows, as for the git and test-settings rows; devops ci --only <wrong> lists the valid row names. Tests that build a tree under tmp_path and start kubectl kustomize or git to test src/ (check_argocd_gate, image pins, deploy-stack) stay: they check no committed file.

@dan-petty

Copy link
Copy Markdown
Owner Author

CI job times on the GitHub runner

Before: two pull request runs of CI Quality Gate that passed on the same day, without this change. After: the run of this pull request.

Job Before (2 runs) After
Static Analysis 111 s, 121 s 149 s
Tests & Coverage, shard 1 214 s, 214 s 230 s
Tests & Coverage, shard 2 225 s, 215 s 208 s
Tests & Coverage, shard 3 213 s, 202 s 133 s
Tests & Coverage, shard 4 200 s, 212 s 158 s
Tests & Coverage (join) 47 s, 49 s 49 s

The four shards average 182 s after against 212 s before (the split of pytest-split has not yet learned the new durations, so the shards are uneven). Static Analysis grows by about 30 s for the four new rows and the extra commands of lint and constructs. Every job stays under 5 minutes. All required checks pass with no install step: the rows use uv sync tools and the kubectl of the runner image.

@dan-petty
dan-petty marked this pull request as ready for review November 5, 2026 00:41
@dan-petty
dan-petty merged commit 90a87a5 into main Nov 5, 2026
23 checks passed
@dan-petty
dan-petty deleted the ci/2164-checks-as-ci-rows branch November 5, 2026 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/gate The quality gate and its checks type/infra Type infra: the build, CI, images or cluster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci(gate): checks of committed files and tool configuration run as devops ci rows, not as pytest tests that start the tool

1 participant