rspec-tracer 1.0.1 → 1.0.2

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: 85f9e51c157fec46651a9276dd4b098d4ff749ef07efe66284b8c317b2b4d288
4
- data.tar.gz: 676738fc078e588ac51233939274ed7245c9cdf41145dd86a2cdf7ce7068060d
3
+ metadata.gz: 57dd6b7ba2dafd73bbe30d91e42c36498c7e4fb505e02c405825cf45d8ac0787
4
+ data.tar.gz: e8886b116e2412f566ae908d3f0e2d9213df9ff70e0c88d54a8a4fb28dab9788
5
5
  SHA512:
6
- metadata.gz: c30eb3e54a8c19d7ad560cd03e860a12a9c5ead82a55af2b570e6a29737fb9c213a9ece0d0335b7882e8c65e851093e9f78710efe8df10e40fa54f01d2c84e51
7
- data.tar.gz: fa0db0dd8257fc3841758fafbae04df2bd0abd64950b524ba3df10aace8a7965c11533d28dd78a51a4bfaf45dbdc34b634d48ccdce5b0c565a59ed3ee02cc7a1
6
+ metadata.gz: 88ea3fbe3fef4c4ab2b2d2664ac5915b4e7eaa97b5ecc0d2b77dfeb03604e7f54faf4a567f65ff31235464f351a60e8817527d51f64f5a2717bb267f1cf72261
7
+ data.tar.gz: fbba1feed081e49a4cef7338c05b6d1022ecac5f013b499150b42b817e1cdb13bf2dc29ad993a502d8233bfe52dc89f991ad036eaeb513cde0b5d029b6413a46
data/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ ## [1.0.2] - 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. (from v1.2.1) No cache format change.
29
+
1
30
  ## [1.0.1] - 2026-04-24
2
31
 
3
32
  Long-tail maintenance release. Backports high-impact crash and correctness
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RSpecTracer
4
- VERSION = '1.0.1'
4
+ VERSION = '1.0.2'
5
5
  end
data/lib/rspec_tracer.rb CHANGED
@@ -339,12 +339,7 @@ module RSpecTracer
339
339
  starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
340
340
  reports_dir = []
341
341
 
342
- 1.upto(ENV['PARALLEL_TEST_GROUPS'].to_i) do |test_num|
343
- cache_path = File.dirname(RSpecTracer.cache_path)
344
- cache_dir = File.join(cache_path, "parallel_tests_#{test_num}")
345
-
346
- next unless File.directory?(cache_dir)
347
-
342
+ parallel_tests_peer_dirs(File.dirname(RSpecTracer.cache_path)).each do |cache_dir|
348
343
  run_id = JSON.parse(File.read(File.join(cache_dir, 'last_run.json'), encoding: 'UTF-8'))['run_id']
349
344
 
350
345
  reports_dir << File.join(cache_dir, run_id)
@@ -374,14 +369,8 @@ module RSpecTracer
374
369
  return unless parallel_tests_executed? && !simplecov?
375
370
 
376
371
  starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
377
- reports_dir = []
378
372
 
379
- 1.upto(ENV['PARALLEL_TEST_GROUPS'].to_i) do |test_num|
380
- coverage_path = File.dirname(RSpecTracer.coverage_path)
381
- coverage_dir = File.join(coverage_path, "parallel_tests_#{test_num}")
382
-
383
- reports_dir << coverage_dir if File.directory?(coverage_dir)
384
- end
373
+ reports_dir = parallel_tests_peer_dirs(File.dirname(RSpecTracer.coverage_path))
385
374
 
386
375
  coverage_merger.merge(reports_dir)
387
376
 
@@ -410,13 +399,34 @@ module RSpecTracer
410
399
  def purge_parallel_tests_reports
411
400
  return unless parallel_tests_executed?
412
401
 
413
- 1.upto(ENV['PARALLEL_TEST_GROUPS'].to_i) do |test_num|
414
- [RSpecTracer.cache_path, RSpecTracer.coverage_path, RSpecTracer.report_path].each do |path|
415
- FileUtils.rm_rf(File.join(File.dirname(path), "parallel_tests_#{test_num}"))
402
+ [RSpecTracer.cache_path, RSpecTracer.coverage_path, RSpecTracer.report_path].each do |path|
403
+ parallel_tests_peer_dirs(File.dirname(path)).each do |worker_dir|
404
+ FileUtils.rm_rf(worker_dir)
416
405
  end
417
406
  end
418
407
  end
419
408
 
409
+ # Returns every `parallel_tests_*` subdirectory directly under
410
+ # `base_path`. Used by the parallel_tests merge + purge paths.
411
+ #
412
+ # Earlier patches iterated `1..ENV['PARALLEL_TEST_GROUPS'].to_i`
413
+ # to construct dir names, but parallel_tests's own runner sets
414
+ # PARALLEL_TEST_GROUPS to the user-requested process count
415
+ # (`Parallel.processor_count` by default), NOT the actual worker
416
+ # count. When num_processes < spawned_worker_count, the upper
417
+ # bound was too small: peer caches with TEST_ENV_NUMBER above the
418
+ # bound were silently dropped from the merge AND left behind by
419
+ # the purge. PR #101 (v1.1.1) documented this gem behaviour for
420
+ # `last_process?` detection but did not extend the fix to the
421
+ # iteration call-sites; this method closes that gap. Globbing the
422
+ # actual filesystem state is robust to the env discrepancy
423
+ # regardless of how the gem partitions specs.
424
+ def parallel_tests_peer_dirs(base_path)
425
+ Dir.glob(File.join(base_path, 'parallel_tests_*')).select do |path|
426
+ File.directory?(path)
427
+ end
428
+ end
429
+
420
430
  def parallel_tests_executed?
421
431
  return false unless parallel_tests? && parallel_tests_last_process?
422
432
 
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.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abhimanyu Singh
@@ -118,7 +118,7 @@ licenses:
118
118
  - MIT
119
119
  metadata:
120
120
  homepage_uri: https://github.com/avmnu-sng/rspec-tracer
121
- source_code_uri: https://github.com/avmnu-sng/rspec-tracer/tree/v1.0.1
121
+ source_code_uri: https://github.com/avmnu-sng/rspec-tracer/tree/v1.0.2
122
122
  changelog_uri: https://github.com/avmnu-sng/rspec-tracer/blob/main/CHANGELOG.md
123
123
  bug_tracker_uri: https://github.com/avmnu-sng/rspec-tracer/issues
124
124
  rdoc_options: []