polyrun 3.2.0-java

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.
Files changed (225) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +234 -0
  3. data/CODE_OF_CONDUCT.md +26 -0
  4. data/CONTRIBUTING.md +23 -0
  5. data/LICENSE +21 -0
  6. data/README.md +251 -0
  7. data/SECURITY.md +25 -0
  8. data/bin/polyrun +6 -0
  9. data/docs/QUALITY.md +82 -0
  10. data/docs/QUALITY_CONFIGURATION.md +95 -0
  11. data/docs/SETUP_PROFILE.md +139 -0
  12. data/lib/polyrun/benchmark/pressure/cooker.rb +191 -0
  13. data/lib/polyrun/benchmark/pressure/process_sample.rb +127 -0
  14. data/lib/polyrun/benchmark/pressure.rb +144 -0
  15. data/lib/polyrun/benchmark/profile.rb +191 -0
  16. data/lib/polyrun/benchmark/report.rb +87 -0
  17. data/lib/polyrun/cli/benchmark_commands.rb +66 -0
  18. data/lib/polyrun/cli/ci_shard_hooks.rb +129 -0
  19. data/lib/polyrun/cli/ci_shard_run_command.rb +177 -0
  20. data/lib/polyrun/cli/ci_shard_run_parse.rb +68 -0
  21. data/lib/polyrun/cli/config_command.rb +42 -0
  22. data/lib/polyrun/cli/coverage_commands.rb +150 -0
  23. data/lib/polyrun/cli/coverage_merge_io.rb +150 -0
  24. data/lib/polyrun/cli/database_commands.rb +163 -0
  25. data/lib/polyrun/cli/default_run.rb +144 -0
  26. data/lib/polyrun/cli/doctor_command.rb +94 -0
  27. data/lib/polyrun/cli/env_commands.rb +43 -0
  28. data/lib/polyrun/cli/failure_commands.rb +99 -0
  29. data/lib/polyrun/cli/graph_command.rb +68 -0
  30. data/lib/polyrun/cli/help.rb +83 -0
  31. data/lib/polyrun/cli/helpers.rb +162 -0
  32. data/lib/polyrun/cli/hooks_command.rb +97 -0
  33. data/lib/polyrun/cli/init_command.rb +108 -0
  34. data/lib/polyrun/cli/mutation_command.rb +67 -0
  35. data/lib/polyrun/cli/partition_diagnostics.rb +22 -0
  36. data/lib/polyrun/cli/plan_command.rb +184 -0
  37. data/lib/polyrun/cli/prepare_command.rb +70 -0
  38. data/lib/polyrun/cli/prepare_recipe.rb +82 -0
  39. data/lib/polyrun/cli/quality_commands.rb +65 -0
  40. data/lib/polyrun/cli/queue_command.rb +161 -0
  41. data/lib/polyrun/cli/quick_command.rb +13 -0
  42. data/lib/polyrun/cli/report_commands.rb +108 -0
  43. data/lib/polyrun/cli/run_queue_command.rb +127 -0
  44. data/lib/polyrun/cli/run_shards_command.rb +164 -0
  45. data/lib/polyrun/cli/run_shards_parallel_children.rb +112 -0
  46. data/lib/polyrun/cli/run_shards_parallel_wait.rb +252 -0
  47. data/lib/polyrun/cli/run_shards_plan_boot_phases.rb +207 -0
  48. data/lib/polyrun/cli/run_shards_plan_options.rb +74 -0
  49. data/lib/polyrun/cli/run_shards_planning.rb +123 -0
  50. data/lib/polyrun/cli/run_shards_run.rb +171 -0
  51. data/lib/polyrun/cli/run_shards_worker_interrupt.rb +101 -0
  52. data/lib/polyrun/cli/skip_env.rb +34 -0
  53. data/lib/polyrun/cli/spec_quality_commands.rb +149 -0
  54. data/lib/polyrun/cli/start_bootstrap.rb +126 -0
  55. data/lib/polyrun/cli/timing_command.rb +31 -0
  56. data/lib/polyrun/cli/tool_options.rb +48 -0
  57. data/lib/polyrun/cli/validate_command.rb +26 -0
  58. data/lib/polyrun/cli.rb +272 -0
  59. data/lib/polyrun/config/dotted_path.rb +21 -0
  60. data/lib/polyrun/config/effective.rb +82 -0
  61. data/lib/polyrun/config/resolver.rb +114 -0
  62. data/lib/polyrun/config/schema.rb +39 -0
  63. data/lib/polyrun/config/suite.rb +109 -0
  64. data/lib/polyrun/config/tool_defaults.rb +42 -0
  65. data/lib/polyrun/config/tool_validation.rb +79 -0
  66. data/lib/polyrun/config/tools.rb +120 -0
  67. data/lib/polyrun/config.rb +97 -0
  68. data/lib/polyrun/coverage/cobertura_zero_lines.rb +32 -0
  69. data/lib/polyrun/coverage/collector.rb +169 -0
  70. data/lib/polyrun/coverage/collector_blob.rb +53 -0
  71. data/lib/polyrun/coverage/collector_finish.rb +98 -0
  72. data/lib/polyrun/coverage/collector_fragment_meta.rb +57 -0
  73. data/lib/polyrun/coverage/config_resolve.rb +131 -0
  74. data/lib/polyrun/coverage/example_diff.rb +184 -0
  75. data/lib/polyrun/coverage/example_diff_snapshot.rb +44 -0
  76. data/lib/polyrun/coverage/example_diff_track_filter.rb +51 -0
  77. data/lib/polyrun/coverage/file_stats_report.rb +36 -0
  78. data/lib/polyrun/coverage/filter.rb +22 -0
  79. data/lib/polyrun/coverage/formatter.rb +137 -0
  80. data/lib/polyrun/coverage/merge/formatters.rb +188 -0
  81. data/lib/polyrun/coverage/merge/formatters_html.rb +221 -0
  82. data/lib/polyrun/coverage/merge/html/_file_list.html.erb +21 -0
  83. data/lib/polyrun/coverage/merge/html/_file_section.html.erb +26 -0
  84. data/lib/polyrun/coverage/merge/html/_groups_table.html.erb +18 -0
  85. data/lib/polyrun/coverage/merge/html/_overview.html.erb +47 -0
  86. data/lib/polyrun/coverage/merge/html/report.css +147 -0
  87. data/lib/polyrun/coverage/merge/html/report.js +48 -0
  88. data/lib/polyrun/coverage/merge/html/template.html.erb +30 -0
  89. data/lib/polyrun/coverage/merge.rb +160 -0
  90. data/lib/polyrun/coverage/merge_fragment_meta.rb +58 -0
  91. data/lib/polyrun/coverage/merge_merge_two.rb +168 -0
  92. data/lib/polyrun/coverage/merge_native.rb +39 -0
  93. data/lib/polyrun/coverage/rails.rb +126 -0
  94. data/lib/polyrun/coverage/reporting.rb +41 -0
  95. data/lib/polyrun/coverage/result.rb +18 -0
  96. data/lib/polyrun/coverage/track_files.rb +150 -0
  97. data/lib/polyrun/data/cached_fixtures.rb +122 -0
  98. data/lib/polyrun/data/factory_counts.rb +48 -0
  99. data/lib/polyrun/data/factory_instrumentation.rb +50 -0
  100. data/lib/polyrun/data/fixtures.rb +68 -0
  101. data/lib/polyrun/data/parallel_provisioning.rb +93 -0
  102. data/lib/polyrun/data/snapshot.rb +84 -0
  103. data/lib/polyrun/database/clone_shards.rb +106 -0
  104. data/lib/polyrun/database/provision.rb +83 -0
  105. data/lib/polyrun/database/shard.rb +64 -0
  106. data/lib/polyrun/database/url_builder/connection/infer.rb +53 -0
  107. data/lib/polyrun/database/url_builder/connection/url_builders.rb +43 -0
  108. data/lib/polyrun/database/url_builder/connection.rb +191 -0
  109. data/lib/polyrun/database/url_builder/template_prepare.rb +21 -0
  110. data/lib/polyrun/database/url_builder.rb +188 -0
  111. data/lib/polyrun/debug.rb +81 -0
  112. data/lib/polyrun/env/ci.rb +65 -0
  113. data/lib/polyrun/error.rb +3 -0
  114. data/lib/polyrun/export/csv.rb +25 -0
  115. data/lib/polyrun/export/markdown.rb +47 -0
  116. data/lib/polyrun/graph/client.rb +64 -0
  117. data/lib/polyrun/graph/error.rb +13 -0
  118. data/lib/polyrun/graph/index.rb +75 -0
  119. data/lib/polyrun/graph/inspect.rb +58 -0
  120. data/lib/polyrun/graph/plan.rb +134 -0
  121. data/lib/polyrun/graph/planner.rb +117 -0
  122. data/lib/polyrun/graph/syntax.rb +114 -0
  123. data/lib/polyrun/graph/transaction.rb +81 -0
  124. data/lib/polyrun/graph/worker.rb +55 -0
  125. data/lib/polyrun/graph/workspace.rb +117 -0
  126. data/lib/polyrun/hooks/dsl.rb +128 -0
  127. data/lib/polyrun/hooks/shell_runner.rb +33 -0
  128. data/lib/polyrun/hooks/worker_runner.rb +27 -0
  129. data/lib/polyrun/hooks/worker_shell.rb +50 -0
  130. data/lib/polyrun/hooks.rb +190 -0
  131. data/lib/polyrun/log.rb +86 -0
  132. data/lib/polyrun/minitest_support.rb +60 -0
  133. data/lib/polyrun/mutation/candidates.rb +91 -0
  134. data/lib/polyrun/mutation/operators.rb +51 -0
  135. data/lib/polyrun/mutation/runner.rb +133 -0
  136. data/lib/polyrun/mutation/subjects.rb +88 -0
  137. data/lib/polyrun/partition/constraints.rb +80 -0
  138. data/lib/polyrun/partition/hrw.rb +70 -0
  139. data/lib/polyrun/partition/min_heap.rb +64 -0
  140. data/lib/polyrun/partition/paths.rb +175 -0
  141. data/lib/polyrun/partition/paths_build.rb +141 -0
  142. data/lib/polyrun/partition/plan.rb +250 -0
  143. data/lib/polyrun/partition/plan_lpt.rb +91 -0
  144. data/lib/polyrun/partition/plan_sharding.rb +56 -0
  145. data/lib/polyrun/partition/reports.rb +139 -0
  146. data/lib/polyrun/partition/stable_shuffle.rb +18 -0
  147. data/lib/polyrun/partition/suite.rb +120 -0
  148. data/lib/polyrun/partition/timing_diagnostics.rb +138 -0
  149. data/lib/polyrun/partition/timing_keys.rb +86 -0
  150. data/lib/polyrun/prepare/artifacts.rb +40 -0
  151. data/lib/polyrun/prepare/assets.rb +64 -0
  152. data/lib/polyrun/process_stdio.rb +96 -0
  153. data/lib/polyrun/quality/command.rb +84 -0
  154. data/lib/polyrun/quality/measure.rb +38 -0
  155. data/lib/polyrun/quality/observe.rb +53 -0
  156. data/lib/polyrun/quality/observe_hook.rb +103 -0
  157. data/lib/polyrun/quality/sandbox.rb +70 -0
  158. data/lib/polyrun/queue/duration.rb +30 -0
  159. data/lib/polyrun/queue/file_store.rb +413 -0
  160. data/lib/polyrun/queue/file_store_intent.rb +188 -0
  161. data/lib/polyrun/queue/file_store_pending.rb +48 -0
  162. data/lib/polyrun/queue/worker_loop.rb +73 -0
  163. data/lib/polyrun/quick/assertions.rb +32 -0
  164. data/lib/polyrun/quick/config.rb +56 -0
  165. data/lib/polyrun/quick/errors.rb +6 -0
  166. data/lib/polyrun/quick/example_group.rb +111 -0
  167. data/lib/polyrun/quick/example_runner.rb +129 -0
  168. data/lib/polyrun/quick/matchers.rb +159 -0
  169. data/lib/polyrun/quick/matchers_predicates.rb +122 -0
  170. data/lib/polyrun/quick/reporter.rb +76 -0
  171. data/lib/polyrun/quick/runner.rb +224 -0
  172. data/lib/polyrun/quick.rb +1 -0
  173. data/lib/polyrun/railtie.rb +7 -0
  174. data/lib/polyrun/reporting/failure_merge.rb +171 -0
  175. data/lib/polyrun/reporting/junit.rb +126 -0
  176. data/lib/polyrun/reporting/junit_emit.rb +58 -0
  177. data/lib/polyrun/reporting/junit_report.rb +87 -0
  178. data/lib/polyrun/reporting/rspec_failure_fragment_formatter.rb +95 -0
  179. data/lib/polyrun/reporting/rspec_junit.rb +39 -0
  180. data/lib/polyrun/rspec_support/active_record_timeout_recovery.rb +51 -0
  181. data/lib/polyrun/rspec_support/example_debug.rb +167 -0
  182. data/lib/polyrun/rspec_support/example_debug_instrumentation.rb +73 -0
  183. data/lib/polyrun/rspec_support/sharded_formatter_compat.rb +57 -0
  184. data/lib/polyrun/rspec_support.rb +110 -0
  185. data/lib/polyrun/spec_quality/config.rb +139 -0
  186. data/lib/polyrun/spec_quality/fragment.rb +39 -0
  187. data/lib/polyrun/spec_quality/merge.rb +78 -0
  188. data/lib/polyrun/spec_quality/minitest_hook.rb +42 -0
  189. data/lib/polyrun/spec_quality/plan_loader.rb +47 -0
  190. data/lib/polyrun/spec_quality/profile.rb +102 -0
  191. data/lib/polyrun/spec_quality/report.rb +363 -0
  192. data/lib/polyrun/spec_quality/rspec_hook.rb +55 -0
  193. data/lib/polyrun/spec_quality/sql_counter.rb +34 -0
  194. data/lib/polyrun/spec_quality.rb +212 -0
  195. data/lib/polyrun/sus_support.rb +55 -0
  196. data/lib/polyrun/templates/POLYRUN.md +51 -0
  197. data/lib/polyrun/templates/ci_matrix.polyrun.yml +22 -0
  198. data/lib/polyrun/templates/minimal_gem.polyrun.yml +13 -0
  199. data/lib/polyrun/templates/polyrun_hooks_spec_quality.rb +12 -0
  200. data/lib/polyrun/templates/polyrun_spec_quality.yml +20 -0
  201. data/lib/polyrun/templates/rails_prepare.polyrun.yml +51 -0
  202. data/lib/polyrun/templates/rails_prepare_task.rake +16 -0
  203. data/lib/polyrun/timing/merge.rb +36 -0
  204. data/lib/polyrun/timing/rspec_example_formatter.rb +60 -0
  205. data/lib/polyrun/timing/stats.rb +76 -0
  206. data/lib/polyrun/timing/summary.rb +78 -0
  207. data/lib/polyrun/timing/variance_report.rb +51 -0
  208. data/lib/polyrun/version.rb +3 -0
  209. data/lib/polyrun/worker_output.rb +181 -0
  210. data/lib/polyrun/worker_output_forwarders.rb +94 -0
  211. data/lib/polyrun/worker_ping.rb +77 -0
  212. data/lib/polyrun.rb +59 -0
  213. data/polyrun.gemspec +49 -0
  214. data/sig/polyrun/cli.rbs +6 -0
  215. data/sig/polyrun/config.rbs +20 -0
  216. data/sig/polyrun/debug.rbs +12 -0
  217. data/sig/polyrun/log.rbs +12 -0
  218. data/sig/polyrun/minitest_support.rbs +7 -0
  219. data/sig/polyrun/quick.rbs +19 -0
  220. data/sig/polyrun/rspec_support.rbs +21 -0
  221. data/sig/polyrun/sus_support.rbs +7 -0
  222. data/sig/polyrun/worker_output.rbs +11 -0
  223. data/sig/polyrun/worker_ping.rbs +10 -0
  224. data/sig/polyrun.rbs +11 -0
  225. metadata +463 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 88da7a097384b58676f5dc3d92b68dcf455a27c53aa2efeee1d536f4881bc93f
4
+ data.tar.gz: 2d14a269742c5b561ab03ddb9f5b967ad0786f3312f2b295c34bdeff3f4f49e5
5
+ SHA512:
6
+ metadata.gz: dd68101cdde150ce27a111c3d32ae34b209bd46e42f544d2fed6bd4874b0aca7c4d75f574afaf88d736cb1ad1c829877d56fa6ed942cc1877b9df644049a0c68
7
+ data.tar.gz: a490a8a55dac1e32b1337c44c29fdbb7656851b85bb024d6fc5f4d0ece40df7b6db5c22eefe858fee4621a47e6304130c01b78e378b9f75c1243b08efcd16c72
data/CHANGELOG.md ADDED
@@ -0,0 +1,234 @@
1
+ # CHANGELOG
2
+
3
+ ## 3.2.0 (2026-12-01)
4
+
5
+ - Add the experimental `polyrun-legacy` gem for local and CI sharding, suite configuration, preparation, and test reports on MRI Ruby 1.8.7 and newer on POSIX. The Legacy smoke check also runs on JRuby and TruffleRuby Native.
6
+ - Give the mutation baseline at least five seconds and use the configured timeout for each mutation.
7
+ - Build an extension-free `java` gem for JRuby and exercise installed sharding and artifact reporting on JRuby and TruffleRuby Native (RFC 0012).
8
+ - Handle `SIGINT` and `SIGTERM` while waiting for shard workers on JRuby and TruffleRuby so worker groups stop before Polyrun exits.
9
+ - Accept TruffleRuby's line coverage format for per-example deltas and report unavailable branch coverage before starting collection.
10
+ - Add a maintainer smoke run for a Spinel-compiled shard worker using the Polyrun legacy partition library.
11
+
12
+ ## 3.1.0 (2026-11-14)
13
+
14
+ - Run graph indexing, curated mutation, observe, and measure against this repository (`make quality-self`, quality CI).
15
+ - Stage the project-root `coverage` report tree by path so nested library directories named `coverage` still copy into mutation and graph sandboxes.
16
+ - Expand absolute `--root` only when the flag is present so a relative project path is not resolved against itself.
17
+ - Tighten mutation and staging contracts used by the self gate; drop a redundant `master.key` basename check covered by `.key` suffix exclusion.
18
+ - 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.
19
+ - 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.
20
+ - Add opt-in `observe` for bounded Ruby call reports and `measure` for command resource reports and ceilings.
21
+ - 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`.
22
+ - Resolve configured per-example quality activation from the integration's project root.
23
+
24
+ ## 3.0.1 (2026-11-12)
25
+
26
+ - 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.
27
+
28
+ ## 3.0.0 (2026-11-12)
29
+
30
+ - Rename `Polyrun::RSpec` to `Polyrun::RSpecSupport` and `Polyrun::Minitest` to `Polyrun::MinitestSupport` (requires `polyrun/rspec_support` / `polyrun/minitest_support`). Hard cut: old constants and require paths are removed (RFC-0007).
31
+ - Fix `Polyrun::Reporting::RspecJunit.install!` raising `NoMethodError` on `configure` when RSpec wiring was already required (`::RSpec` qualification).
32
+ - Add Sus as a first-class suite: `partition.suite: sus`, `test/**/*.rb` globs, auto-detect via `config/sus.rb`, `parallel-sus`, `ci-shard-sus`, and `Polyrun::SusSupport` (RFC-0008).
33
+ - Treat Covered-style `COVERAGE` (non-falsey) as coverage-wanted for `Coverage::Collector` / SusSupport `install_coverage!` (RFC-0008).
34
+ - Classify Sus-style `test/**/*.rb` paths as `:sus` instead of `:quick` during suite inference.
35
+ - Extend `Polyrun::Quick`: `config/polyrun_quick.rb` suite hooks and `add_load_path`, `around`, error-aware `after`, `with` / `subject`, `be` / `be_a` / `raise_exception`, slowest-example summary (RFC-0009).
36
+
37
+ ## 2.2.9 (2026-11-07)
38
+
39
+ - Add `Polyrun::Benchmark::Pressure` for load benches: wall/CPU/RSS/heap/GC plus optional storage and network byte deltas, with target ceilings for iterative pressure runs.
40
+ - Add `benchmarks/load.rb`, `benchmarks/cooker.rb`, and Make targets (`bench-load`, `bench-calibrate`, cooker propose/gate) for coverage-merge pressure matrices; JSON under `benchmarks/output/`.
41
+ - Speed coverage merge on the hot path: faster fragment read/parse, cheaper empty-meta merges, and native merge micro-optimizations (hash capacity, Fixnum line hits, empty-operand early return).
42
+
43
+ ## 2.2.8 (2026-11-04)
44
+
45
+ - Honor top-level `workers:` in `polyrun.yml` when `POLYRUN_WORKERS` is unset (`polyrun config workers`, `start`, `run-shards`, `run-queue`, `doctor`).
46
+ - Resolve coverage from `config/polyrun_coverage.yml` when that file is present, and otherwise from inline `coverage:` in `polyrun.yml`. Map `formats` and a directory `output_path` to the report keys.
47
+ - Apply the selected suite and an explicit `-c` or `POLYRUN_CONFIG` to coverage collection, the merge gate, and `polyrun doctor`.
48
+ - Add `polyrun validate` for unknown top-level keys and a non-mapping YAML root.
49
+ - Add `version`, `start`, empty `hooks`, and `merge_failures` commentary to the Rails `polyrun init` template.
50
+ - Add named `suites:` overlays selected with `--suite` or `POLYRUN_SUITE` (partition membership, workers, and related top-level keys).
51
+ - Add `polyrun doctor` for the effective config summary (file, suite, start gates, database adapter and shards, coverage source).
52
+ - Accept `POLYRUN_SKIP_PREPARE` and `POLYRUN_SKIP_DATABASES` as the skip switches. Keep `POLYRUN_START_SKIP_*` working, with a deprecation warning.
53
+ - Add `polyrun init --profile rails-prepare-task`, which writes `lib/tasks/polyrun_prepare.rake`.
54
+
55
+ ## 2.2.7 (2026-11-04)
56
+
57
+ - Fix `Polyrun::Coverage::Collector` finish raising `uninitialized constant Polyrun::VERSION` when only `polyrun/coverage/rails` (or `polyrun/coverage/collector`) is required.
58
+
59
+ ## 2.2.6 (2026-10-29)
60
+
61
+ - Fix `polyrun start` auto database provision when `databases:` uses a non-Postgres adapter (`mysql2`, trilogy, …): skip CloneShards with a clear warning (or exit 1 if `start.databases: true`); keep `template_db` / `shard_db_pattern` for URL shaping.
62
+ - Fail `db:clone-shards` / `db:setup-shard` before `psql` when the inferred adapter is not PostgreSQL.
63
+ - Pass `postgresql:` host, port, username, and password from `polyrun.yml` into `psql` during shard provision (password via child `PGPASSWORD`).
64
+ - Fix implicit path runs so tokens after `--` stay the worker command, and `--paths-file` is passed before `--`.
65
+ - Accept `polyrun start --workers=N` (equals form) so shard DB provision matches worker count.
66
+ - Reject `databases.shard_db_pattern` without `%{shard}` / `%<shard>d`, and refuse patterns that resolve to `template_db`.
67
+ - Redact database passwords in `db:*` / CloneShards dry-run shell logs.
68
+ - Raise when an explicit `-c` / `POLYRUN_CONFIG` path is missing; map `Polyrun::Error` to exit 2.
69
+ - Validate `run-queue --workers` (1..max) and exit forked queue workers with `exit!`.
70
+ - Fix SpecQuality `minimum_unique_lines_per_example` gate for thresholds above 1; keep only positive or CPU profile deltas.
71
+ - Align file-granularity timing cost keys with realpath normalization so cost binpack hits under symlink roots.
72
+ - TERM shard workers before draining routed worker output on SIGINT/SIGTERM; skip empty queue leases.
73
+ - Recover interrupted queue claim/ack/reclaim via `intent.json`; age leases by `heartbeat_at`; quarantine poison paths after `POLYRUN_QUEUE_MAX_ATTEMPTS` (default 3).
74
+ - On a failed `run-queue` batch, re-run paths one-by-one and ack successes so a poison path does not requeue neighbors.
75
+ - Spawn shard workers in their own process group and signal the group on timeout/interrupt; abort already-started workers if a later spawn fails.
76
+ - Cache coverage HTML ERB templates; fold merge fragments without retaining full JSON documents; share plan/run-shards timing cost resolution.
77
+ - Clarify `run-shards` interleaved-output notice: RSpec summary counts apply to individual shards (no false per-worker total).
78
+
79
+ ## 2.2.5 (2026-09-24)
80
+
81
+ - Fix bare `polyrun` suite selection when both `spec/` and `test/` exist: honor `partition.suite`, else infer from `partition.paths_file`, else filesystem auto-detect (RSpec first).
82
+ - Exit 2 when `partition.suite` disagrees with `paths_file`, or when `run-shards` paths infer a different suite than a recognizable command after `--`.
83
+ - Add `parallel-minitest` and `parallel-quick` CLI subcommands (same shape as `parallel-rspec`); they do not run `start` prepare or database bootstrap.
84
+ - Recognize `bin/rails test` and compact `ruby -Itest` in the suite/command mismatch guard; strip `path:line` locators before classifying paths.
85
+ - Skip legacy `spec/spec_paths.txt` when `partition.suite` is `minitest` or `quick`; allow mixed path lists only with suite-agnostic custom runners.
86
+
87
+ ## 2.2.4 (2026-09-04)
88
+
89
+ - Fix `DEBUG_SQL` / `POLYRUN_DEBUG_SQL` raising `NoMethodError` for `loggable_sql?` when the SQL subscriber runs on an RSpec example group.
90
+ - Add `rfcs/` starter pack: process (RFC 0001), positioning (RFC 0002), and Standards Track design RFCs 0003–0006 for shard layouts, coverage merge, hooks, and partition config.
91
+
92
+ ## 2.2.3 (2026-08-16)
93
+
94
+ - Fix `merge-failures` `Encoding::CompatibilityError` when JSONL or RSpec JSON contains UTF-8 and the process locale is US-ASCII; read fragments as UTF-8
95
+ - Join worker output forwarders before closing pipe ends so shard logs keep the last bytes after a worker exits
96
+
97
+ ## 2.2.2 (2026-07-25)
98
+
99
+ - BREAKING: Require Ruby 3.4 or newer
100
+ - Fix `Process.spawn` for string worker commands so the command is one argv element instead of character-splatted
101
+ - Drain remaining worker pipe output when the forwarder hits `IOError` or `Errno::EPIPE`
102
+
103
+ ## 2.2.1 (2026-07-13)
104
+
105
+ - Fix per-example timeout leaving ActiveRecord connection pools in a bad state after `Timeout` interrupts database I/O; disconnect all pools on timeout (adapter-agnostic).
106
+ - Fix `DEBUG_PROSOPITE=1`, `DEBUG_SQL` / `POLYRUN_DEBUG_SQL`, and `DEBUG_TRACE` / `POLYRUN_DEBUG_TRACE` requiring `POLYRUN_EXAMPLE_DEBUG=1`; each flag is standalone again.
107
+
108
+ ## 2.2.0 (2026-07-13)
109
+
110
+ - Fix `install_example_rails_logging!` raising `NameError` when example-debug Rails logging runs under `POLYRUN_EXAMPLE_DEBUG=1`.
111
+ - Improve spec-quality per-example coverage diff: sparse scoped snapshots, track-aware diff without a second full blob copy, and optional lazy profile dimensions.
112
+ - Add CSV and Markdown exports for coverage, timing, spec-quality, and failure merge reports.
113
+ - Add `report-junit --format xml|csv|markdown` (XML remains default for CI).
114
+ - Add `Polyrun::Benchmark::Profile` / `report-benchmark` / `polyrun bench`; benchmark runs write JSON sidecars under `tmp/benchmarks/` with optional `POLYRUN_BENCH_FORMATS`.
115
+ - Add optional native coverage merge acceleration (`ext/polyrun_coverage_merge`: `merge_line_arrays`, `merge_two`, `line_counts`) with Ruby fallbacks.
116
+ - Add RSpec performance benchmarks (`rake bench_performance`, `spec/performance/`) with profile logs under `tmp/benchmarks/`.
117
+ - Include `csv` and `markdown` in default post-merge coverage formats (`POLYRUN_MERGE_FORMATS`).
118
+
119
+ ## 2.1.3 (2026-07-10)
120
+
121
+ - Add `Polyrun::WorkerOutput` for per-shard worker stdout/stderr routing (`POLYRUN_WORKER_OUTPUT_ROUTING=1` or `POLYRUN_WORKER_LOG_DIR`); optional prefixed TTY echo (`POLYRUN_WORKER_OUTPUT_PREFIX=0` for log-only).
122
+ - Add `partition.paths_build.exclude_prefixes` to omit path prefixes from `build-paths` / `start` while keeping files runnable outside polyrun.
123
+ - Add `Polyrun::RSpecSupport.install_example_debug!`, `install_example_timeout!`, `install_example_rails_logging!`, `install_example_prosopite!` (`POLYRUN_EXAMPLE_DEBUG=1` and related env vars).
124
+ - Add `Polyrun::RSpecSupport.install_sharded_formatter_compat!` for progress formatters (e.g. Fuubar) under `POLYRUN_SHARD_*`.
125
+
126
+ ## 2.1.2 (2026-07-05)
127
+
128
+ - Fix per-example timing JSON when RSpec supplies `absolute_file_path` metadata; fix formatter registration when `install_example_timing!` uses a custom output path.
129
+
130
+ ## 2.1.1 (2026-07-05)
131
+
132
+ - Fix HTML coverage report `Encoding::CompatibilityError` when source files contain UTF-8; read templates, assets, and source lines as UTF-8 in `formatters_html.rb`.
133
+
134
+ ## 2.1.0 (2026-07-03)
135
+
136
+ - Add experimental per-example spec quality (`Polyrun::SpecQuality`): `POLYRUN_SPEC_QUALITY=1`, worker JSONL fragments, `merge-spec-quality`, `report-spec-quality`, and `run-shards --merge-spec-quality`.
137
+ - Add `Polyrun::RSpecSupport.install_spec_quality!`, `Polyrun::MinitestSupport.install_spec_quality!`, and Quick example hooks; `polyrun init --profile spec-quality`.
138
+ - Add `Polyrun::Coverage::ExampleDiff` for per-example line hit deltas from `Coverage.peek_result`; record per-example factory counts via `Data::FactoryCounts`.
139
+ - Report zero-hit examples, line churn, hot lines, shard attribution, optional partition hints (`report-spec-quality --plan`), optional CPU/GC/IO profiling (stdlib), and CI gate thresholds in `config/polyrun_spec_quality.yml`.
140
+ - Document spec quality in `docs/SPEC_QUALITY.md`.
141
+
142
+ ## 2.0.0 (2026-07-03)
143
+
144
+ - Add `polyrun run-queue` to init a file-backed queue and run N workers that claim batches until drained; `--on-failure exit|requeue` reclaims open leases when a worker exits before ack.
145
+ - Add `polyrun queue reclaim` with `--older-than DURATION` (`10m`, `1h`, …) and optional `--worker ID`; add `Queue::FileStore#reclaim!` and `#reclaim_lease!`.
146
+ - Add partition imbalance and dominant-file reports after `plan` and `run-shards` (`Partition::Reports`); warn on stale or missing timing coverage before cost-based partition (`Partition::TimingDiagnostics`).
147
+ - Add partition strategies `lazy_robin` (sorted round-robin with timing diagnostics), `preserve_order_round_robin` (paths-file order), `stable_cost_binpack` (stable assignment with LPT fallback), and `weighted_hrw` (rendezvous with `shard_weights`).
148
+ - Add `partition.stable_assignment_file` and `partition.shard_weights` for stable binpack and weighted HRW; wire into `plan` and `run-shards`.
149
+ - Add `Polyrun::Timing::Stats` for rich timing entries (`last_seconds`, `mean`, `p95`, `runs`, `failures`, `timeouts`); `merge-timing` merges via `Stats.merge_entries` and emits `Timing::VarianceReport` warnings.
150
+ - Add `POLYRUN_HRW_FAST_SCORE` for faster deterministic HRW scoring.
151
+ - Auto-select `cost_binpack` when `partition.timing_file` or `--timing` is set and strategy is not explicit; load timing for `lazy_robin` and diagnostics even when strategy stays round-robin.
152
+ - Fix `paths_build` glob stages to match against the remaining pool (`File.fnmatch?`) instead of re-globbing the cwd.
153
+ - Warn when a database URL has no database segment (shard suffix skipped); name `shard_index` in `CloneShards` errors.
154
+ - Refactor LPT forced-item handling into a single pass before free-item balance.
155
+ - Add Makefile, Prayfile, and root `polyrun.yml`; run repo specs via polyrun in CI.
156
+ - BREAKING: `partition.timing_file` without an explicit `strategy` now implies `cost_binpack` instead of `round_robin`.
157
+ - BREAKING: `merge-timing` output entries are objects with timing stats, not bare scalar seconds; tools that read merged JSON must accept objects or use `Stats.binpack_weight`.
158
+ - BREAKING: `paths_build` glob stages filter the staged pool only; membership and order can differ from prior re-glob behavior.
159
+
160
+ ## 1.5.0 (2026-05-04)
161
+
162
+ - Add `run-shards --worker-timeout SEC` and `POLYRUN_WORKER_TIMEOUT_SEC` (wall time per worker since spawn); stop stuck workers; record exit 124 for that shard.
163
+ - Add `run-shards --worker-idle-timeout SEC` and `POLYRUN_WORKER_IDLE_TIMEOUT_SEC`; parent reads monotonic timestamps from `POLYRUN_WORKER_PING_FILE`; record exit 125 when the last ping is stale. Idle applies only after a valid positive ping (use wall timeout until the first ping).
164
+ - Add `Polyrun::WorkerPing` (`ping!`, `ensure_interval_ping_thread!` when `POLYRUN_WORKER_PING_THREAD`). Add `Polyrun::RSpecSupport.install_worker_ping!` and `Polyrun::MinitestSupport.install_worker_ping!`; Polyrun Quick calls `WorkerPing.ping!` around each example. Parent creates ping paths under `tmp/polyrun/` and unlinks files after workers exit.
165
+ - Poll every live shard worker together when timeouts are enabled so idle and wall limits apply to all children, not only the first waiter.
166
+ - Split parallel worker teardown into `RunShardsParallelWait` and `RunShardsWorkerInterrupt`; keep spawn logic in `RunShardsParallelChildren`.
167
+ - Add `Polyrun::Log.orchestration_warn`; when `POLYRUN_ORCHESTRATION_STDERR=1`, copy one line to process `$stderr` if `Log.stderr` is not the same object (custom/null sinks).
168
+ - Wire `env_worker_timeout_sec` / `env_worker_idle_timeout_sec` into `ci-shard-run` plan context. Rescue `Interrupt` around `after_suite` in `run-shards` and `ci-shard` orchestration where suite hooks run.
169
+ - In `Polyrun::Hooks#run_phase`, rescue `Interrupt` for Ruby DSL and shell hook phases (return 130).
170
+ - Document worker timeout, idle ping, and `POLYRUN_ORCHESTRATION_STDERR` in `polyrun help`. Add `sig/polyrun/worker_ping.rbs` and extend `Polyrun::RSpecSupport` / `Polyrun::MinitestSupport` installer signatures.
171
+
172
+ ## 1.4.2 (2026-04-24)
173
+
174
+ - Add richer HTML coverage reports: summary cards, group coverage, sortable file tables, project-relative paths, and per-file source detail.
175
+ - Refactor HTML coverage rendering into stdlib `ERB` templates with `_*.html.erb` partials and isolated `report.css` / `report.js` assets; inline assets into final standalone report.
176
+ - Fix `track_files` coverage scope in `Collector.finish`: keep only files matched by tracked globs, drop unrelated loaded runtime files, and add unloaded tracked files only for non-sharded runs.
177
+ - Add coverage specs for divergent `track_under` / `track_files` configs in serial and sharded finish paths; add `TrackFiles.keep_tracked_files`.
178
+
179
+ ## 1.4.1 (2026-04-16)
180
+
181
+ - Add `polyrun merge-failures` and `run-shards --merge-failures` / `--merge-failures-output` / `--merge-failures-format`; merge per-worker JSONL under `tmp/polyrun_failures/polyrun-failure-fragment-*.jsonl` (or RSpec JSON via `-i`). Run merge after all workers exit, including when a shard failed (`--merge-coverage` still runs only after all shards succeed).
182
+ - Add `Polyrun::Reporting::FailureMerge`, `Polyrun::RSpecSupport.install_failure_fragments!`, and `Polyrun::Reporting::RspecFailureFragmentFormatter`; parent sets `POLYRUN_FAILURE_FRAGMENTS=1` on workers when merge-failures is enabled.
183
+ - Add optional `reporting:` in `polyrun.yml` and `Polyrun::Config#reporting` for merge-failures toggles and paths; honor `POLYRUN_MERGE_FAILURES`, `POLYRUN_MERGED_FAILURES_OUT`, `POLYRUN_MERGED_FAILURES_FORMAT`; set `POLYRUN_MERGED_FAILURES_PATH` for `after_suite` when merge wrote a file.
184
+ - On bad JSONL or non-RSpec JSON, raise `Polyrun::Error` with path and line where applicable; `merge-failures` exits 1 without a full stack trace; a failed merge after successful workers forces `run-shards` exit 1.
185
+ - Fix `run_shards_plan_ready_log` to take `cfg` so debug logging for merge-failures does not raise `NameError`.
186
+
187
+ ## 1.4.0 (2026-04-16)
188
+
189
+ - Add `hooks:` in `polyrun.yml` — shell commands for `before_suite` / `after_suite`, `before_shard` / `after_shard`, `before_worker` / `after_worker` (RSpec-style YAML keys `before(:suite)`, `before(:all)`, `before(:each)` accepted). Wire hooks into `run-shards`, `parallel-rspec`, and `ci-shard-*`.
190
+ - Add `hooks.ruby` / `hooks.ruby_file` and `Polyrun::Hooks::Dsl` (`before(:suite)` … `after(:each)` blocks); worker Ruby hooks run in the child via `ruby -e` + `POLYRUN_HOOKS_RUBY_FILE`.
191
+ - Add `polyrun hook run <phase>` (`--shard` / `--total` optional). Set `POLYRUN_HOOKS_DISABLE=1` to skip hooks during orchestration only; `hook run` still executes.
192
+ - On `ci-shard-run` / `ci-shard-rspec`, skip automatic `before_suite` / `after_suite` when `POLYRUN_SHARD_TOTAL` > 1 (matrix); run suite hooks once via `polyrun hook run` or set `POLYRUN_HOOKS_SUITE_PER_MATRIX_JOB=1` to run them on every matrix job.
193
+ - Document hook phases, matrix vs suite, and `after_shard` ordering in `README.md`; list `Polyrun::Hooks` and `Polyrun::Hooks::Dsl` in the library section.
194
+
195
+ ## 1.3.0 (2026-04-15)
196
+
197
+ - Add safe parsing for `ci-shard-run` / `ci-shard-rspec` `--shard-processes` and `--workers` (warn + exit 2 on missing or non-integer values).
198
+ - Fix `shard_child_env` when `matrix_total > 1` and `matrix_index` is nil: omit `POLYRUN_SHARD_MATRIX_*` and warn (avoid `Integer(nil)`).
199
+ - Document in `polyrun help` that `POLYRUN_SHARD_PROCESSES` and ci-shard `--workers` / `--shard-processes` are local processes per matrix job, distinct from `POLYRUN_WORKERS` / `run-shards`.
200
+ - BREAKING: Multi-worker shard runs may emit coverage JSON fragments whose basenames include `shard*` and `worker*` segments; `merge-coverage` still matches `polyrun-fragment-*.json`.
201
+
202
+ ## 1.2.0 (2026-04-15)
203
+
204
+ - Add `polyrun config <dotted.path>` to print values from `Polyrun::Config::Effective` (same effective tree as runtime: arbitrary YAML paths, merged `prepare.env.<KEY>` as for `polyrun prepare`, resolved `partition.shard_index`, `partition.shard_total`, `partition.timing_granularity`, and `workers`).
205
+ - Memoize `Polyrun::Config::Effective.build` per thread (keyed by config path, object id, and env fingerprint) so repeated `dig` calls do not rebuild the merged tree.
206
+ - Add `DISPATCH_SUBCOMMAND_NAMES` and `IMPLICIT_PATH_EXCLUSION_TOKENS`; route implicit path-only argv against one list (includes `ci-shard-*`, `help`, `version`); add spec that dispatch names match `when` branches in `lib/polyrun/cli.rb`.
207
+ - Run `polyrun` with no subcommand to fan out parallel tests: pick RSpec (`start`), Minitest (`bundle exec rails test` or `bundle exec ruby -I test`), or Polyrun Quick (`bundle exec polyrun quick`) from `spec/**/*_spec.rb` vs `test/**/*_test.rb` vs Quick globs.
208
+ - Accept path-only argv (and optional `run-shards` options before paths, e.g. `--workers`) to shard those files without naming a subcommand; infer suite from `_spec.rb` / `_test.rb` vs other `.rb` files.
209
+ - Add optional `partition.suite` (`auto`, `rspec`, `minitest`, `quick`) when resolving globbed paths for `run-shards` / `parallel-rspec` / default runs.
210
+ - Document implicit argv (known subcommand first vs path-like implicit parallel) and parallel Quick `bundle exec` from app root in `polyrun help` and `examples/README.md`.
211
+ - Comment `detect_auto_suite` glob order in `lib/polyrun/partition/paths.rb` (RSpec/Minitest globs before Quick discovery).
212
+ - Remove redundant `OptionParser` from `polyrun config` (no options; banner only).
213
+
214
+ ## 1.1.0 (2026-04-15)
215
+
216
+ - Add `ci-shard-run` / `ci-shard-rspec` for matrix-style sharding (one job per `POLYRUN_SHARD_INDEX` / `POLYRUN_SHARD_TOTAL`): resolve paths via the same plan as `polyrun plan`, then `exec` the given command with this shard’s paths (unlike `run-shards`, which fans out multiple workers on one host).
217
+ - Add experimental per-example partition timing: `partition.timing_granularity` / `--timing-granularity` (`file` default, `example` for `path:line` items), `POLYRUN_TIMING_GRANULARITY`, merged timing JSON with `absolute_path:line` keys, `TimingKeys.load_costs_json_file`, constraints matching pins/globs on the file part of locators, queue init support, and optional `Polyrun::Timing::RSpecExampleFormatter` plus `Polyrun::RSpecSupport.install_example_timing!`.
218
+ - Add `Polyrun::ProcessStdio.inherit_stdio_spawn_wait` and `spawn_wait` for subprocesses with inherited stdio (or temp-file capture when `silent: true`) to avoid Open3 pipe-thread noise on interrupt; used by prepare (shell / custom assets), `Prepare::Assets.precompile!`, and `Provision.prepare_template!` (`bin/rails db:prepare`). On failure, `db:prepare` / `assets:precompile` embed captured stdout/stderr in `Polyrun::Error` (truncated when huge).
219
+ - Refactor `polyrun plan` around `plan_command_compute_manifest` and `plan_command_build_manifest`; `cmd_plan` output stays aligned with `plan_command_compute_manifest` (tests guard drift).
220
+ - `TimingKeys.load_costs_json_file` accepts optional `root:` for key normalization; warns when two JSON keys normalize to the same entry with different seconds; `TimingKeys.canonical_file_path` / `normalize_locator` resolve directory symlinks so `/var/…` and `/private/var/…` (macOS) map to one key.
221
+ - `Polyrun::RSpecSupport.install_example_timing!(output_path:)` no longer sets `ENV` when an explicit path is passed; formatter uses `timing_output_path` (override or `ENV` / default filename).
222
+ - Fix noisy `IOError` / broken-pipe behavior when interrupting long-running prepare / Rails subprocesses that previously used `Open3.capture3`.
223
+
224
+ ## 1.0.0 (2026-04-14)
225
+
226
+ - Initial stable release of Polyrun: parallel tests, SimpleCov-compatible coverage formatters, fixtures/snapshots, assets and DB provisioning with zero runtime gem dependencies.
227
+ - Add `polyrun` CLI with `plan`, `run-shards`, partition/load balancing, coverage merge and reporting, database helpers, queue helpers, and the Quick runner.
228
+ - Add coverage Rake tasks and YAML configuration for merged / Cobertura-style output.
229
+ - Add database command flows using `db:prepare` (replacing earlier `db:migrate`-only paths) for provisioning-style runs.
230
+ - Implement graceful shutdown for worker processes in `run_shards` when the parent is interrupted.
231
+ - Expand Quick runner defaults and parallel shard database creation.
232
+ - Add examples tree, specs for merge and queue behavior, and docs for cwd-relative configuration.
233
+ - Add RSpec suite, RuboCop (including a FileLength cop), YAML templates, and a `bin/release` script.
234
+ - Add RBS signatures under `sig/` and validate them in CI; expand documentation and specs.
@@ -0,0 +1,26 @@
1
+ # Code of Conduct
2
+
3
+ ## Pledge
4
+
5
+ Participation is a harassment-free experience. Treat each other with respect. Keep private context private.
6
+
7
+ ## Expected behavior
8
+
9
+ - Engage with genuine curiosity. Admit uncertainty.
10
+ - Own every line you submit, including generated code.
11
+ - Correct errors politely.
12
+ - Use language that welcomes people and respects identity and privacy.
13
+
14
+ ## Unacceptable behavior
15
+
16
+ - Harassment, trolling, or insulting comments, public or private.
17
+ - Using jargon or volume, including automated spam, to silence others.
18
+ - Sharing others' data or personal context without permission.
19
+
20
+ ## Automation
21
+
22
+ You remain responsible for bugs, security holes, and bias in generated artifacts you submit.
23
+
24
+ ## Enforcement
25
+
26
+ Report abusive or harassing behavior to contact@kiskolabs.com. Reports are reviewed and investigated.
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,23 @@
1
+ # Contributing Guidelines
2
+
3
+ ## Automation authorship
4
+
5
+ You may use AI and automation tools. You remain the author of every line you submit: review, debug, and understand the change.
6
+
7
+ Keep pull requests small enough to review. Annotate non-obvious logic.
8
+
9
+ Never send project secrets or private context to public models.
10
+
11
+ ## How to contribute
12
+
13
+ ### Reporting issues
14
+
15
+ Verify the facts before filing. Use issue templates for goals, constraints, and reproduction steps.
16
+
17
+ ### Pull requests
18
+
19
+ Keep one pull request to one goal. Explain why the change is needed. Run smoke tests and regression checks locally before opening the request.
20
+
21
+ ### Review
22
+
23
+ Reviewers will ask about approach and trade-offs. Treat suggested changes as part of the work.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Andrei Makarov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,251 @@
1
+ # Polyrun
2
+
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
+
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
+
7
+ Design changes go through `rfcs/` (RFC 0001).
8
+
9
+ ## Ruby support
10
+
11
+ - `polyrun` requires Ruby 3.4 or newer. The main test suite runs on MRI 3.4 and 4.0.
12
+ - Experimental JRuby and TruffleRuby checks cover installation, local and CI sharding, and coverage, timing, failure, and JUnit reports from existing artifacts. JRuby 10.0.8.0 with JDK 21 uses the `java` gem and the Ruby coverage merger. TruffleRuby Native 40.1.0 uses the standard source gem and builds its C extension. The [compatibility workflow](.github/workflows/alternative-rubies.yml) exercises both on Linux x86-64.
13
+ - [`polyrun-legacy`](legacy/README.md) is a separate, experimental gem for MRI Ruby 1.8.7 and newer on POSIX. It provides local and CI sharding, suite configuration, preparation, and coverage, timing, and failure reports. The Legacy smoke check also runs on JRuby and TruffleRuby Native.
14
+
15
+ To check the main gem on another Ruby implementation, set `POLYRUN_ENGINE_RUBY` to the target executable and run `make smoke-engine`. The target builds the Ruby and Java variants of `polyrun` and checks the installed CLI and Bundler's package selection using those local artifacts.
16
+
17
+ JRuby 10.0.8.0 and TruffleRuby Native 40.1.0 collect line coverage. Leave `POLYRUN_COVERAGE_BRANCHES` unset for collection on these releases. You can merge existing branch coverage fragments on either engine.
18
+
19
+ Polyrun can run a Spinel-compiled executable as a shard worker. Set `POLYRUN_SPINEL` to the compiler executable and run `make smoke-spinel` to compile and run a worker that uses the legacy partition library. For full CLI compatibility, see the [Spinel probe](docs/issues/20261201172900_alternative-ruby-implementations.md).
20
+
21
+ ## Why?
22
+
23
+ Running tests in parallel across processes still requires a single merged coverage report, stable shard assignment, isolated databases per worker so rows are not shared, and reliable timing data for cost-based splits—without wiring together many small tools and shell scripts.
24
+
25
+ Polyrun provides:
26
+
27
+ - Orchestration: `plan`, `run-shards`, and `parallel-rspec` / `parallel-minitest` / `parallel-sus` / `parallel-quick` (run-shards plus merge-coverage), with an optional on-disk queue and constraints for file lists and load balancing. Bare `polyrun` (no subcommand) picks the suite from `partition.suite`, else `partition.paths_file`, else filesystem auto-detect (Sus when `config/sus.rb` and `test/**/*.rb` exist). For **GitHub Actions-style matrix sharding** (one job per global shard), use `ci-shard-run -- …` (any test runner), `ci-shard-rspec`, or `ci-shard-sus`—not `run-shards` / `parallel-*`, which fan out N workers on one machine.
28
+ - Coverage: merge SimpleCov-compatible JSON fragments; emit JSON, LCOV, Cobertura, or console summaries (you can drop separate SimpleCov merge plugins for this path).
29
+ - CI reporting: JUnit XML from RSpec JSON; slow-file reports from merged timing JSON.
30
+ - Parallel hygiene: asset digest markers, SQL snapshots, YAML fixture batches, and DB URL or shard helpers aligned with `POLYRUN_SHARD_*`.
31
+ - Optional **`polyrun quick`**: `Polyrun::Quick` — nested `describe` / `with`, `it` / `test`, `before` / `after` / `around`, `let` / `let!` / `subject`, `expect(x).to …` / `expect { }.to raise_exception`, `assert_*`, optional `config/polyrun_quick.rb` (`before_suite` / `after_suite` / `add_load_path`), and optional **`Polyrun::Quick.capybara!`**. Stdlib-only in Polyrun itself. Coverage when `POLYRUN_COVERAGE=1`, Covered-style `COVERAGE`, or `config/polyrun_coverage.yml` + `POLYRUN_QUICK_COVERAGE=1` (not when `POLYRUN_COVERAGE_DISABLE=1`).
32
+ - No runtime gems in the gemspec: stdlib and vendored pieces only.
33
+
34
+ Capybara and Playwright stay in your application; Polyrun does not replace browser drivers.
35
+
36
+ ## How?
37
+
38
+ 1. Add the gem (path or RubyGems) and `require "polyrun"` where you integrate—for example coverage merge in CI or prepare hooks. To pin the executable in your app, run `bundle binstubs polyrun` (writes `bin/polyrun`; ensure `bin/` is on `PATH` or invoke `./bin/polyrun`).
39
+ 2. Add a `polyrun.yml` beside the app, or pass `-c` to point at one. Configure `partition` (paths, shard index and total, strategy), and optionally `databases` (Postgres template and `shard_db_pattern`), `prepare`, and `coverage`. If you use `partition.paths_build`, Polyrun can write `partition.paths_file` (for example `spec/spec_paths.txt`) from globs and ordered stages—substring priorities for integration specs, or a regex stage for “Rails-heavy files first”—without a per-project Ruby script. That step runs before `plan` and `run-shards`. Use `bin/polyrun build-paths` to refresh the paths file only.
40
+ 3. Run prepare once before fan-out—for example `script/ci_prepare` for Vite or webpack builds, and `Polyrun::Prepare::Assets` digest markers. See `examples/TESTING_REQUIREMENTS.md`.
41
+ 4. Run workers with `bin/polyrun run-shards --workers N -- bundle exec rspec`: N separate OS processes, each running RSpec with its own file list from `partition.paths_file`, or `spec/spec_paths.txt`, or else `spec/**/*_spec.rb`. Stderr shows where paths came from; after a successful multi-worker run it reminds you to run merge-coverage unless you use `parallel-rspec` or `run-shards --merge-coverage`.
42
+ 5. Merge artifacts with `bin/polyrun merge-coverage` on `coverage/polyrun-fragment-*.json` (one fragment per `POLYRUN_SHARD_INDEX` when coverage is on), or use `bin/polyrun parallel-rspec` or `run-shards --merge-coverage` so Polyrun runs merge for you. Optional: `merge-timing`, `report-timing`, `report-junit`, `merge-spec-quality`, `report-spec-quality` (experimental per-example spec quality; see [docs/SPEC_QUALITY.md](docs/SPEC_QUALITY.md)).
43
+
44
+ ### Hooks (`hooks:` in `polyrun.yml`)
45
+
46
+ Optional **shell** commands and/or a **Ruby DSL** file for instrumentation (telemetry, Slack, logging, manual debugging). Names mirror RSpec’s API (`before(:suite)`, `before(:all)`, `before(:each)`), but **Polyrun hooks are about process orchestration**, not RSpec example groups. Below, **suite / shard / worker** mean Polyrun’s model unless stated otherwise.
47
+
48
+ #### What “suite”, “shard”, and “worker” mean
49
+
50
+ | Term | Process | Meaning |
51
+ |------|---------|---------|
52
+ | **Suite** | **Parent** only | One **orchestration run** on a single machine: a single `polyrun run-shards` / `parallel-rspec` / `ci-shard-run` (with **one** global shard, see below). `before_suite` runs once before any worker is started; `after_suite` runs once after all workers have exited and (when used) merge-coverage has finished. This is **not** the same as “the whole RSpec suite in one process”—with `--workers N`, RSpec runs in **N separate processes**, each with its own examples. |
53
+ | **Shard** | **Parent** only | One **partition** of the path list for this run, identified by `POLYRUN_SHARD_INDEX` / `POLYRUN_SHARD_TOTAL` **for that parallel layout** (0 … N−1 for `run-shards` with N workers). `before_shard` runs in the parent **immediately before** `Process.spawn` for that index; `after_shard` runs **after** that child has exited. The parent **waits workers in shard index order** (0, then 1, …), so `after_shard` runs in that order—not in “who finished first” order if workers overlap in time. Empty partitions are skipped (no spawn, no hooks). |
54
+ | **Worker** | **Child** OS process | The process that runs your command after `--` (e.g. `bundle exec rspec …`). `before_worker` / `after_worker` run **in that child**, directly before and after the test command. **Individual examples run only after `before_worker` completes** (inside the same process as RSpec/Minitest). |
55
+
56
+ **CI matrix** (`POLYRUN_SHARD_TOTAL` > 1, one job per index): each job is a **global shard**, not a full “suite” in the pipeline sense. **`ci-shard-run` / `ci-shard-rspec` with one process per job do not run `before_suite` / `after_suite` automatically**—otherwise they would run once per matrix cell. Put pipeline-wide setup/teardown in a **separate CI step** (e.g. `bin/polyrun hook run before_suite` and `hook run after_suite` once), or set `POLYRUN_HOOKS_SUITE_PER_MATRIX_JOB=1` to restore the old behaviour (suite hooks on every matrix job). **`before_shard` / `after_shard` / worker hooks still run** per job, with `POLYRUN_SHARD_INDEX` / `POLYRUN_SHARD_TOTAL` set from the matrix. A **single** non-matrix `ci-shard-run` (`POLYRUN_SHARD_TOTAL` is 1) still runs suite hooks like `run-shards --workers 1`. Fan-out on one host (`--shard-processes` > 1) still runs **`before_suite` / `after_suite` once** for that job, around the local workers.
57
+
58
+ #### Lifecycle (typical `run-shards` with multiple workers)
59
+
60
+ ```text
61
+ [Parent] before_suite
62
+ [Parent] for each shard index i that has paths:
63
+ before_shard(i) → spawn worker i
64
+ [Child i] before_worker → test runner starts → examples run → runner exits
65
+ [Parent] after_shard(i) (parent waits children in shard index order 0…N−1, not global finish order)
66
+ [Parent] merge-coverage (if requested)
67
+ [Parent] after_suite
68
+ ```
69
+
70
+ `after_worker` runs in the child after the test command exits, before the parent’s `after_shard`.
71
+
72
+ #### Order and priority within one phase
73
+
74
+ 1. **Ruby DSL, then shell (YAML)** — For the same phase (e.g. `before_suite`), all **Ruby** blocks from `hooks.ruby` run first, then every **shell** command from YAML for that phase.
75
+ 2. **Multiple Ruby blocks** — In one DSL file, registrations run in **source order** (e.g. two `before(:suite)` blocks run top to bottom).
76
+ 3. **Multiple shell commands** — Use a **YAML list**; entries run in list order:
77
+ ```yaml
78
+ before_suite:
79
+ - echo first
80
+ - echo second
81
+ ```
82
+ 4. **Duplicate YAML keys** — Do **not** repeat the same key (e.g. two `before_suite:` lines). Parsers may keep only one value; behaviour is undefined. Prefer a **list** under a single key.
83
+ 5. **Failure** — If any step in a phase fails (non-zero exit from shell; uncaught error in Ruby), orchestration stops or marks failure per existing `run-shards` rules; `after_worker` shell steps use `|| true` so a failing teardown does not mask the test exit code (Ruby `after_worker` is wrapped similarly in the worker script).
84
+
85
+ Environment includes `POLYRUN_HOOK_PHASE`, `POLYRUN_HOOK=1`, `POLYRUN_HOOK_ORCHESTRATOR` (`1` in parent, `0` in workers), `POLYRUN_SHARD_*`, and `POLYRUN_SUITE_EXIT_STATUS` on `after_suite`. Worker children get `POLYRUN_HOOKS_RUBY_FILE` when using the Ruby DSL. Set `POLYRUN_HOOKS_DISABLE=1` to skip hooks during `run-shards` / `parallel-rspec` / `ci-shard-*` (orchestration only); `polyrun hook run` still executes hooks. **`POLYRUN_HOOKS_SUITE_PER_MATRIX_JOB=1`** — when set, run `before_suite` / `after_suite` on every CI matrix job (not recommended for expensive global setup).
86
+
87
+ **YAML keys (shell) and RSpec-style names in YAML:**
88
+
89
+ | YAML key | DSL in `hooks.ruby` | When |
90
+ |----------|----------------------|------|
91
+ | `before_suite` / `after_suite` | `before(:suite)` / `after(:suite)` | Parent: once per orchestration on one host; **skipped** for `ci-shard-run` when `POLYRUN_SHARD_TOTAL` > 1 unless `POLYRUN_HOOKS_SUITE_PER_MATRIX_JOB=1` (see matrix paragraph above) |
92
+ | `before_shard` / `after_shard` | `before(:all)` / `after(:all)` | Parent: per shard index (spawn / after exit) |
93
+ | `before_worker` / `after_worker` | `before(:each)` / `after(:each)` | Child: around the test command |
94
+
95
+ **Ruby DSL (`hooks.ruby` or `hooks.ruby_file`):** path to a `.rb` file (relative to the project root). Blocks receive a `Hash` with **string keys** (same env as shell hooks). Worker-phase Ruby hooks run in the child via `ruby -e 'require "polyrun"; …'`.
96
+
97
+ Run one phase by hand: `bin/polyrun hook run before_suite` (optional `--shard N --total M`). YAML may use quoted keys such as `"before(:suite)"` instead of `before_suite`.
98
+
99
+ Quick CLI samples:
100
+
101
+ If the current directory already has `polyrun.yml` or `config/polyrun.yml`, you can omit `-c` (same as `Config.load` default discovery). Pass `-c PATH` or set `POLYRUN_CONFIG` when the file lives elsewhere or uses another name.
102
+
103
+ ```bash
104
+ bin/polyrun version
105
+ bin/polyrun build-paths # write spec/spec_paths.txt from partition.paths_build (uses polyrun.yml in cwd)
106
+ bin/polyrun ci-shard-run -- bundle exec rspec # CI matrix: shard plan + append paths to the command after --
107
+ bin/polyrun ci-shard-rspec # same as ci-shard-run -- bundle exec rspec
108
+ bin/polyrun parallel-rspec --workers 5 # run-shards + merge-coverage (default: bundle exec rspec)
109
+ bin/polyrun parallel-minitest --workers 5 # same; default rails test or ruby -I test
110
+ bin/polyrun parallel-sus --workers 5 # same; default bundle exec sus (OS processes; use with config/sus.rb)
111
+ bin/polyrun parallel-quick --workers 5 # same; default bundle exec polyrun quick
112
+ bin/polyrun run-shards --workers 5 --merge-coverage -- bundle exec rspec
113
+ bin/polyrun merge-coverage -i cov1.json -i cov2.json -o merged.json --format json,lcov,cobertura,console
114
+ bin/polyrun env --shard 0 --total 4 # print DATABASE_URL exports from polyrun.yml in cwd
115
+ bin/polyrun init --list
116
+ bin/polyrun init --profile gem -o polyrun.yml # starter YAML; see docs/SETUP_PROFILE.md
117
+ bin/polyrun quick # Polyrun::Quick examples under spec/polyrun_quick/ or test/polyrun_quick/
118
+ bin/polyrun hook run before_suite # run hooks.before_suite from polyrun.yml (manual / CI)
119
+ ```
120
+
121
+ ### Matrix shards and timing
122
+
123
+ - `ci-shard-run` — Pass the command as separate words after `--` (e.g. `ci-shard-run -- bundle exec rspec`). One combined string with spaces is split via `Shellwords`, not a full shell; shell-only quoting does not apply.
124
+ - Timing JSON — Run `plan`, `queue init`, and `merge-timing` from the same repository root (cwd) you use when producing `polyrun_timing.json` so path keys normalize consistently. `Polyrun::Partition::Plan.load_timing_costs` and `TimingKeys.load_costs_json_file` accept `root:` to align keys to a fixed directory.
125
+ - Per-example timing (`--timing-granularity example`) — Experimental. Cost maps and plan items scale with example count, not file count; expect larger memory use and slower planning than file mode on big suites.
126
+
127
+ ### Adopting Polyrun (setup profile and scaffolds)
128
+
129
+ - [docs/SETUP_PROFILE.md](docs/SETUP_PROFILE.md) — Checklist for project type (gem, Rails, Appraisal), parallelism target (one CI job with N workers, matrix shards, or a single non-matrix runner), database layout, prepare, spec order, coverage, and CI model A (single runner with `parallel-rspec`) versus model B (matrix plus a merge-coverage job). Treat `polyrun.yml` as the contract; bin scripts and `database.yml` are adapters.
130
+ - `polyrun init` writes a starter `polyrun.yml` or `POLYRUN.md` from built-in templates (`--profile gem`, `rails`, `ci-matrix`, `doc`). Profiles are listed in `examples/templates/README.md`.
131
+
132
+ Runnable Rails demos (multi-DB, Vite, Capybara, Docker, Postgres sketches) live in `examples/README.md`. For development (tests, RuboCop, Appraisal), see [CONTRIBUTING.md](CONTRIBUTING.md).
133
+
134
+ ---
135
+
136
+ ## Library (after `require "polyrun"`)
137
+
138
+ That single require loads the CLI and core library **without** loading RSpec or Minitest. Optional integrations (use only what your app needs):
139
+
140
+ - `require "polyrun/rspec_support"` — `Polyrun::RSpecSupport` registers `ParallelProvisioning` in `before(:suite)` (your app must use RSpec).
141
+ - `require "polyrun/minitest_support"` — `Polyrun::MinitestSupport` is a thin alias for `ParallelProvisioning.run_suite_hooks!` (does not `require "minitest"`).
142
+ - `require "polyrun/reporting/rspec_junit"` — `Polyrun::Reporting::RspecJunit` adds RSpec’s JSON formatter and writes JUnit on exit; RSpec is loaded only inside `RspecJunit.install!`.
143
+
144
+ | API | Purpose |
145
+ |-----|---------|
146
+ | `Polyrun::Quick` (`require "polyrun/quick"`) | Nested `describe`; `it` / `test`; `before` / `after`; `let` / `let!`; `expect(x).to eq` / `be_truthy` / `be_falsey` / `match` / `include`; `assert_*`. Call `Polyrun::Quick.capybara!` after `require "capybara"` (and configure `Capybara.app` in your app) to use `visit`, `page`, etc. Run: `polyrun quick` (defaults: `spec/polyrun_quick/**/*.rb`, `test/polyrun_quick/**/*.rb`). |
147
+ | `Polyrun::Log` | Swappable stderr/stdout for all CLI and library messages. Set `Polyrun.stderr` / `Polyrun.stdout` (or `Polyrun::Log.stderr` / `stdout`) to an `IO`, `StringIO`, or Ruby `Logger`. `Polyrun::Log.reset_io!` clears custom sinks. |
148
+ | `Polyrun::Coverage::Merge` | Merge fragments; formatters for JSON, LCOV, Cobertura, console summary. |
149
+ | `Polyrun::Coverage::Collector` | Stdlib `Coverage` → JSON fragment (`POLYRUN_COVERAGE_DISABLE` to skip); `track_under: %w[lib app]`, filters, optional % gate. |
150
+ | `Polyrun::Coverage::Reporting` | Write all formats to a directory from a blob or merged JSON file. |
151
+ | `Polyrun::Reporting::JUnit` | RSpec `--format json` output or Polyrun testcase JSON → JUnit XML (CI). For RSpec formatter wiring see `Polyrun::Reporting::RspecJunit` (`require "polyrun/reporting/rspec_junit"`). |
152
+ | `Polyrun::Timing::Summary` | Text report of slowest files from merged `polyrun_timing.json`. |
153
+ | `Polyrun::Data::Fixtures` | YAML table batches (`each_table`, `load_directory`, optional `apply_insert_all!` with ActiveRecord). |
154
+ | `Polyrun::Data::CachedFixtures` | Process-local memoized fixture blocks (`register` / `fetch`, stats, `reset!`). |
155
+ | `Polyrun::Data::ParallelProvisioning` | Serial vs parallel-worker suite hooks from `POLYRUN_SHARD_*` / `TEST_ENV_NUMBER`. |
156
+ | `Polyrun::Data::FactoryInstrumentation` | Opt-in FactoryBot patch → `FactoryCounts` (after `require "factory_bot"`). |
157
+ | `Polyrun::Data::SqlSnapshot` | PostgreSQL `pg_dump` / `psql` snapshots under `spec/fixtures/sql_snapshots/`. |
158
+ | `Polyrun::Data::FactoryCounts` | Factory/build counters + summary text. |
159
+ | `Polyrun::RSpecSupport` (`require "polyrun/rspec_support"`) | `install_parallel_provisioning!` → `before(:suite)` hooks. |
160
+ | `Polyrun::MinitestSupport` (`require "polyrun/minitest_support"`) | `install_parallel_provisioning!` → same as `ParallelProvisioning.run_suite_hooks!` (no Minitest gem dependency). |
161
+ | `Polyrun::Reporting::RspecJunit` (`require "polyrun/reporting/rspec_junit"`) | CI: RSpec JSON formatter + JUnit from `install!` (RSpec loaded only there). |
162
+ | `Polyrun::Prepare::Assets` | Digest trees, marker file, `assets:precompile`. |
163
+ | `Polyrun::Database::Shard` | Shard env map, `%{shard}` DB names, URL path suffix for `postgres://`, `mysql2://`, `mongodb://`, etc. |
164
+ | `Polyrun::Database::UrlBuilder` | URLs from `polyrun.yml` `databases:` — nested blocks or `adapter:` for common Rails stacks (`postgresql`, `mysql`/`mysql2`, `trilogy`, `sqlserver`/`mssql`, `sqlite3`/`sqlite`, `mongodb`/`mongo`). |
165
+ | `Polyrun::Database::CloneShards` / `Provision` | PostgreSQL-only template + shard `CREATE DATABASE … TEMPLATE` via `psql`. Non-Postgres configs still use UrlBuilder for env; set `start.databases: false` and provision shards in prepare. |
166
+ | `Polyrun::Hooks` | Load from `Config#hooks`; `run_phase` / `run_phase_if_enabled`; `build_worker_shell_script` wraps the worker command. |
167
+ | `Polyrun::Hooks::Dsl` | Ruby hook file (`hooks.ruby`); `before(:suite)` / `after(:each)` etc. in `config/polyrun_hooks.rb` (see README). |
168
+
169
+ ## Development
170
+
171
+ ```bash
172
+ bundle install
173
+ bundle exec rake spec
174
+ bundle exec rake rbs # optional: validate RBS in sig/
175
+ bundle exec rake ci # RSpec + RuboCop
176
+ ```
177
+
178
+ Tests include subprocess CLI coverage (`spec/polyrun/cli_spec.rb`: merge-coverage across formats, merge-timing, report-junit, report-timing, plan, env with `databases:`, prepare, report-coverage, db:* dry-run and errors) and unit specs for `Coverage::Merge`, `Timing::Merge`, `Timing::Summary`, `Reporting::JUnit`, `Partition::Plan`, `Database::UrlBuilder` and `Shard`, `Prepare::Artifacts`, `Data::*`, `Env::Ci`, `Queue::FileStore`, and `SqlSnapshot` (with `Open3` stubbed for `pg_dump`).
179
+
180
+ Merge performance defaults align with `spec/polyrun/coverage/merge_scale_spec.rb` (~110 files × 310 lines per fragment):
181
+
182
+ ```bash
183
+ ruby benchmarks/merge_coverage.rb
184
+ bundle exec rake bench_merge
185
+ # MERGE_FRAGMENTS=16 MERGE_REPS=2 ruby benchmarks/merge_coverage.rb
186
+ ```
187
+
188
+ 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).
189
+
190
+ Merge is JSON aggregation over coverage fragments; for typical apps it stays well under one second. If merge exceeds ten seconds, Polyrun prints a warning on stderr (override with `POLYRUN_MERGE_SLOW_WARN_SECONDS`; set to `0` to disable).
191
+
192
+ ## CLI (reference)
193
+
194
+ ```bash
195
+ bin/polyrun plan --total 2 --shard 0 a.rb b.rb c.rb
196
+ bin/polyrun plan --total 3 --shard 0 --timing polyrun_timing.json --paths-file spec/spec_paths.txt
197
+ bin/polyrun plan --strategy hrw --total 4 --shard 0 --paths-file spec/spec_paths.txt
198
+ bin/polyrun queue init --paths-file spec/spec_paths.txt --timing polyrun_timing.json --dir .polyrun-queue
199
+ bin/polyrun report-coverage -i merged.json -o coverage/out --format json,lcov,cobertura,console
200
+ bin/polyrun report-junit -i rspec.json -o junit.xml
201
+ bin/polyrun report-timing -i polyrun_timing.json --top 20
202
+ bin/polyrun plan --shard 0 --total 4 # polyrun.yml in cwd
203
+ bin/polyrun prepare --recipe assets --dry-run
204
+ bin/polyrun parallel-rspec --workers 4
205
+ bin/polyrun quick spec/polyrun_quick/smoke.rb
206
+ ```
207
+
208
+ `polyrun.yml` can set `partition.*`, `prepare.recipe` (`default` or `assets`), `prepare.rails_root`, and related keys. `POLYRUN_SHARD_*` overrides configuration where documented; CLI flags override environment variables.
209
+
210
+ Shard index and total in CI (`Polyrun::Env::Ci`): when set, `POLYRUN_SHARD_INDEX` and `POLYRUN_SHARD_TOTAL` take precedence. When `CI` is truthy, `CI_NODE_INDEX` / `CI_NODE_TOTAL` and other parallel-job environment variables are read if present. If your runner does not export those, set `POLYRUN_SHARD_*` from the job matrix.
211
+
212
+ File queue (`polyrun queue …`): batches live on disk under a lock file; paths move from `pending` to `leases` on claim and to `done` on ack. Stale leases can be returned to `pending` with `polyrun queue reclaim --older-than 10m` (or `--worker ID`). Use `polyrun queue status --json` for lease ages. `polyrun run-queue` reclaims a worker's open lease when that worker exits before ack.
213
+
214
+ ## Examples
215
+
216
+ See [`examples/README.md`](examples/README.md) for Rails apps (Capybara, Playwright, Vite, multi-database, Docker Compose, polyrepo). Parallel CI practices: [`examples/TESTING_REQUIREMENTS.md`](examples/TESTING_REQUIREMENTS.md). Behavioral contracts: `spec/polyrun/mandatory_parallel_support_spec.rb`.
217
+
218
+ You can replace SimpleCov and simplecov plugins, parallel_tests, and rspec_junit_formatter with Polyrun for those roles. Use `merge-timing`, `report-timing`, and `Data::FactoryCounts` (optionally with `Data::FactoryInstrumentation`) for slow-file and factory metrics. YAML fixture batches and bulk inserts can use `Data::Fixtures` and `ParallelProvisioning` for shard-aware seeding; wire your own `truncate` and `load_seed` in hooks.
219
+
220
+ ## Links
221
+
222
+ - [GitHub](https://github.com/amkisko/polyrun.rb)
223
+ - [GitLab](https://gitlab.com/amkisko/polyrun.rb)
224
+ - [RubyGems](https://rubygems.org/gems/polyrun)
225
+ - [Versions Atom](https://rubygems.org/gems/polyrun/versions.atom) (feed id `10936755433440`)
226
+ - [libraries.io](https://libraries.io/rubygems/polyrun)
227
+ - [Deps.dev](https://deps.dev/rubygems/polyrun)
228
+ - [SonarCloud](https://sonarcloud.io/project/overview?id=amkisko_polyrun.rb)
229
+ - [Snyk](https://snyk.io/test/github/amkisko/polyrun.rb)
230
+ - [Codecov](https://app.codecov.io/github/amkisko/polyrun.rb)
231
+ - [OpenSSF Scorecard](https://scorecard.dev/viewer/?uri=github.com/amkisko/polyrun.rb)
232
+
233
+ ## License
234
+
235
+ Released under the [MIT License](LICENSE). Copyright (c) 2026 Andrei Makarov.
236
+
237
+ ## Contributing
238
+
239
+ Bug reports and pull requests are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, tests, RuboCop, RBS, optional Trunk, and PR conventions. Community participation follows [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).
240
+
241
+ ## Security
242
+
243
+ Do not open public issues for security vulnerabilities. See [SECURITY.md](SECURITY.md) for how to report them.
244
+
245
+ ## Sponsors
246
+
247
+ Sponsored by [Kisko Labs](https://www.kiskolabs.com).
248
+
249
+ <a href="https://www.kiskolabs.com">
250
+ <img src="kisko.svg" width="200" alt="Sponsored by Kisko Labs" />
251
+ </a>
data/SECURITY.md ADDED
@@ -0,0 +1,25 @@
1
+ # SECURITY
2
+
3
+ ## Reporting a Vulnerability
4
+
5
+ Email security details to: security@kiskolabs.com
6
+
7
+ Send the report only to that address. Include description, steps to reproduce, potential impact, and a suggested fix when you have one.
8
+
9
+ ### Response Timeline
10
+
11
+ - We will acknowledge receipt of your report.
12
+ - We will provide an initial assessment.
13
+ - We will keep you informed of our progress and resolution timeline.
14
+
15
+ ### Disclosure Policy
16
+
17
+ - We will work with you to understand and resolve the issue.
18
+ - We will credit you for the discovery unless you prefer to remain anonymous.
19
+ - We will publish a security advisory after the vulnerability is patched.
20
+ - We will coordinate public disclosure with you.
21
+
22
+ ## Automation Security
23
+
24
+ - Keep production credentials, API keys, and personal data out of prompts sent to third-party models or automation services.
25
+ - Verify automated dependencies.
data/bin/polyrun ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
3
+ require "polyrun"
4
+
5
+ status = Polyrun::CLI.run(ARGV)
6
+ exit(status.nil? ? 0 : status)