rspec-tracer 1.2.0 → 1.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: 4ca4bb6bc03d28906d2dd6456af80031a9bc60a9d05ce761d818f4ef01284f40
4
- data.tar.gz: b2e975d043e9e34a92055312e65be52d41ec34c515fe520b7c063bbde8ddc1eb
3
+ metadata.gz: 9bb2eb98496bfbfaf3582dd4fd91830e35dd9cfd54f242f53c2f445e9957c884
4
+ data.tar.gz: a91f7c646270ec4e7402885d37702f65f3117497dc77ae66afd253075cf8a687
5
5
  SHA512:
6
- metadata.gz: d33f2f0d87397499ce7b72ca197e8496c0f4ceea3ef791a61e74f10db81ed7655d6a0febb72366d24d7931779c305187202d281069fb83194440430112c54fd8
7
- data.tar.gz: 2bd13872430988cdf0285f06a07db02492adb485c4273b1ac48526bb0419f3d27a56d73e64fa3cb111d436e25016c7cf2de75c0876286e16974971f541f08e98
6
+ metadata.gz: 1f205945ef89b10918091f2c2b01ca3634df82ccae6b30b4250053438890d8f8f513551b2b7f50814edfd4bd48f8bac47df97e1ad3758b78260784ec6034abe2
7
+ data.tar.gz: 7ebf412bbce22cba94546e4935691e65cbc47e23304adf178a7cd8b44f3464b1194a6132badf48866d0562b7df4dda1ee4c56466c25d60f77e94067082c82369
data/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ ## [1.2.1] - 2026-05-01
2
+
3
+ ### Fixed
4
+
5
+ - **Parallel-tests merge silently dropped peer caches and left worker
6
+ directories behind** when the spawned-worker count exceeded
7
+ `ENV['PARALLEL_TEST_GROUPS']`. The merge + purge call-sites in
8
+ `lib/rspec_tracer.rb` (`merge_parallel_tests_reports`,
9
+ `merge_parallel_tests_coverage_reports`,
10
+ `purge_parallel_tests_reports`) iterated `1..ENV['PARALLEL_TEST_GROUPS']`
11
+ to construct per-worker directory names. But parallel_tests sets
12
+ `PARALLEL_TEST_GROUPS = num_processes.to_s` for each child, where
13
+ `num_processes` is the user-requested process count
14
+ (`Parallel.processor_count` by default) — not the actual worker
15
+ count. When `num_processes < spawned_worker_count` (e.g. when the
16
+ spec-count partition produces more non-empty groups than
17
+ `num_processes`, or shared-runner CPU detection drifts mid-run),
18
+ peer caches with `TEST_ENV_NUMBER` above the env bound were silently
19
+ dropped from the merge (warm-run skip decisions get made against
20
+ an under-sampled merged manifest) and left behind by the purge
21
+ (visible as straggler `parallel_tests_<N>/` directories under
22
+ `rspec_tracer_cache/`). The same gem behaviour was documented on
23
+ v1.1.1's `last_process?` fix
24
+ ([PR #101](https://github.com/avmnu-sng/rspec-tracer/pull/101)) but
25
+ the iteration call-sites kept the buggy bound. Each method now globs
26
+ the actual `parallel_tests_*` subdirectories under its base path,
27
+ making the merge + purge robust to whatever count parallel_tests
28
+ spawned. No cache format change.
29
+
1
30
  ## [1.2.0] - 2026-04-24
2
31
 
3
32
  ### Added
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RSpecTracer
4
- VERSION = '1.2.0'
4
+ VERSION = '1.2.1'
5
5
  end
data/lib/rspec_tracer.rb CHANGED
@@ -330,12 +330,7 @@ module RSpecTracer
330
330
  starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
331
331
  reports_dir = []
332
332
 
333
- 1.upto(ENV['PARALLEL_TEST_GROUPS'].to_i) do |test_num|
334
- cache_path = File.dirname(RSpecTracer.cache_path)
335
- cache_dir = File.join(cache_path, "parallel_tests_#{test_num}")
336
-
337
- next unless File.directory?(cache_dir)
338
-
333
+ parallel_tests_peer_dirs(File.dirname(RSpecTracer.cache_path)).each do |cache_dir|
339
334
  run_id = JSON.parse(File.read(File.join(cache_dir, 'last_run.json'), encoding: 'UTF-8'))['run_id']
340
335
 
341
336
  reports_dir << File.join(cache_dir, run_id)
@@ -365,14 +360,8 @@ module RSpecTracer
365
360
  return unless parallel_tests_executed? && !simplecov?
366
361
 
367
362
  starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
368
- reports_dir = []
369
363
 
370
- 1.upto(ENV['PARALLEL_TEST_GROUPS'].to_i) do |test_num|
371
- coverage_path = File.dirname(RSpecTracer.coverage_path)
372
- coverage_dir = File.join(coverage_path, "parallel_tests_#{test_num}")
373
-
374
- reports_dir << coverage_dir if File.directory?(coverage_dir)
375
- end
364
+ reports_dir = parallel_tests_peer_dirs(File.dirname(RSpecTracer.coverage_path))
376
365
 
377
366
  coverage_merger.merge(reports_dir)
378
367
 
@@ -401,13 +390,34 @@ module RSpecTracer
401
390
  def purge_parallel_tests_reports
402
391
  return unless parallel_tests_executed?
403
392
 
404
- 1.upto(ENV['PARALLEL_TEST_GROUPS'].to_i) do |test_num|
405
- [RSpecTracer.cache_path, RSpecTracer.coverage_path, RSpecTracer.report_path].each do |path|
406
- FileUtils.rm_rf(File.join(File.dirname(path), "parallel_tests_#{test_num}"))
393
+ [RSpecTracer.cache_path, RSpecTracer.coverage_path, RSpecTracer.report_path].each do |path|
394
+ parallel_tests_peer_dirs(File.dirname(path)).each do |worker_dir|
395
+ FileUtils.rm_rf(worker_dir)
407
396
  end
408
397
  end
409
398
  end
410
399
 
400
+ # Returns every `parallel_tests_*` subdirectory directly under
401
+ # `base_path`. Used by the parallel_tests merge + purge paths.
402
+ #
403
+ # Earlier patches iterated `1..ENV['PARALLEL_TEST_GROUPS'].to_i`
404
+ # to construct dir names, but parallel_tests's own runner sets
405
+ # PARALLEL_TEST_GROUPS to the user-requested process count
406
+ # (`Parallel.processor_count` by default), NOT the actual worker
407
+ # count. When num_processes < spawned_worker_count, the upper
408
+ # bound was too small: peer caches with TEST_ENV_NUMBER above the
409
+ # bound were silently dropped from the merge AND left behind by
410
+ # the purge. PR #101's commit message documented this gem
411
+ # behaviour for `last_process?` detection but did not extend the
412
+ # fix to the iteration call-sites; this method closes that gap.
413
+ # Globbing the actual filesystem state is robust to the env
414
+ # discrepancy regardless of how the gem partitions specs.
415
+ def parallel_tests_peer_dirs(base_path)
416
+ Dir.glob(File.join(base_path, 'parallel_tests_*')).select do |path|
417
+ File.directory?(path)
418
+ end
419
+ end
420
+
411
421
  def parallel_tests_executed?
412
422
  return false unless parallel_tests? && parallel_tests_last_process?
413
423
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-tracer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abhimanyu Singh
@@ -111,7 +111,7 @@ licenses:
111
111
  - MIT
112
112
  metadata:
113
113
  homepage_uri: https://github.com/avmnu-sng/rspec-tracer
114
- source_code_uri: https://github.com/avmnu-sng/rspec-tracer/tree/v1.2.0
114
+ source_code_uri: https://github.com/avmnu-sng/rspec-tracer/tree/v1.2.1
115
115
  changelog_uri: https://github.com/avmnu-sng/rspec-tracer/blob/main/CHANGELOG.md
116
116
  bug_tracker_uri: https://github.com/avmnu-sng/rspec-tracer/issues
117
117
  rdoc_options: []