Problem Statement
devops ci currently takes ~3m 15s to complete. Profiling revealed three primary bottlenecks:
- Hardcoded
--maxprocesses=4 throttling pytest xdist workers, leaving up to 75% of available CPU cores idle on multi-core systems.
- Pathological unit tests with unmocked socket/network probes and unbounded workspace directory traversal (
test_k8s_bootstrap_success taking 78s, test_repomap_cli taking 70s, test_ci.py taking 46s), consuming over 250s of CPU time.
- Synchronous sequential execution of
docs_fix (DocGenerator.check_docs) running for 16.5s before background concurrent tasks (including pytest) are launched.
Acceptance Criteria
- Dynamically scale pytest xdist workers based on available CPU cores (
min(os.cpu_count() or 4, 16)), removing the hardcoded --maxprocesses=4 limit.
- Isolate test hotspots with proper mocking:
- Mock
devops_cli.commands.k8s.networking.configure_urls in tests/test_k8s_context.py (dropping from 78s to <0.05s).
- Pass isolated
tmp_path target in tests/test_ai_repomap.py (dropping from 70s to <0.1s).
- Mock workspace fingerprinting in
tests/test_ci.py (dropping from 46s to <0.05s).
- Reorder pipeline dispatch so that
pytest is launched immediately without waiting for synchronous docs checks.
- Maintain 100% test pass rate, code coverage >= 90%, and strict complexity M <= 10.
Problem Statement
devops cicurrently takes ~3m 15s to complete. Profiling revealed three primary bottlenecks:--maxprocesses=4throttling pytest xdist workers, leaving up to 75% of available CPU cores idle on multi-core systems.test_k8s_bootstrap_successtaking 78s,test_repomap_clitaking 70s,test_ci.pytaking 46s), consuming over 250s of CPU time.docs_fix(DocGenerator.check_docs) running for 16.5s before background concurrent tasks (including pytest) are launched.Acceptance Criteria
min(os.cpu_count() or 4, 16)), removing the hardcoded--maxprocesses=4limit.devops_cli.commands.k8s.networking.configure_urlsintests/test_k8s_context.py(dropping from 78s to <0.05s).tmp_pathtarget intests/test_ai_repomap.py(dropping from 70s to <0.1s).tests/test_ci.py(dropping from 46s to <0.05s).pytestis launched immediately without waiting for synchronous docs checks.