polyrun 3.2.0 → 3.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 481c332f389796e80cab9f642f3b5b4c55320cfcf7c2fb1557a50503dccb9fcd
4
- data.tar.gz: 603f44f8a26fc7df0f9305ac7813c2724bbe314d0a4d8046fea8fb2bcaeed9db
3
+ metadata.gz: 5b4bb6c4d573febabfb55c0128372afdd9081534b81c91918656a973ad966629
4
+ data.tar.gz: 392b56954810385270cec9fb0862253354f34af0e62393cf297d878b666c15ef
5
5
  SHA512:
6
- metadata.gz: 69818cd763ba3c92414d11c4e09ddb7aa721daeb009e2fbd8416dd34f0a71e483a7f7264340a09bac3087a581eea53c52d2bc5ffaa7bc9d5f8015f3438638fec
7
- data.tar.gz: 2b0b83322cd207d95f05021eff360ad8e42a8ff58e0e5b6c673074f029cef13cf2e04429c3501e17690f7b90e18c8f8bf54597166e50f3b469958ad770ab2f16
6
+ metadata.gz: 612105bc960df4942e3f5d1e0ca7107856e387ab75cf6ee002a16351d724a986f7d63cc585c83e7c4ef9e7f7f4460570d7947571b677c4dc4d1c81ee2a2b3e37
7
+ data.tar.gz: 2bfc3468f6a9eb1776b142902303ff7abd8995a8bddb7d201da0c53c496e07d62313f2844e9d2a3bba7740be24539508c32e461e9c5c798ba251e1d74481b9cf
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.2.1 (2026-12-03)
4
+
5
+ - Finish installation and use the Ruby coverage merger when native coverage acceleration cannot be built.
6
+ - Reduce the time and memory allocations needed to merge coverage with the Ruby implementation.
7
+
3
8
  ## 3.2.0 (2026-12-01)
4
9
 
5
10
  - 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.
data/README.md CHANGED
@@ -14,6 +14,8 @@ Design changes go through `rfcs/` (RFC 0001).
14
14
 
15
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
16
 
17
+ Coverage merging works without native acceleration. If the optional accelerator fails to compile or link, installation continues and the extension build log records that Polyrun will use Ruby to merge coverage. You can see this log during installation with `gem install --verbose polyrun`. Maintainers can run `make native-extension` to require a working accelerator.
18
+
17
19
  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
20
 
19
21
  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).
@@ -1,3 +1,27 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "mkmf"
2
4
 
3
5
  create_makefile("polyrun_coverage_merge")
6
+ unless enable_config("required-native", false)
7
+ # RubyGems runs clean, all, and install separately. Only the build may fall back.
8
+ File.rename("Makefile", "Makefile.native")
9
+ ruby = %("#{RbConfig.ruby.gsub("$") { "$$" }}")
10
+ skipped = ".native-build-skipped"
11
+ reset = "#{ruby} -e \"File.delete('#{skipped}') if File.exist?('#{skipped}')\""
12
+ native_make = "$(MAKE) -f Makefile.native"
13
+ File.write("Makefile", <<~MAKE)
14
+ all:
15
+ \t@#{reset}
16
+ \t@#{native_make} all || #{ruby} -e "File.write('#{skipped}', ''); warn 'Polyrun will use Ruby to merge coverage.'"
17
+
18
+ install:
19
+ \t@#{ruby} -e "exec(*ARGV, close_others: false) unless File.exist?('#{skipped}')" -- #{native_make} install
20
+
21
+ clean:
22
+ \t@#{native_make} clean
23
+ \t@#{reset}
24
+
25
+ .PHONY: all install clean
26
+ MAKE
27
+ end
@@ -88,11 +88,12 @@ module Polyrun
88
88
  def gate(series_or_metrics, ceilings)
89
89
  metrics = series_or_metrics["metrics"] || series_or_metrics
90
90
  failures = []
91
+ failures << "insufficient_samples" if series_or_metrics["gateable"] == false
91
92
  ceilings.each do |key, limit|
92
93
  next if limit.nil?
93
- next unless metrics.key?(key)
94
94
 
95
- failures << key if metrics[key].to_f > limit.to_f
95
+ value = metrics[key]
96
+ failures << key unless value.is_a?(Numeric) && value.finite? && value <= limit
96
97
  end
97
98
  {"pass" => failures.empty?, "failures" => failures, "metrics" => metrics, "ceilings" => ceilings}
98
99
  end
@@ -10,20 +10,28 @@ module Polyrun
10
10
  module ProcessSample
11
11
  module_function
12
12
 
13
- def sample
14
- times = Process.times
15
- {
16
- "wall_s" => monotonic_s,
17
- "cpu_user_s" => times.utime,
18
- "cpu_system_s" => times.stime,
13
+ def sample(before_workload: false)
14
+ counters = workload_counters unless before_workload
15
+ resources = {
19
16
  "rss_bytes" => rss_bytes,
20
17
  "heap_bytes" => heap_bytes,
21
- "gc" => gc_sample,
22
18
  "storage_bytes" => 0,
23
19
  "network_in_bytes" => 0,
24
20
  "network_out_bytes" => 0
25
21
  }
22
+ resources.merge!(counters || workload_counters)
23
+ end
24
+
25
+ def workload_counters
26
+ times = Process.times
27
+ {
28
+ "wall_s" => monotonic_s,
29
+ "cpu_user_s" => times.utime,
30
+ "cpu_system_s" => times.stime,
31
+ "gc" => gc_sample
32
+ }
26
33
  end
34
+ private_class_method :workload_counters
27
35
 
28
36
  def diff(before, after_sample, extras: {})
29
37
  wall_s = after_sample["wall_s"] - before["wall_s"]
@@ -33,7 +33,7 @@ module Polyrun
33
33
 
34
34
  def measure(label:, ops: nil, gc_start: true, extras: {})
35
35
  GC.start if gc_start
36
- before = sample
36
+ before = ProcessSample.sample(before_workload: true)
37
37
  started = ProcessSample.monotonic_s
38
38
  yield
39
39
  wall_s = ProcessSample.monotonic_s - started
@@ -95,6 +95,8 @@ module Polyrun
95
95
  end
96
96
 
97
97
  def merge_line_hits(left, right)
98
+ return left + right if Integer === left && Integer === right
99
+
98
100
  return right if left.nil?
99
101
  return left if right.nil?
100
102
  return "ignored" if left == "ignored" || right == "ignored"
@@ -137,7 +139,7 @@ module Polyrun
137
139
  end
138
140
  end
139
141
  end
140
- index.values.sort_by { |branch| branch_key(branch) }
142
+ index.keys.sort.map { |key| index.fetch(key) }
141
143
  end
142
144
 
143
145
  def branch_key(branch)
@@ -1,3 +1,3 @@
1
1
  module Polyrun
2
- VERSION = "3.2.0"
2
+ VERSION = "3.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polyrun
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Makarov