rspec-tracer 1.0.1 → 1.0.3

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: bd23aee4693655e787948be6a1e049f99942f8bf0b7f763dd7b2df9f04a01eec
4
+ data.tar.gz: a88e6daf316e8f35fecb6661a08c837470c7f0e3396d5e63522c29614e975d6e
5
5
  SHA512:
6
- metadata.gz: c30eb3e54a8c19d7ad560cd03e860a12a9c5ead82a55af2b570e6a29737fb9c213a9ece0d0335b7882e8c65e851093e9f78710efe8df10e40fa54f01d2c84e51
7
- data.tar.gz: fa0db0dd8257fc3841758fafbae04df2bd0abd64950b524ba3df10aace8a7965c11533d28dd78a51a4bfaf45dbdc34b634d48ccdce5b0c565a59ed3ee02cc7a1
6
+ metadata.gz: f9ab2ad270d188230c5d6eb82593055151dcb1f0d43d2c15fb15bab5d96876d8cae12f70c75eff7c80e81c6c53d8930812c173b5e67899f007237170b66deb9a
7
+ data.tar.gz: 9d3ce6ded81c0ce02a6a294d1317a732890ef3814a443e87c5345c65e316463e9266af701fe03520283cf58e1e7ecf9165d5ad45aa224e4f46f5410b0790394a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,63 @@
1
+ ## [1.0.3] - 2026-05-04
2
+
3
+ ### Fixed
4
+
5
+ - **Carry-forward filter contract** — newly-added filters now apply
6
+ uniformly to both fresh attribution AND prior-snapshot carry-forward.
7
+ Previously, `Cache#load_all_files_cache` and `load_dependency_cache`
8
+ read previous-run state without re-applying the current filter list.
9
+ A user adding a new filter mid-development saw the filter take
10
+ effect only for fresh attributions on cold runs; previously-cached
11
+ paths matching the new filter persisted in `all_files` and
12
+ `dependency` until the next cold run. Filter additions now take
13
+ effect on the very next warm run. (from upstream
14
+ [PR #161](https://github.com/avmnu-sng/rspec-tracer/pull/161))
15
+
16
+ ### Note on exclusions
17
+
18
+ The companion default-filter expansion shipped in upstream PR #161
19
+ (adds `rspec_tracer_cache/`, `rspec_tracer_coverage/`,
20
+ `rspec_tracer_report/`, `rspec_tracer.lock` to the default
21
+ `add_filter` / `add_coverage_filter` lists) is intentionally NOT
22
+ backported to this 1.0.x line, for the same reason the broader
23
+ 1.1.0 default-filter expansion was excluded from 1.0.1: changing
24
+ the default filter set shifts the files present in `all_files.json`
25
+ for users who track tracer-self paths, which would invalidate their
26
+ existing caches on upgrade. Users on 1.0.x who want this default
27
+ hygiene can either upgrade to 1.2.x / 2.0.x OR add the four paths
28
+ to their own `.rspec-tracer` config explicitly. The carry-forward
29
+ filter check shipped here MAKES that user-side `add_filter` take
30
+ effect on the next warm run.
31
+
32
+ ## [1.0.2] - 2026-05-01
33
+
34
+ ### Fixed
35
+
36
+ - **Parallel-tests merge silently dropped peer caches and left worker
37
+ directories behind** when the spawned-worker count exceeded
38
+ `ENV['PARALLEL_TEST_GROUPS']`. The merge + purge call-sites in
39
+ `lib/rspec_tracer.rb` (`merge_parallel_tests_reports`,
40
+ `merge_parallel_tests_coverage_reports`,
41
+ `purge_parallel_tests_reports`) iterated `1..ENV['PARALLEL_TEST_GROUPS']`
42
+ to construct per-worker directory names. But parallel_tests sets
43
+ `PARALLEL_TEST_GROUPS = num_processes.to_s` for each child, where
44
+ `num_processes` is the user-requested process count
45
+ (`Parallel.processor_count` by default) — not the actual worker
46
+ count. When `num_processes < spawned_worker_count` (e.g. when the
47
+ spec-count partition produces more non-empty groups than
48
+ `num_processes`, or shared-runner CPU detection drifts mid-run),
49
+ peer caches with `TEST_ENV_NUMBER` above the env bound were silently
50
+ dropped from the merge (warm-run skip decisions get made against
51
+ an under-sampled merged manifest) and left behind by the purge
52
+ (visible as straggler `parallel_tests_<N>/` directories under
53
+ `rspec_tracer_cache/`). The same gem behaviour was documented on
54
+ v1.1.1's `last_process?` fix
55
+ ([PR #101](https://github.com/avmnu-sng/rspec-tracer/pull/101)) but
56
+ the iteration call-sites kept the buggy bound. Each method now globs
57
+ the actual `parallel_tests_*` subdirectories under its base path,
58
+ making the merge + purge robust to whatever count parallel_tests
59
+ spawned. (from v1.2.1) No cache format change.
60
+
1
61
  ## [1.0.1] - 2026-04-24
2
62
 
3
63
  Long-tail maintenance release. Backports high-impact crash and correctness
@@ -152,9 +152,10 @@ module RSpecTracer
152
152
 
153
153
  return unless File.file?(file_name)
154
154
 
155
- @all_files = JSON.parse(File.read(file_name, encoding: 'UTF-8')).transform_values do |files|
155
+ raw = JSON.parse(File.read(file_name, encoding: 'UTF-8')).transform_values do |files|
156
156
  files.transform_keys(&:to_sym)
157
157
  end
158
+ @all_files = raw.reject { |fname, _| filtered_by_current_filters?(fname) }
158
159
  end
159
160
 
160
161
  def load_dependency_cache(cache_dir)
@@ -162,7 +163,18 @@ module RSpecTracer
162
163
 
163
164
  return unless File.file?(file_name)
164
165
 
165
- @dependency = JSON.parse(File.read(file_name, encoding: 'UTF-8')).transform_values(&:to_set)
166
+ raw = JSON.parse(File.read(file_name, encoding: 'UTF-8')).transform_values(&:to_set)
167
+ @dependency = raw.transform_values do |files|
168
+ files.reject { |fname| filtered_by_current_filters?(fname) }.to_set
169
+ end
170
+ end
171
+
172
+ # True iff `file_name` matches any currently-configured filter.
173
+ # Applied at carry-forward seed time so newly-added filters take
174
+ # effect on the very next warm run instead of waiting for a cold
175
+ # run.
176
+ def filtered_by_current_filters?(file_name)
177
+ RSpecTracer.filters.any? { |f| f.match?(file_name: file_name) }
166
178
  end
167
179
 
168
180
  def load_examples_coverage_cache(cache_dir)
@@ -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.3'
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.3
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.3
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: []