You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Python tests job now runs its 1,978 tests on one pytest-xdist worker per CPU, four on its runner, instead of in one process. It was one of the jobs, each taking 4-5 min, that a pull request without Kind smoke waits on.
How.ci/scripts/run-python-tests.sh passes --numprocesses (one worker per CPU by default, SPACE_PYTHON_TEST_WORKERS to override, 0 for one process) and --dist loadfile.
--dist loadfile keeps each file's tests on one worker. Tests in a file can share module state. The run's Postgres server has one database, in which test_prune_cluster_artifacts.py, the only file that uses it, creates fixed table names. With this, no two of those tests run at once.
pytest-xdist 3.8.0, with its dependency execnet, joins the locked test group in pyproject.toml and uv.lock.
Spreading single tests instead of files would balance the workers better than loadfile's 84 s. With this change the job is no longer among the slowest of a pull request, so this PR keeps the safer grouping.
Stack
#1503: unblock the dependency checks; keep GitHub outages from failing PRs.
#1473: run the shell regression tests in parallel.
This PR: run the Python tests in parallel.
#1476: lint alone only the crates a change can affect.
Validation
This PR's CI ran all 1,978 tests on 4 workers: 1,972 passed and 6 were skipped, the same as one process on main.
Locally on macOS, 23 tests fail and 21 error on 4 workers. I checked one of those files, test_bench_sbx_balloon.py: it also hangs in one process (SPACE_PYTHON_TEST_WORKERS=0), so it does not run on macOS at all. The rest I did not re-run one at a time. Linux CI runs them all.
Severity and risk
Severity: does not apply; this is a CI speedup.
Risk:
A test that depends on another file's test running first in the same process, or on a fixed port or path, could fail on a worker of its own. SPACE_PYTHON_TEST_WORKERS=0 runs one process again.
One more dependency in the test group. It is pinned and locked like the others.
To roll back, revert this PR.
AI assistance: Claude Code drafted the change and this description.
Automatic approval is disabled by the configured approval policy for this pull request. Review comments and requests for changes continue normally.
Commit: 0f577d58ab09.
No actionable comments were generated in the recent review.
Walkthrough
The Python test dependency group now pins pytest-xdist to version 3.8.0. The test runner uses SPACE_PYTHON_TEST_WORKERS to set the worker count, with auto as the default and 0 for single-process execution. It passes --dist loadfile so tests from each file run on one worker.
Possibly related PRs
perplexityai/SPACE#1473: This PR applies environment-controlled parallel test execution to a separate CI test runner.
Merge Risk: Minimal · previous review 6873d
The change only alters CI test scheduling, with dependency wiring and the single-process fallback intact; no concrete merge-blocking risk remains.
Security architecture risk: Low · up to 6873d
The workers remain within the existing CI job without changes to deployment privileges or database provisioning. File-level scheduling and isolated database schemas limit interference. Cancellation cleanup and concurrent-job isolation are not fully established, but no introduced security failure was identified.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The demonstrated change affects execution concurrency within the existing Python CI job and access to its test database. The full comparison contains no IAM, secret, production service, or network-policy changes.
Trust Boundaries and Controls
observed — The worker override is passed as one quoted pytest argument, not evaluated as shell code. Database resource creation remains in the parent shell before worker execution.
Resilience and Maintainability Implications
observed — After successful container creation, an EXIT trap attempts forced removal on ordinary completion or subsequent failure. Cleanup errors are ignored, and the trap is installed after docker run. These pre-existing controls do not establish cleanup after forced termination or ownership isolation between concurrent invocations sharing a build identifier.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title uses the required lowercase area prefix "ci:", starts the summary with lowercase "run", and accurately describes the test parallelization change.
Description Follows The Pr Template
The description contains all required template items: a substantive "## Summary" section, a "## Validation" section naming the CI run and reporting its result, a "## Severity and risk" section with "d…
Bug Fixes Name A Regression Test
The pull request changes only the Python CI runner and test dependencies (ci/scripts/run-python-tests.sh, pyproject.toml, and uv.lock). It does not fix application behavior under crates/, `shi…
Weakened Safeguards Are Justified
The diff adds pytest-xdist, worker options, and explanatory comments. It does not remove tests, assertions, lint checks, CI steps, or repository guards. The runner still invokes pytest on the reposito…
Public-Safe Content
The title, description, and reviewed diff contain no credentials, tokens, private keys, internal or private links, cloud IDs/ARNs, personal workstation paths, production logs, incident details, or und…
Full details: Description Follows The Pr Template
Explanation
The description contains all required template items: a substantive "## Summary" section, a "## Validation" section naming the CI run and reporting its result, a "## Severity and risk" section with "does not apply" severity and concrete risks, and an "AI assistance:" line stating that Claude Code drafted the change and description.
Full details: Bug Fixes Name A Regression Test
Explanation
The pull request changes only the Python CI runner and test dependencies (ci/scripts/run-python-tests.sh, pyproject.toml, and uv.lock). It does not fix application behavior under crates/, shim/, or ui/, so the regression-test requirement does not apply.
Full details: Weakened Safeguards Are Justified
Explanation
The diff adds pytest-xdist, worker options, and explanatory comments. It does not remove tests, assertions, lint checks, CI steps, or repository guards. The runner still invokes pytest on the repository root with --strict-config and --strict-markers; --dist loadfile preserves file-level test grouping, and the comment gives the rationale for parallel execution.
Full details: Public-Safe Content
Explanation
The title, description, and reviewed diff contain no credentials, tokens, private keys, internal or private links, cloud IDs/ARNs, personal workstation paths, production logs, incident details, or undisclosed vulnerabilities. The changed files add pytest-xdist configuration and comments in ci/scripts/run-python-tests.sh (lines 106-125), the dependency in pyproject.toml:34, and standard public PyPI package URLs in uv.lock. The description links to a public GitHub Actions run and does not disclose sensitive content.
Recent review info
Automatic approval policy
Commit: 0f577d58ab09.
Setting
Effective value
Source
Automatic approvals
Disabled
Override 4
Merge risk
Low
Override 2
Security risk
Not set
Global configuration
Matching overrides (numbered as in the resolved configuration):
Any matching disabled override withholds approval, regardless of risk. Otherwise, the strictest explicitly set limit wins for each score. Limits omitted by all matching overrides inherit the global configuration.
Not set means no limit was configured after inheritance. Use @coderabbitai configuration to inspect the resolved settings and their sources.
Reviewing files that changed from the base of the PR and between 41e0ef0 and 6873d09.
Files ignored due to path filters: 1
uv.lock is excluded by !**/*.lock, !uv.lock
Files selected for processing: 2
ci/scripts/run-python-tests.sh
pyproject.toml
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 9 remain after this review.
Verified against b08bd967048aaa3c97a35545f1ac70824a9a9279.
What I ran. The pytest command from run-python-tests.sh on macOS with Python 3.11, once with --numprocesses 0 and once with 4 --dist loadfile. Postgres wasn't available, so that file's tests skipped, and I left out test_bench_sbx_balloon.py, which hangs here in one process too.
Both runs failed the same 26 tests, so on this machine none of the failures comes from parallel runs.
The 4-worker run took 64 s, against 227 s in one process.
This answers the description's open macOS question: the failures predate this PR.
What I read.
PRUNE_CLUSTER_ARTIFACTS_TEST_DATABASE_URL is read only by test_prune_cluster_artifacts.py, so --dist loadfile keeps the shared database to one worker.
No conftest.py exists, and no session-scoped fixture or session hook would now run once per worker.
The fixed ports and /tmp paths in the tests are strings passed to fakes, not sockets or files.
The Python tests job ran its 1,978 tests in one pytest process: 163 s of
tests in a 3.5 min job, one of the jobs a pull request without Kind
smoke waits on.
ci/scripts/run-python-tests.sh now runs one pytest-xdist worker per CPU.
--dist loadfile keeps each file's tests on one worker, so tests that
share a module's state, or the run's Postgres database
(test_prune_cluster_artifacts.py creates fixed table names), never run
at once. SPACE_PYTHON_TEST_WORKERS overrides the count; 0 runs in one
process. pytest-xdist 3.8.0 joins the locked test group.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Python tests job now runs its 1,978 tests on one pytest-xdist worker per CPU, four on its runner, instead of in one process. It was one of the jobs, each taking 4-5 min, that a pull request without Kind smoke waits on.
How.
ci/scripts/run-python-tests.shpasses--numprocesses(one worker per CPU by default,SPACE_PYTHON_TEST_WORKERSto override, 0 for one process) and--dist loadfile.--dist loadfilekeeps each file's tests on one worker. Tests in a file can share module state. The run's Postgres server has one database, in whichtest_prune_cluster_artifacts.py, the only file that uses it, creates fixed table names. With this, no two of those tests run at once.testgroup inpyproject.tomlanduv.lock.Spreading single tests instead of files would balance the workers better than
loadfile's 84 s. With this change the job is no longer among the slowest of a pull request, so this PR keeps the safer grouping.Stack
Validation
test_bench_sbx_balloon.py: it also hangs in one process (SPACE_PYTHON_TEST_WORKERS=0), so it does not run on macOS at all. The rest I did not re-run one at a time. Linux CI runs them all.Severity and risk
Severity: does not apply; this is a CI speedup.
Risk:
SPACE_PYTHON_TEST_WORKERS=0runs one process again.AI assistance: Claude Code drafted the change and this description.
🤖 Generated with Claude Code