polyrun 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +4 -2
- data/docs/QUALITY.md +80 -0
- data/docs/QUALITY_CONFIGURATION.md +95 -0
- data/lib/polyrun/cli/ci_shard_run_command.rb +1 -1
- data/lib/polyrun/cli/graph_command.rb +68 -0
- data/lib/polyrun/cli/help.rb +5 -1
- data/lib/polyrun/cli/helpers.rb +3 -2
- data/lib/polyrun/cli/mutation_command.rb +67 -0
- data/lib/polyrun/cli/quality_commands.rb +65 -0
- data/lib/polyrun/cli/run_shards_plan_options.rb +1 -1
- data/lib/polyrun/cli/tool_options.rb +48 -0
- data/lib/polyrun/cli.rb +17 -1
- data/lib/polyrun/config/effective.rb +9 -0
- data/lib/polyrun/config/resolver.rb +9 -0
- data/lib/polyrun/config/schema.rb +8 -3
- data/lib/polyrun/config/suite.rb +6 -1
- data/lib/polyrun/config/tool_defaults.rb +42 -0
- data/lib/polyrun/config/tool_validation.rb +79 -0
- data/lib/polyrun/config/tools.rb +120 -0
- data/lib/polyrun/config.rb +6 -4
- data/lib/polyrun/graph/client.rb +64 -0
- data/lib/polyrun/graph/error.rb +13 -0
- data/lib/polyrun/graph/index.rb +75 -0
- data/lib/polyrun/graph/inspect.rb +58 -0
- data/lib/polyrun/graph/plan.rb +134 -0
- data/lib/polyrun/graph/planner.rb +117 -0
- data/lib/polyrun/graph/syntax.rb +114 -0
- data/lib/polyrun/graph/transaction.rb +81 -0
- data/lib/polyrun/graph/worker.rb +55 -0
- data/lib/polyrun/graph/workspace.rb +117 -0
- data/lib/polyrun/minitest_support.rb +1 -1
- data/lib/polyrun/mutation/candidates.rb +91 -0
- data/lib/polyrun/mutation/operators.rb +51 -0
- data/lib/polyrun/mutation/runner.rb +131 -0
- data/lib/polyrun/mutation/subjects.rb +88 -0
- data/lib/polyrun/quality/command.rb +84 -0
- data/lib/polyrun/quality/measure.rb +38 -0
- data/lib/polyrun/quality/observe.rb +53 -0
- data/lib/polyrun/quality/observe_hook.rb +103 -0
- data/lib/polyrun/quality/sandbox.rb +70 -0
- data/lib/polyrun/rspec_support.rb +1 -1
- data/lib/polyrun/spec_quality/config.rb +8 -3
- data/lib/polyrun/spec_quality.rb +3 -4
- data/lib/polyrun/version.rb +1 -1
- data/polyrun.gemspec +1 -1
- data/sig/polyrun/config.rbs +2 -2
- metadata +29 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 84cb0537393d031d9276aa317c07bab4dfc65c19222baad51b1b21eb432ba7cd
|
|
4
|
+
data.tar.gz: 5c1b9c46c8fd240d7da11ae1dfb43e1aa06241bddb2e74d24f60b3d62b1a41c2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7b598b30610deb79390ed8223a7fa8e5f53999126dab57550e904232115abaa26047b5edf4e2ca9b57cacadc59bedab2880b9705bf9be0749f103b118cefcb0a
|
|
7
|
+
data.tar.gz: d765e66f27894d7c73386e9da3391bf5078399a83e8d3d7824fdc1f34ddc56881f8a864d76a06cba88b9058d09aaf1b7cf969ed2b7a4ac9ef97d4c716aae66f0
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 3.1.0 (2026-11-14)
|
|
4
|
+
|
|
5
|
+
- Run graph indexing, curated mutation, observe, and measure against this repository (`make quality-self`, quality CI).
|
|
6
|
+
- Stage the project-root `coverage` report tree by path so nested library directories named `coverage` still copy into mutation and graph sandboxes.
|
|
7
|
+
- Expand absolute `--root` only when the flag is present so a relative project path is not resolved against itself.
|
|
8
|
+
- Tighten mutation and staging contracts used by the self gate; drop a redundant `master.key` basename check covered by `.key` suffix exclusion.
|
|
9
|
+
- Add experimental opt-in `graph index`, `inspect`, `plan`, `check`, and `apply` commands for guarded Ruby source edits, with staged test commands and recovery after interrupted writes.
|
|
10
|
+
- Add Polyrun's experimental mutation engine with selectable operators, a clean baseline, isolated test runs, bounded workers, deterministic shards, and explicit undetected or incomplete results.
|
|
11
|
+
- Add opt-in `observe` for bounded Ruby call reports and `measure` for command resource reports and ceilings.
|
|
12
|
+
- Add shared root-level defaults and validated feature and suite settings for activation, commands, source filters, resource budgets, reports, and per-example quality. Inspect effective settings with `polyrun config`.
|
|
13
|
+
- Resolve configured per-example quality activation from the integration's project root.
|
|
14
|
+
|
|
3
15
|
## 3.0.1 (2026-11-12)
|
|
4
16
|
|
|
5
17
|
- Stop writing `simplecov_version` from `Polyrun::VERSION` into coverage JSON meta. Keep the key only when a fragment already carried a real SimpleCov value; use `polyrun_version` for Polyrun.
|
data/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Ruby gem for parallel test runs, merged coverage (SimpleCov-compatible JSON to JSON, LCOV, Cobertura, or console output), CI reporting (JUnit, timing), and parallel-test hygiene (fixtures, snapshots, per-shard databases, asset preparation). Ship it as one development dependency: no runtime gem dependencies beyond the standard library and vendored code.
|
|
4
4
|
|
|
5
|
+
Use `polyrun graph` for guarded Ruby graph edits, `polyrun mutate` for mutation testing, and `polyrun observe` / `measure` for Ruby call evidence and command resource reports. These tools are opt-in, share configurable defaults, and are implemented inside Polyrun using Ruby's standard libraries. See [Quality tools](docs/QUALITY.md) for setup, CI recipes, and limits (RFC-0010).
|
|
6
|
+
|
|
5
7
|
Design changes go through `rfcs/` (RFC 0001).
|
|
6
8
|
|
|
7
9
|
## Why?
|
|
@@ -166,9 +168,9 @@ Tests include subprocess CLI coverage (`spec/polyrun/cli_spec.rb`: merge-coverag
|
|
|
166
168
|
Merge performance defaults align with `spec/polyrun/coverage/merge_scale_spec.rb` (~110 files × 310 lines per fragment):
|
|
167
169
|
|
|
168
170
|
```bash
|
|
169
|
-
ruby
|
|
171
|
+
ruby benchmarks/merge_coverage.rb
|
|
170
172
|
bundle exec rake bench_merge
|
|
171
|
-
# MERGE_FRAGMENTS=16 MERGE_REPS=2 ruby
|
|
173
|
+
# MERGE_FRAGMENTS=16 MERGE_REPS=2 ruby benchmarks/merge_coverage.rb
|
|
172
174
|
```
|
|
173
175
|
|
|
174
176
|
The script benchmarks `merge_two`, balanced `merge_blob_tree` (same reduction as `merge-coverage` / `merge_files`), a naive left-fold, JSON on disk via `merge_files`, and `merge_fragments` with `meta` and `polyrun_coverage_groups` (group recomputation).
|
data/docs/QUALITY.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Graph edits and quality checks
|
|
2
|
+
|
|
3
|
+
Polyrun implements Ruby graph indexing, guarded source edits, mutation generation, execution, observation, and command measurements within the gem. These commands use Ruby standard libraries, including Prism. No additional graph or mutation package, executable, source checkout, or database is required. The consuming project's test command still needs its ordinary dependencies.
|
|
4
|
+
|
|
5
|
+
The commands are opt-in. See [Quality configuration](QUALITY_CONFIGURATION.md) for activation, shared defaults, per-feature settings, and every configurable limit.
|
|
6
|
+
|
|
7
|
+
## Graph workflow
|
|
8
|
+
|
|
9
|
+
polyrun graph --enable index --json
|
|
10
|
+
polyrun graph --enable inspect 'Account#save' --calls --callers --callees --json
|
|
11
|
+
polyrun graph --enable inspect --control-plane --json
|
|
12
|
+
polyrun graph --enable plan change.json --json
|
|
13
|
+
polyrun graph --enable check PLAN --json --prove -- bundle exec rspec
|
|
14
|
+
polyrun graph --enable apply PLAN --json
|
|
15
|
+
|
|
16
|
+
Every graph command accepts `--root PATH` and `--timeout SECONDS`. State is stored under `.polyrun/graph`. Indexing parses source without executing it. It scans `lib` and `app` when present; otherwise it scans the project excluding development artifacts. The JSON index reuses unchanged source snapshots. Method identifiers, call identifiers, byte ranges, source fingerprints, and provenance describe the indexed source. Statically resolved edges are labeled `static_guess`; dynamic dispatch remains `unknown`. Lifecycle and signal inspection is a naming heuristic, not proof of runtime control flow.
|
|
17
|
+
|
|
18
|
+
Selectors accept an exact subject such as `Account#save` or `Account.build`, a node identifier, or `path:lib/account.rb#save`. A bare method name must resolve uniquely. Ambiguous selectors fail rather than choosing a definition.
|
|
19
|
+
|
|
20
|
+
A change description is JSON or safe YAML:
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"snapshot": "snapshot-HASH",
|
|
25
|
+
"operations": [{
|
|
26
|
+
"op": "replace_call_name",
|
|
27
|
+
"node": "call-ID",
|
|
28
|
+
"expect": {"name": "old_name", "fingerprint": "HASH"},
|
|
29
|
+
"replacement": "new_name"
|
|
30
|
+
}]
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Take the snapshot and call fields from index and inspect output. Planning supports this operation only, with a default ceiling of 1,000 distinct call edits. It validates expected tokens, applies byte edits to an isolated project copy, checks Ruby syntax, and emits a bounded diff. It does not rename every definition or infer dispatch equivalence.
|
|
35
|
+
|
|
36
|
+
Check verifies that sources are unchanged, syntax is valid, and the intended staged hashes match. An optional prove command runs in the staged tree; its Gemfile and library path point there. Tests that explicitly load an outside checkout cannot prove the staged edit. A successful check creates a receipt binding metadata and all staged files. A failed prove revokes previous approval. Apply rejects missing receipts, changed staged files, changed originals, added source files, symbolic links, and overlapping graph commands.
|
|
37
|
+
|
|
38
|
+
Apply uses per-file atomic replacement with backups and a recovery journal. An ordinary write failure restores originals. If the process stops during apply, the next apply attempts recovery before verifying that sources are unchanged. Recovery refuses to overwrite an unrelated edit. This is a cooperative local editing protocol; it does not provide a whole-tree atomic filesystem commit, protection from concurrent non-cooperating writers, or certified power-loss durability.
|
|
39
|
+
|
|
40
|
+
Rebuild a deleted index from source with `graph index`. Recreate deleted plans from the change description and check them again; receipts cannot be reconstructed as approvals.
|
|
41
|
+
|
|
42
|
+
## Mutation testing
|
|
43
|
+
|
|
44
|
+
polyrun mutate --enable --subject 'Account#save' --workers 2 --timeout 120 -- bundle exec rspec
|
|
45
|
+
polyrun mutate --enable --subjects-file subjects.txt --shard 1 --total 3 -- ruby -Ilib test/probe.rb
|
|
46
|
+
polyrun mutate --enable --plan PLAN --max-mutations 1000 -- ruby -Ilib test/probe.rb
|
|
47
|
+
polyrun mutate --enable --observed tmp/observed.json -- ruby -Ilib test/probe.rb
|
|
48
|
+
|
|
49
|
+
Arguments after `--` are the actual test command. Polyrun generates syntax-valid mutations of literals, comparison and arithmetic operators, and method bodies using Prism. The Ruby API accepts operator objects implementing `call(node)` for extension. This initial operator set does not cover every Ruby construct or establish semantic equivalence.
|
|
50
|
+
|
|
51
|
+
Subjects are exact method subjects or wildcard patterns using `*`. Subjects are deduplicated and sorted before deterministic one-based sharding. Missing or ambiguous definitions fail. There is no implicit whole-program run. Empty CI shards succeed with zero results. Plan selection targets methods containing the planned calls; it does not apply the plan first. Observed selection requires a complete observation.
|
|
52
|
+
|
|
53
|
+
A successful baseline runs before mutations in a separate project copy. Each unique mutation then runs in a new isolated copy, with one source edit. Exit 0 means the suite did not detect the edit (report code `SURVIVED`); exit 1 means the suite detected it (report code `KILLED`). Timeouts, excessive output, unavailable commands, signals, and other exit statuses are incomplete results and never count as detections. Any undetected or incomplete result fails the invocation. The command's exit-status contract matters: a test runner that uses exit 1 for unrelated setup errors cannot distinguish those errors from test failures.
|
|
54
|
+
|
|
55
|
+
The default worker ceiling is 32. The default mutation ceiling is 1,000; both are configurable. Each command defaults to a 300-second timeout and 1 MiB combined output; retained diagnostics are limited to 16 MiB. Default project staging permits at most 10,000 regular files and 64 MiB, with at most 1 GiB cumulative copied bytes per mutation invocation. Hidden directories, dependency caches, build outputs, symbolic links, and key files are excluded. The project-root `coverage` report tree is excluded by path so nested library directories named `coverage` still stage. Projects depending on excluded inputs need an explicit self-contained test setup.
|
|
56
|
+
|
|
57
|
+
Polyrun runs these tools against its own checkout. `make graph` indexes `lib`. `make mutate`, `make observe`, and `make measure` run through `polyrun --suite self` with a shared focused quality-spec command. `make quality-self` runs all four. Graph stays enabled in the root config. Mutation, observe, and measure stay disabled at the root so nested quality CLI specs do not inherit the self workload; the `self` suite enables them. Mutation uses the operator family as the CI green gate. A full-operator assessment of the same subjects closed detectable suite gaps and accepted two behavioral equivalents; details are in the undetected-mutation assessment review. The quality CI job runs `make quality-self`.
|
|
58
|
+
|
|
59
|
+
The JSON report names the Polyrun engine, baseline, selected subjects, executed mutations, per-case result, and aggregate `killed` / `survived` counts (detected vs undetected). `--output PATH` also writes it to a file. Counts are unavailable when the run is incomplete.
|
|
60
|
+
|
|
61
|
+
## CI composition
|
|
62
|
+
|
|
63
|
+
Run the project's normal parallel suite and coverage merge before a narrower mutation selection:
|
|
64
|
+
|
|
65
|
+
bundle exec polyrun run-shards --workers 2 --merge-coverage -- bundle exec rspec
|
|
66
|
+
bundle exec polyrun mutate --enable --subjects-file subjects.txt --shard 1 --total 3 --workers 2 --output mutation-1.json -- bundle exec rspec
|
|
67
|
+
|
|
68
|
+
Repeat the mutation job for shard numbers 1 through 3 with the same subject file. Mutation shard numbers are one-based; the existing worker environment uses its own documented index convention. Keep each job's report as an artifact and use the command's status as its gate. Use `graph check PLAN --prove -- bundle exec rspec` to prove a staged edit before apply. These commands stay independently useful; a graph plan is not required for mutation testing.
|
|
69
|
+
|
|
70
|
+
## Observation and measurement
|
|
71
|
+
|
|
72
|
+
polyrun observe --enable --output tmp/observed.json -- ruby -Ilib test/probe.rb
|
|
73
|
+
polyrun measure --enable --label tests --output tmp/measurement.json -- bundle exec rspec
|
|
74
|
+
polyrun measure --enable --ceilings ceilings.json -- ruby -Ilib test/probe.rb
|
|
75
|
+
|
|
76
|
+
Observe injects an opt-in Ruby TracePoint hook through RUBYOPT. It records bounded call counts, named subjects, and relative paths within the requested root. It skips anonymous owners, records no arguments or receiver values, and disables injection into descendants. Missing or truncated observations are not complete mutation selections. Observation proves calls in that run, not test coverage or static dispatch.
|
|
77
|
+
|
|
78
|
+
Measure reports wall time, orchestrator CPU, waited child CPU, an orchestrator resident-memory sample, and command status. Memory is not child peak RSS; CPU is only an energy proxy. Ceilings fail closed for invalid or unavailable metrics. Local pressure commands, isolated full-process RSS measurements, and their limits are documented in [the benchmark binding](../benchmarks/quality-binding.md).
|
|
79
|
+
|
|
80
|
+
All child commands use argument arrays, bounded output, a finite timeout, and process-group cancellation. Project tests and prove commands execute with the caller's authority. Copies isolate source edits, not filesystem or network access. Reports may contain project paths and command diagnostics; review them before sharing.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Quality tool configuration
|
|
2
|
+
|
|
3
|
+
Graph, mutation, observation, and measurement are disabled by default. Enable a feature in `polyrun.yml`, or pass `--enable` for one invocation. `--no-enable` disables it for that invocation even when configuration or the environment enables it. Shared defaults never enable features. Existing test workers do not run these tools automatically.
|
|
4
|
+
|
|
5
|
+
All graph and mutation implementation ships in the Polyrun gem. No other graph or mutation package, executable, database, or source checkout is needed. Test commands still use the consuming project's ordinary dependencies.
|
|
6
|
+
|
|
7
|
+
## Root defaults and feature settings
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
workers: 2
|
|
11
|
+
timeout: 120
|
|
12
|
+
command: [bundle, exec, rspec]
|
|
13
|
+
max_output_bytes: 1048576
|
|
14
|
+
source_roots: [lib, app]
|
|
15
|
+
max_source_files: 100000
|
|
16
|
+
max_source_file_bytes: 10485760
|
|
17
|
+
max_source_bytes: 67108864
|
|
18
|
+
staging:
|
|
19
|
+
max_files: 10000
|
|
20
|
+
max_bytes: 67108864
|
|
21
|
+
exclude: [vendor, node_modules, tmp, log, pkg, benchmarks]
|
|
22
|
+
exclude_paths: [coverage]
|
|
23
|
+
include_hidden: [.rspec, .ruby-version]
|
|
24
|
+
graph:
|
|
25
|
+
enabled: true
|
|
26
|
+
state_dir: .polyrun/graph
|
|
27
|
+
timeout: 60
|
|
28
|
+
max_nodes: 250000
|
|
29
|
+
max_operations: 1000
|
|
30
|
+
max_diff_bytes: 524288
|
|
31
|
+
max_plan_bytes: 1048576
|
|
32
|
+
max_receipt_files: 100000
|
|
33
|
+
mutation:
|
|
34
|
+
enabled: true
|
|
35
|
+
subjects: ['Account#save']
|
|
36
|
+
operators: [literal, operator, body]
|
|
37
|
+
max_workers: 32
|
|
38
|
+
max_mutations: 1000
|
|
39
|
+
max_subjects: 10000
|
|
40
|
+
max_report_bytes: 16777216
|
|
41
|
+
max_copy_bytes: 1073741824
|
|
42
|
+
quality:
|
|
43
|
+
observe:
|
|
44
|
+
enabled: true
|
|
45
|
+
output: tmp/observed.json
|
|
46
|
+
max_entries: 10000
|
|
47
|
+
max_artifact_bytes: 16777216
|
|
48
|
+
command: [ruby, -Ilib, test/probe.rb]
|
|
49
|
+
measure:
|
|
50
|
+
enabled: true
|
|
51
|
+
label: tests
|
|
52
|
+
output: tmp/measurement.json
|
|
53
|
+
ceilings: {wall_s: 120}
|
|
54
|
+
spec_quality:
|
|
55
|
+
enabled: false
|
|
56
|
+
min_line_churn: 50
|
|
57
|
+
min_query_count: 20
|
|
58
|
+
sample: 1.0
|
|
59
|
+
strict: false
|
|
60
|
+
profile: [cpu, mem]
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Create parent directories for configured outputs before running commands. Arrays of command arguments execute directly; no shell splitting or interpolation is applied. A command after `--` replaces the configured command. CLI subjects or observed files replace their configured lists; repeated CLI selections accumulate within that invocation. Other arrays replace inherited arrays; mappings merge recursively.
|
|
64
|
+
|
|
65
|
+
The precedence is CLI, environment, feature settings, shared root settings, defaults. Each shared setting has one root location. The `global` section is rejected, including inside selected suites. Selected `suites` overlays merge before resolution; `--config`, `POLYRUN_CONFIG`, and `--suite` work with all tool commands. `POLYRUN_WORKERS` overrides worker defaults for mutations and existing parallel workers. Root `timeout` also supplies existing worker timeouts; their specific `--worker-timeout` and `POLYRUN_WORKER_TIMEOUT_SEC` remain overrides. Root-level `root` and `command` defaults apply to the new tool commands; existing workers retain their working-directory and command conventions.
|
|
66
|
+
|
|
67
|
+
`POLYRUN_GRAPH`, `POLYRUN_MUTATION`, and `POLYRUN_QUALITY` enable their corresponding commands with `1`, `true`, `yes`, or `on`; `0`, `false`, `no`, or `off` disable them. `POLYRUN_TIMEOUT` and `POLYRUN_MAX_OUTPUT_BYTES` supply shared environment overrides. Invalid values fail instead of silently selecting another setting.
|
|
68
|
+
|
|
69
|
+
A command's `--root` selects automatic project configuration discovery. Relative root settings are resolved against that discovery directory or the invoking directory. Output and subject-file paths resolve against the effective root. Source roots and graph state directories must stay inside the project. Changing source scope can invalidate an existing plan; selecting another state directory selects another local index and plan collection.
|
|
70
|
+
|
|
71
|
+
## Complete settings and validation
|
|
72
|
+
|
|
73
|
+
Inspect every supported key and effective default without enabling the tool:
|
|
74
|
+
|
|
75
|
+
polyrun config graph
|
|
76
|
+
polyrun config mutation
|
|
77
|
+
polyrun config quality.observe
|
|
78
|
+
polyrun config quality.measure
|
|
79
|
+
polyrun config workers
|
|
80
|
+
polyrun validate
|
|
81
|
+
polyrun --suite review config mutation
|
|
82
|
+
|
|
83
|
+
Root shared settings include `root`, `workers`, `timeout`, `command`, `output`, `max_output_bytes`, `max_input_bytes`, `max_artifact_bytes`, `source_roots`, `source_fallback`, `source_exclude`, `max_nodes`, `max_source_files`, `max_source_file_bytes`, `max_source_bytes`, and `staging`. Activation stays in feature blocks; root defaults never enable a feature. A feature accepts only keys it uses: source and staging settings apply to graph and mutation; workers apply to mutation. `quality` shares execution defaults for observe and measure before their own overrides. Irrelevant feature keys are errors, while shared root defaults are applied only where relevant.
|
|
84
|
+
|
|
85
|
+
Graph writes `output` in the selected CLI format. Graph also accepts `json`, `calls`, `callers`, `callees`, `control_plane`, and `prove`, in addition to the limits shown above. Configure `prove: true` and a command to run behavioral checks without repeating the command after `--`. `--no-prove` runs syntax checks only. Graph JSON and inspection flags have corresponding `--no-` overrides.
|
|
86
|
+
|
|
87
|
+
Mutation also accepts `subjects_file`, `observed`, `plan`, `shard`, `total`, and `output`. Mutation limits and worker ceilings are positive configurable values; increasing them is an explicit resource-budget decision. Shard numbering remains one-based. Operators select the built-in rule families; Ruby callers may provide additional operator objects through the runner API.
|
|
88
|
+
|
|
89
|
+
Unknown keys, malformed types, escaping source/state paths, and nonpositive resource bounds fail validation before execution. Output truncation, process cleanup, unchanged-source checks, symlink rejection, receipt integrity, and key-file exclusions remain invariants. Limits do not turn copied test execution into an OS sandbox.
|
|
90
|
+
|
|
91
|
+
## Existing per-example quality collection
|
|
92
|
+
|
|
93
|
+
`quality.spec_quality` accepts the settings documented in [SPEC_QUALITY.md](SPEC_QUALITY.md), including collection filters, thresholds, profiling, sampling, and report gates. Root `source_roots` supplies its `track_under` fallback. The existing environment activation and disable switches still apply; `POLYRUN_SPEC_QUALITY_DISABLE` always prevents collection. `POLYRUN_QUALITY` controls the observe and measure commands, not per-example collection.
|
|
94
|
+
|
|
95
|
+
The default dedicated spec-quality file provides settings below the main file's `quality.spec_quality` block. An explicitly selected dedicated file overrides the main block, followed by environment and explicit Ruby API overrides. Enabling settings does not install test hooks: use the existing RSpec, Minitest, or Quick integration. Direct graph and mutation Ruby API calls are explicit opt-in; pass a resolved `Polyrun::Config::Tools.resolve` mapping as `settings:` to use the same defaults and validation.
|
|
@@ -67,7 +67,7 @@ module Polyrun
|
|
|
67
67
|
config_path: config_path,
|
|
68
68
|
matrix_shard_index: mx,
|
|
69
69
|
matrix_shard_total: mt,
|
|
70
|
-
worker_timeout_sec: env_worker_timeout_sec,
|
|
70
|
+
worker_timeout_sec: env_worker_timeout_sec(cfg),
|
|
71
71
|
worker_idle_timeout_sec: env_worker_idle_timeout_sec
|
|
72
72
|
}
|
|
73
73
|
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
require_relative "../graph/error"
|
|
3
|
+
|
|
4
|
+
module Polyrun
|
|
5
|
+
class CLI
|
|
6
|
+
module GraphCommand
|
|
7
|
+
private
|
|
8
|
+
|
|
9
|
+
def cmd_graph(argv)
|
|
10
|
+
options = {}
|
|
11
|
+
json = argv.include?("--json")
|
|
12
|
+
explicit = extract_tool_command!(argv)
|
|
13
|
+
positional = parse_graph_options(argv, options)
|
|
14
|
+
settings = configured_tool("graph", options)
|
|
15
|
+
require_relative "../graph/client"
|
|
16
|
+
json = settings["json"]
|
|
17
|
+
proving = (positional.first == "check") ? settings["prove"] : options.fetch(:prove, false)
|
|
18
|
+
prove = proving ? tool_command(settings, explicit) : (explicit || [])
|
|
19
|
+
validate_graph_arguments!(positional, proving, prove)
|
|
20
|
+
forwarded = %w[json calls callers callees control_plane].filter_map { |flag| "--#{flag.tr("_", "-")}" if settings[flag] }
|
|
21
|
+
result = Graph::Client.new(root: settings["root"], settings: settings).call(positional + forwarded, prove: prove)
|
|
22
|
+
emit_graph_result(result, settings["output"])
|
|
23
|
+
rescue Graph::Error => e
|
|
24
|
+
graph_diagnostic(e.code, e.message, json)
|
|
25
|
+
e.exitstatus
|
|
26
|
+
rescue OptionParser::ParseError, ArgumentError, KeyError, SystemCallError, Psych::Exception => e
|
|
27
|
+
graph_diagnostic("INVALID_ARGUMENT", e.message, json)
|
|
28
|
+
2
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def parse_graph_options(argv, options)
|
|
32
|
+
parser = OptionParser.new do |opts|
|
|
33
|
+
common_tool_options(opts, options)
|
|
34
|
+
%w[json calls callers callees control-plane prove].each do |flag|
|
|
35
|
+
opts.on("--[no-]#{flag}") { |value| options[flag.tr("-", "_").to_sym] = value }
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
parser.parse(argv)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def validate_graph_arguments!(positional, proving, prove)
|
|
42
|
+
verb = positional.first
|
|
43
|
+
unless %w[index inspect plan check apply].include?(verb)
|
|
44
|
+
raise ArgumentError, "usage: polyrun graph index|inspect|plan|check|apply [options]"
|
|
45
|
+
end
|
|
46
|
+
required = %w[plan check apply].include?(verb) ? 2 : 1
|
|
47
|
+
maximum = (verb == "inspect") ? 2 : required
|
|
48
|
+
raise ArgumentError, "graph #{verb}: invalid arguments" unless (required..maximum).cover?(positional.length)
|
|
49
|
+
raise ArgumentError, "--prove requires graph check and a command after --" if (proving || !prove.empty?) && (verb != "check" || !proving || prove.empty?)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def emit_graph_result(result, output = nil)
|
|
53
|
+
if [122, 124, 127].include?(result["exitstatus"])
|
|
54
|
+
code = {122 => "OUTPUT_LIMIT", 124 => "TIMEOUT", 127 => "WORKER_UNAVAILABLE"}.fetch(result["exitstatus"])
|
|
55
|
+
raise Graph::Error.new(code, "graph command failed (#{code.downcase.tr("_", " ")})", exitstatus: result["exitstatus"])
|
|
56
|
+
end
|
|
57
|
+
File.write(output, result["exitstatus"].zero? ? result["stdout"] : result["stderr"]) if output
|
|
58
|
+
Polyrun::Log.print result["stdout"]
|
|
59
|
+
Polyrun.stderr.write(result["stderr"])
|
|
60
|
+
result["exitstatus"]
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def graph_diagnostic(code, message, json)
|
|
64
|
+
Polyrun::Log.warn(json ? JSON.generate("ok" => false, "code" => code, "message" => message) : "#{code}: #{message}")
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
data/lib/polyrun/cli/help.rb
CHANGED
|
@@ -7,7 +7,7 @@ module Polyrun
|
|
|
7
7
|
|
|
8
8
|
With no command, runs parallel tests for the resolved suite: partition.suite when set; else suite inferred from partition.paths_file; else filesystem auto-detect (RSpec under spec/, then Sus when config/sus.rb + test/**/*.rb, then Minitest *_test.rb, then Polyrun Quick). If the first argument is a known subcommand name, it is dispatched. Otherwise, path-like tokens (optionally with run-shards flags such as --workers) shard those files in parallel; see commands below.
|
|
9
9
|
|
|
10
|
-
global:
|
|
10
|
+
global options:
|
|
11
11
|
-c, --config PATH polyrun.yml path (or POLYRUN_CONFIG)
|
|
12
12
|
--suite NAME apply suites.NAME overlay from polyrun.yml (or POLYRUN_SUITE)
|
|
13
13
|
-v, --verbose
|
|
@@ -38,6 +38,10 @@ module Polyrun
|
|
|
38
38
|
|
|
39
39
|
commands:
|
|
40
40
|
version print version
|
|
41
|
+
graph opt-in Ruby graph edits (--enable or graph.enabled); index, inspect, plan, check, apply
|
|
42
|
+
mutate opt-in mutation testing (--enable or mutation.enabled); configurable subjects, workers, and CI shards
|
|
43
|
+
measure opt-in command measurements (--enable or quality settings), optional JSON ceilings
|
|
44
|
+
observe opt-in Ruby call observation (--enable or quality settings); --output PATH required
|
|
41
45
|
plan emit partition manifest JSON
|
|
42
46
|
prepare run prepare recipe: default | assets (optional prepare.command overrides bin/rails assets:precompile) | shell (prepare.command required)
|
|
43
47
|
merge-coverage merge SimpleCov JSON fragments (json/lcov/cobertura/console/html/csv/markdown)
|
data/lib/polyrun/cli/helpers.rb
CHANGED
|
@@ -52,8 +52,9 @@ module Polyrun
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
# Per-worker wall clock (from spawn) for run-shards / ci-shard fan-out; unset or invalid means no limit.
|
|
55
|
-
def env_worker_timeout_sec
|
|
56
|
-
|
|
55
|
+
def env_worker_timeout_sec(cfg = nil)
|
|
56
|
+
shared = cfg ? Polyrun::Config::Tools.stringify(cfg.raw) : {}
|
|
57
|
+
s = (ENV["POLYRUN_WORKER_TIMEOUT_SEC"] || ENV["POLYRUN_TIMEOUT"] || shared["timeout"]).to_s.strip
|
|
57
58
|
return nil if s.empty?
|
|
58
59
|
|
|
59
60
|
f = Float(s, exception: false)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
require_relative "../graph/error"
|
|
3
|
+
|
|
4
|
+
module Polyrun
|
|
5
|
+
class CLI
|
|
6
|
+
module MutationCommand
|
|
7
|
+
private
|
|
8
|
+
|
|
9
|
+
def cmd_mutate(argv)
|
|
10
|
+
options = {}
|
|
11
|
+
command = extract_tool_command!(argv)
|
|
12
|
+
parse_mutation_options!(argv, options)
|
|
13
|
+
settings = configured_tool("mutation", options)
|
|
14
|
+
require_relative "../mutation/runner"
|
|
15
|
+
subjects = mutation_subjects(settings)
|
|
16
|
+
report = Mutation::Runner.new(root: settings["root"], settings: settings,
|
|
17
|
+
arguments: command || settings["command"]).call(subjects, shard: settings["shard"], total: settings["total"])
|
|
18
|
+
payload = JSON.generate(report)
|
|
19
|
+
File.write(settings["output"], payload + "\n") if settings["output"]
|
|
20
|
+
Polyrun::Log.puts payload
|
|
21
|
+
report["ok"] ? 0 : 1
|
|
22
|
+
rescue OptionParser::ParseError, ArgumentError, KeyError, JSON::ParserError, SystemCallError, Graph::Error, Psych::Exception => e
|
|
23
|
+
Polyrun::Log.warn "mutate: #{e.message}"
|
|
24
|
+
2
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def parse_mutation_options!(argv, options)
|
|
28
|
+
parser = OptionParser.new do |opts|
|
|
29
|
+
common_tool_options(opts, options)
|
|
30
|
+
%w[max-mutations workers shard total].each do |key|
|
|
31
|
+
opts.on("--#{key} N", Integer) { |value| options[key.tr("-", "_").to_sym] = value }
|
|
32
|
+
end
|
|
33
|
+
%w[subjects-file plan output].each do |key|
|
|
34
|
+
opts.on("--#{key} PATH") { |value| options[key.tr("-", "_").to_sym] = value }
|
|
35
|
+
end
|
|
36
|
+
opts.on("--subject EXPRESSION") { |value| (options[:subjects] ||= []) << value }
|
|
37
|
+
opts.on("--observed PATH") { |value| (options[:observed] ||= []) << value }
|
|
38
|
+
end
|
|
39
|
+
raise ArgumentError, "unexpected mutation arguments" unless parser.parse(argv).empty?
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def mutation_file_subjects(settings)
|
|
43
|
+
path = File.expand_path(settings["subjects_file"], settings["root"])
|
|
44
|
+
raise ArgumentError, "subjects file is too large" if File.size(path) > settings["max_input_bytes"]
|
|
45
|
+
|
|
46
|
+
File.readlines(path, chomp: true).reject(&:empty?)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def mutation_graph_settings(root)
|
|
50
|
+
cfg = Config.load(path: ENV["POLYRUN_CONFIG"], root: root)
|
|
51
|
+
Config::Tools.resolve(cfg, "graph", root: root)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def mutation_subjects(settings)
|
|
55
|
+
subjects = settings["subjects"].dup
|
|
56
|
+
subjects.concat(mutation_file_subjects(settings)) if settings["subjects_file"]
|
|
57
|
+
if settings["plan"] || !settings["observed"].empty?
|
|
58
|
+
require_relative "../mutation/subjects"
|
|
59
|
+
graph = mutation_graph_settings(settings["root"])
|
|
60
|
+
subjects.concat(Mutation::Subjects.from_plan(settings["root"], settings["plan"], settings: graph)) if settings["plan"]
|
|
61
|
+
settings["observed"].each { |path| subjects.concat(Mutation::Subjects.from_observation(File.expand_path(path, settings["root"]), max_bytes: settings["max_artifact_bytes"])) }
|
|
62
|
+
end
|
|
63
|
+
subjects
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
require_relative "../graph/error"
|
|
3
|
+
|
|
4
|
+
module Polyrun
|
|
5
|
+
class CLI
|
|
6
|
+
module QualityCommands
|
|
7
|
+
private
|
|
8
|
+
|
|
9
|
+
def cmd_measure(argv)
|
|
10
|
+
options = {}
|
|
11
|
+
command = extract_tool_command!(argv)
|
|
12
|
+
parser = OptionParser.new do |opts|
|
|
13
|
+
common_tool_options(opts, options)
|
|
14
|
+
opts.on("--label NAME") { |value| options[:label] = value }
|
|
15
|
+
opts.on("--ceilings PATH") { |value| options[:ceilings] = JSON.parse(File.read(value)) }
|
|
16
|
+
opts.on("--output PATH") { |value| options[:output] = value }
|
|
17
|
+
end
|
|
18
|
+
raise ArgumentError, "unexpected measure arguments" unless parser.parse(argv).empty?
|
|
19
|
+
|
|
20
|
+
settings = configured_tool("measure", options)
|
|
21
|
+
require_relative "../quality/measure"
|
|
22
|
+
result = Quality::Measure.call(tool_command(settings, command), **tool_execution_options(settings, "label", "ceilings"))
|
|
23
|
+
write_quality_result(result, settings["output"])
|
|
24
|
+
quality_result_status(result)
|
|
25
|
+
rescue OptionParser::ParseError, ArgumentError, SystemCallError, JSON::ParserError, Graph::Error, Psych::Exception => e
|
|
26
|
+
Polyrun::Log.warn "measure: #{e.message}"
|
|
27
|
+
2
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def cmd_observe(argv)
|
|
31
|
+
options = {}
|
|
32
|
+
command = extract_tool_command!(argv)
|
|
33
|
+
parser = OptionParser.new do |opts|
|
|
34
|
+
common_tool_options(opts, options)
|
|
35
|
+
opts.on("--output PATH") { |value| options[:output] = value }
|
|
36
|
+
opts.on("--max-entries N", Integer) { |value| options[:max_entries] = value }
|
|
37
|
+
end
|
|
38
|
+
raise ArgumentError, "unexpected observe arguments" unless parser.parse(argv).empty?
|
|
39
|
+
|
|
40
|
+
settings = configured_tool("observe", options)
|
|
41
|
+
require_relative "../quality/observe"
|
|
42
|
+
raise ArgumentError, "--output is required" unless settings["output"]
|
|
43
|
+
result = Quality::Observe.call(tool_command(settings, command), root: settings["root"], output: settings["output"],
|
|
44
|
+
timeout: settings["timeout"], limit: settings["max_entries"], max_output: settings["max_output_bytes"], max_artifact_bytes: settings["max_artifact_bytes"])
|
|
45
|
+
write_quality_result(result, nil)
|
|
46
|
+
quality_result_status(result)
|
|
47
|
+
rescue OptionParser::ParseError, ArgumentError, SystemCallError, JSON::ParserError, Graph::Error, Psych::Exception => e
|
|
48
|
+
Polyrun::Log.warn "observe: #{e.message}"
|
|
49
|
+
2
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def write_quality_result(result, output)
|
|
53
|
+
payload = JSON.generate(result)
|
|
54
|
+
File.write(output, payload + "\n") if output
|
|
55
|
+
Polyrun::Log.puts payload
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def quality_result_status(result)
|
|
59
|
+
return result["exitstatus"] unless result["exitstatus"].zero?
|
|
60
|
+
|
|
61
|
+
result["ok"] ? 0 : 1
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
require_relative "../config"
|
|
2
|
+
|
|
3
|
+
module Polyrun
|
|
4
|
+
class CLI
|
|
5
|
+
module ToolOptions
|
|
6
|
+
private
|
|
7
|
+
|
|
8
|
+
def common_tool_options(parser, options)
|
|
9
|
+
parser.on("--[no-]enable") { |value| options[:enabled] = value }
|
|
10
|
+
parser.on("--root PATH") { |value| options[:root] = value }
|
|
11
|
+
parser.on("--timeout SECONDS", Float) { |value| options[:timeout] = value }
|
|
12
|
+
parser.on("--max-output-bytes N", Integer) { |value| options[:max_output_bytes] = value }
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def configured_tool(feature, overrides)
|
|
16
|
+
overrides = overrides.dup
|
|
17
|
+
overrides[:root] = File.expand_path(overrides[:root]) if overrides.key?(:root)
|
|
18
|
+
root = File.expand_path(overrides[:root] || Dir.pwd)
|
|
19
|
+
cfg = Config.load(path: ENV["POLYRUN_CONFIG"], root: root)
|
|
20
|
+
settings = Config::Tools.resolve(cfg, feature, overrides: overrides, root: root)
|
|
21
|
+
if feature == "mutation"
|
|
22
|
+
graph = Config::Tools.resolve(cfg, "graph", root: root)
|
|
23
|
+
settings["staging"]["exclude_paths"] |= [graph["state_dir"]]
|
|
24
|
+
end
|
|
25
|
+
unless settings["enabled"]
|
|
26
|
+
raise Graph::Error.new("FEATURE_DISABLED", "#{feature} is disabled; enable it in polyrun.yml or use --enable", exitstatus: 2)
|
|
27
|
+
end
|
|
28
|
+
settings
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def extract_tool_command!(argv)
|
|
32
|
+
separator = argv.index("--")
|
|
33
|
+
separator ? argv.slice!(separator..).drop(1) : nil
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def tool_execution_options(settings, *keys)
|
|
37
|
+
settings.slice("root", "timeout", *keys).transform_keys(&:to_sym).merge(max_output: settings["max_output_bytes"])
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def tool_command(settings, explicit)
|
|
41
|
+
command = explicit || settings.fetch("command")
|
|
42
|
+
raise ArgumentError, "a command is required after -- or in configuration" if command.empty?
|
|
43
|
+
|
|
44
|
+
command
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
data/lib/polyrun/cli.rb
CHANGED
|
@@ -25,6 +25,10 @@ require_relative "cli/doctor_command"
|
|
|
25
25
|
require_relative "cli/default_run"
|
|
26
26
|
require_relative "cli/hooks_command"
|
|
27
27
|
require_relative "cli/help"
|
|
28
|
+
require_relative "cli/tool_options"
|
|
29
|
+
require_relative "cli/graph_command"
|
|
30
|
+
require_relative "cli/mutation_command"
|
|
31
|
+
require_relative "cli/quality_commands"
|
|
28
32
|
|
|
29
33
|
module Polyrun
|
|
30
34
|
class CLI
|
|
@@ -36,7 +40,7 @@ module Polyrun
|
|
|
36
40
|
|
|
37
41
|
# Keep in sync with +dispatch_cli_command_subcommands+ (+when+ branches). Used for implicit path routing.
|
|
38
42
|
DISPATCH_SUBCOMMAND_NAMES = %w[
|
|
39
|
-
plan prepare merge-coverage merge-failures merge-spec-quality report-coverage report-junit report-timing report-spec-quality report-benchmark bench
|
|
43
|
+
graph mutate measure observe plan prepare merge-coverage merge-failures merge-spec-quality report-coverage report-junit report-timing report-spec-quality report-benchmark bench
|
|
40
44
|
env config merge-timing db:setup-template db:setup-shard db:clone-shards
|
|
41
45
|
run-shards parallel-rspec parallel-minitest parallel-sus parallel-quick start build-paths init queue run-queue quick hook validate doctor
|
|
42
46
|
].freeze
|
|
@@ -70,6 +74,10 @@ module Polyrun
|
|
|
70
74
|
include DefaultRun
|
|
71
75
|
include HooksCommand
|
|
72
76
|
include Help
|
|
77
|
+
include ToolOptions
|
|
78
|
+
include GraphCommand
|
|
79
|
+
include MutationCommand
|
|
80
|
+
include QualityCommands
|
|
73
81
|
|
|
74
82
|
def self.run(argv = ARGV)
|
|
75
83
|
new.run(argv)
|
|
@@ -176,6 +184,14 @@ module Polyrun
|
|
|
176
184
|
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity -- explicit dispatch table
|
|
177
185
|
def dispatch_cli_command_subcommands(command, argv, config_path)
|
|
178
186
|
case command
|
|
187
|
+
when "graph"
|
|
188
|
+
cmd_graph(argv)
|
|
189
|
+
when "mutate"
|
|
190
|
+
cmd_mutate(argv)
|
|
191
|
+
when "measure"
|
|
192
|
+
cmd_measure(argv)
|
|
193
|
+
when "observe"
|
|
194
|
+
cmd_observe(argv)
|
|
179
195
|
when "plan"
|
|
180
196
|
cmd_plan(argv, config_path)
|
|
181
197
|
when "prepare"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require_relative "dotted_path"
|
|
2
2
|
require_relative "resolver"
|
|
3
|
+
require_relative "tools"
|
|
3
4
|
|
|
4
5
|
module Polyrun
|
|
5
6
|
class Config
|
|
@@ -50,9 +51,17 @@ module Polyrun
|
|
|
50
51
|
base["partition"] = part
|
|
51
52
|
|
|
52
53
|
base["workers"] = r.parallel_worker_count(cfg, env)
|
|
54
|
+
apply_tools!(base, cfg, env)
|
|
53
55
|
base["suite"] = cfg.suite if cfg.respond_to?(:suite) && cfg.suite
|
|
54
56
|
|
|
55
57
|
base
|
|
58
|
+
rescue ArgumentError => error
|
|
59
|
+
raise Polyrun::Error, error.message
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def apply_tools!(base, cfg, env)
|
|
63
|
+
%w[graph mutation].each { |feature| base[feature] = Tools.resolve(cfg, feature, env: env) }
|
|
64
|
+
base["quality"] = (base["quality"] || {}).merge(%w[observe measure].to_h { |feature| [feature, Tools.resolve(cfg, feature, env: env)] })
|
|
56
65
|
end
|
|
57
66
|
|
|
58
67
|
def deep_stringify_keys(obj)
|
|
@@ -76,6 +76,8 @@ module Polyrun
|
|
|
76
76
|
|
|
77
77
|
# +POLYRUN_WORKERS+ then top-level YAML +workers:+ then {Config::DEFAULT_PARALLEL_WORKERS}.
|
|
78
78
|
def parallel_worker_count(cfg = nil, env = ENV)
|
|
79
|
+
validate_shared_tools!(cfg) if cfg
|
|
80
|
+
|
|
79
81
|
s = env["POLYRUN_WORKERS"]
|
|
80
82
|
unless s.nil? || s.empty?
|
|
81
83
|
i = Integer(s, exception: false)
|
|
@@ -88,6 +90,13 @@ module Polyrun
|
|
|
88
90
|
Polyrun::Config::DEFAULT_PARALLEL_WORKERS
|
|
89
91
|
end
|
|
90
92
|
|
|
93
|
+
def validate_shared_tools!(cfg)
|
|
94
|
+
raw = cfg.respond_to?(:raw) ? cfg.raw : cfg
|
|
95
|
+
errors = Tools.validate(raw)
|
|
96
|
+
raise Polyrun::Error, errors.join("; ") unless errors.empty?
|
|
97
|
+
end
|
|
98
|
+
private_class_method :validate_shared_tools!
|
|
99
|
+
|
|
91
100
|
def yaml_top_level_workers(cfg)
|
|
92
101
|
return nil unless cfg
|
|
93
102
|
|