saboteur 0.7.0 → 0.8.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.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +772 -0
  3. data/README.md +221 -1072
  4. data/lib/saboteur/attribute_finder.rb +113 -0
  5. data/lib/saboteur/cli/exit_status.rb +32 -1
  6. data/lib/saboteur/cli/help_options.rb +2 -1
  7. data/lib/saboteur/cli/history_command.rb +135 -0
  8. data/lib/saboteur/cli/presets.rb +47 -3
  9. data/lib/saboteur/cli/run_budget_options.rb +3 -1
  10. data/lib/saboteur/cli/selection_options.rb +31 -0
  11. data/lib/saboteur/cli/shard_options.rb +17 -0
  12. data/lib/saboteur/cli/source_set.rb +35 -0
  13. data/lib/saboteur/cli/survivors_command.rb +157 -0
  14. data/lib/saboteur/cli.rb +74 -55
  15. data/lib/saboteur/config.rb +102 -6
  16. data/lib/saboteur/config_file.rb +19 -7
  17. data/lib/saboteur/constant_reads.rb +182 -0
  18. data/lib/saboteur/constant_subject.rb +70 -0
  19. data/lib/saboteur/constant_subject_finder.rb +281 -0
  20. data/lib/saboteur/coverage_reads.rb +29 -0
  21. data/lib/saboteur/custom_map.rb +12 -1
  22. data/lib/saboteur/dirty_tree_warning.rb +130 -0
  23. data/lib/saboteur/doctor.rb +13 -0
  24. data/lib/saboteur/engine/baseline_guard.rb +135 -21
  25. data/lib/saboteur/engine/boot.rb +11 -3
  26. data/lib/saboteur/engine/bytecode_equivalence.rb +17 -1
  27. data/lib/saboteur/engine/candidate_selection.rb +20 -0
  28. data/lib/saboteur/engine/candidates.rb +43 -3
  29. data/lib/saboteur/engine/coverage_store.rb +58 -14
  30. data/lib/saboteur/engine/defined_order_prefix.rb +43 -0
  31. data/lib/saboteur/engine/diagnostics.rb +19 -1
  32. data/lib/saboteur/engine/distribution.rb +10 -0
  33. data/lib/saboteur/engine/early_stop_recording.rb +3 -2
  34. data/lib/saboteur/engine/gated_run.rb +37 -0
  35. data/lib/saboteur/engine/load_coverage.rb +63 -0
  36. data/lib/saboteur/engine/out_of_scope_guard.rb +21 -0
  37. data/lib/saboteur/engine/pipelines.rb +115 -0
  38. data/lib/saboteur/engine/result_cache.rb +65 -8
  39. data/lib/saboteur/engine/run_budget.rb +32 -2
  40. data/lib/saboteur/engine/sandbox_policy.rb +59 -3
  41. data/lib/saboteur/engine/scheduler.rb +131 -17
  42. data/lib/saboteur/engine/selection_announcement.rb +59 -0
  43. data/lib/saboteur/engine/shard.rb +69 -0
  44. data/lib/saboteur/engine/subject_selection.rb +380 -21
  45. data/lib/saboteur/engine/test_guess.rb +407 -27
  46. data/lib/saboteur/engine/unchanged_syntax.rb +17 -2
  47. data/lib/saboteur/engine.rb +103 -129
  48. data/lib/saboteur/execution/external_runner.rb +489 -0
  49. data/lib/saboteur/execution/fiddle_loader.rb +34 -0
  50. data/lib/saboteur/execution/marker_sweep.rb +80 -0
  51. data/lib/saboteur/execution/peak_memory.rb +28 -0
  52. data/lib/saboteur/execution/process_table.rb +19 -3
  53. data/lib/saboteur/execution/process_tree.rb +65 -5
  54. data/lib/saboteur/execution/reevaluator.rb +75 -12
  55. data/lib/saboteur/execution/runner.rb +46 -7
  56. data/lib/saboteur/execution/sandbox.rb +25 -6
  57. data/lib/saboteur/execution/seatbelt.rb +233 -0
  58. data/lib/saboteur/execution/supervisor.rb +29 -11
  59. data/lib/saboteur/execution/test_command_shape.rb +149 -0
  60. data/lib/saboteur/execution/worker_pool.rb +23 -1
  61. data/lib/saboteur/frameworks/sqlite_memory_database.rb +79 -0
  62. data/lib/saboteur/gates.rb +43 -2
  63. data/lib/saboteur/help.rb +60 -9
  64. data/lib/saboteur/ignore_list.rb +29 -6
  65. data/lib/saboteur/integration/rspec.rb +223 -5
  66. data/lib/saboteur/mutation_source/argument_removal.rb +1 -1
  67. data/lib/saboteur/mutation_source/argument_swap.rb +54 -0
  68. data/lib/saboteur/mutation_source/builtin.rb +28 -5
  69. data/lib/saboteur/mutation_source/chain_removal.rb +1 -1
  70. data/lib/saboteur/mutation_source/condition_negation.rb +1 -1
  71. data/lib/saboteur/mutation_source/constant_literals.rb +66 -0
  72. data/lib/saboteur/mutation_source/element_removal.rb +73 -0
  73. data/lib/saboteur/mutation_source/endpoint_replacement.rb +1 -1
  74. data/lib/saboteur/mutation_source/entry_edits.rb +44 -0
  75. data/lib/saboteur/mutation_source/filter_replacement.rb +1 -1
  76. data/lib/saboteur/mutation_source/hazard_guard.rb +189 -0
  77. data/lib/saboteur/mutation_source/literal_replacement.rb +1 -1
  78. data/lib/saboteur/mutation_source/method_swap.rb +148 -0
  79. data/lib/saboteur/mutation_source/operator_assignment.rb +1 -1
  80. data/lib/saboteur/mutation_source/operator_examples.rb +4 -1
  81. data/lib/saboteur/mutation_source/operator_registry.rb +5 -2
  82. data/lib/saboteur/mutation_source/operator_visit.rb +1 -1
  83. data/lib/saboteur/mutation_source/pair_removal.rb +13 -31
  84. data/lib/saboteur/mutation_source/range_replacement.rb +1 -1
  85. data/lib/saboteur/mutation_source/regex_replacement.rb +93 -0
  86. data/lib/saboteur/preview.rb +125 -12
  87. data/lib/saboteur/refinement_activations.rb +60 -0
  88. data/lib/saboteur/reporter/agent.rb +9 -1
  89. data/lib/saboteur/reporter/agent_commands.rb +10 -3
  90. data/lib/saboteur/reporter/agent_incomplete.rb +31 -5
  91. data/lib/saboteur/reporter/agent_summary.rb +4 -3
  92. data/lib/saboteur/reporter/findings.rb +5 -2
  93. data/lib/saboteur/reporter/history_policy.rb +11 -0
  94. data/lib/saboteur/reporter/history_reader.rb +47 -0
  95. data/lib/saboteur/reporter/html.rb +26 -4
  96. data/lib/saboteur/reporter/mutation_text.rb +6 -0
  97. data/lib/saboteur/reporter/stryker.rb +27 -3
  98. data/lib/saboteur/reporter/survivor_classification.rb +101 -0
  99. data/lib/saboteur/reporter/survivor_list.rb +15 -9
  100. data/lib/saboteur/reporter/terminal.rb +56 -8
  101. data/lib/saboteur/result.rb +19 -3
  102. data/lib/saboteur/selection/coverage_map.rb +120 -10
  103. data/lib/saboteur/selection/dependency_shield.rb +80 -0
  104. data/lib/saboteur/selection/external_test_map.rb +27 -0
  105. data/lib/saboteur/selection/git_diff.rb +93 -11
  106. data/lib/saboteur/selection/layout_only_lines.rb +80 -0
  107. data/lib/saboteur/selection/recorder.rb +22 -4
  108. data/lib/saboteur/selection/source_scope.rb +22 -0
  109. data/lib/saboteur/subject.rb +42 -7
  110. data/lib/saboteur/subject_finder.rb +173 -29
  111. data/lib/saboteur/version.rb +1 -1
  112. data/lib/saboteur/working_tree.rb +38 -15
  113. data/lib/saboteur.rb +14 -0
  114. metadata +39 -16
@@ -10,15 +10,17 @@ module Saboteur
10
10
  # Included: instance methods and `def self.x` inside a class or module,
11
11
  # defs inside `class << self`, and defs passed to a receiverless call such
12
12
  # as `private def x`. Skipped: top-level defs, defs nested in defs, and
13
- # `def obj.x` for obj != self. Defs in blocks (`Class.new do`, `included do`)
13
+ # `def obj.x` for obj != self. Defs in blocks (`included do`, builders)
14
14
  # are found but marked skipped ("defined inside a block"), so the report
15
- # names them instead of leaving them out. `X = Data.define`, `Struct.new`,
16
- # `Class.new` or `Module.new` with a block names X as the owner; any other
17
- # block, and a `A::X = ...` target, keeps the enclosing owner or the
18
- # placeholder.
15
+ # names them instead of leaving them out - except the four core class
16
+ # factories: `X = Data.define`, `Struct.new`, `Class.new` or `Module.new`
17
+ # with a block names X as the owner, and its defs are ordinary subjects
18
+ # that re-evaluate through X.class_eval (#290). Any other block, and a
19
+ # `A::X = ...` target, keeps the enclosing owner or the placeholder.
19
20
  class SubjectFinder
20
21
  Parsed = Data.define(:subjects, :errors)
21
22
  ANONYMOUS_OWNER = "(anonymous block)"
23
+ CALL_DEFINED_SINGLETONS = %i[scope define_singleton_method].freeze
22
24
  CLASS_FACTORIES = { Data: :define, Struct: :new, Class: :new, Module: :new }.freeze
23
25
 
24
26
  # source: the text to parse when it is not the file on disk (the file as
@@ -51,24 +53,142 @@ module Saboteur
51
53
  when Prism::ConstantWriteNode
52
54
  walk_constant_assignment(node, nesting, out, **ctx)
53
55
  when Prism::ModuleNode
54
- walk(node.body, nesting + [Scope.new(kind: :module, path: node.constant_path.slice)], out, **ctx)
56
+ scope = Scope.new(kind: :module, path: node.constant_path.slice)
57
+ walk(node.body, lexical_nesting(nesting) + [scope], out, **ctx)
55
58
  when Prism::ClassNode
56
- walk(node.body, nesting + [Scope.new(kind: :class, path: node.constant_path.slice)], out, **ctx)
59
+ scope = Scope.new(kind: :class, path: node.constant_path.slice)
60
+ walk(node.body, lexical_nesting(nesting) + [scope], out, **ctx)
57
61
  when Prism::SingletonClassNode
58
62
  walk_singleton_class(node, nesting, out, **ctx)
59
63
  when Prism::StatementsNode
60
- previous_child = nil
61
- node.body.each do |child|
62
- walk(child, nesting, out, previous: previous_child, **ctx)
63
- previous_child = child
64
- end
64
+ walk_statements(node, nesting, out, **ctx)
65
65
  when Prism::DefNode
66
66
  add_subject(node, nesting, out, previous: previous, **ctx)
67
+ when Prism::CallNode
68
+ walk_call(node, nesting, out, **ctx)
67
69
  else
68
70
  node.compact_child_nodes.each { |child| walk(child, nesting, out, **ctx) }
69
71
  end
70
72
  end
71
73
 
74
+ # `define_method(:m) { ... }` is a method definition: the block body is
75
+ # the method body, and re-evaluating the whole call redefines the method
76
+ # on the enclosing owner (#194). Only a bare call with a literal name and
77
+ # a block counts; a computed name, an explicit receiver, or a lambda
78
+ # argument says nothing the finder can name.
79
+ # A define_method subject's body is its block; any other call is walked
80
+ # through its children.
81
+ def walk_call(node, nesting, out, **ctx)
82
+ return walk_heredoc_eval(node, nesting, out, **ctx) if heredoc_eval?(node)
83
+ return walk_children(node, nesting, out, **ctx) unless call_defined_method?(node)
84
+
85
+ in_sclass = nesting.last&.sclass? || false
86
+ owner = owner_path(nesting)
87
+ owner ||= ANONYMOUS_OWNER if ctx[:in_block]
88
+ return walk_children(node, nesting, out, **ctx) unless owner
89
+
90
+ name = node.arguments.arguments.first.unescaped.to_sym
91
+ # scope and define_singleton_method define on the class itself;
92
+ # define_method follows the surrounding nesting like a def (#194).
93
+ singleton = in_sclass || CALL_DEFINED_SINGLETONS.include?(node.name)
94
+ subject = Subject.new(name: name, owner: owner, singleton: singleton, sclass: in_sclass,
95
+ file: ctx[:file], node: node, file_source: ctx[:source], nesting: nesting,
96
+ frozen_literals: ctx[:frozen], sig_span: nil)
97
+ subject.skip_reason = "defined inside a block" if ctx[:in_block]
98
+ out << subject
99
+ end
100
+
101
+ # Statements carry `previous` so a def can see the sig comment above it.
102
+ def walk_statements(node, nesting, out, **ctx)
103
+ previous_child = nil
104
+ node.body.each do |child|
105
+ walk(child, nesting, out, previous: previous_child, **ctx)
106
+ previous_child = child
107
+ end
108
+ end
109
+
110
+ def walk_children(node, nesting, out, **ctx)
111
+ node.compact_child_nodes.each { |child| walk(child, nesting, out, **ctx) }
112
+ end
113
+
114
+ # `class_eval <<-RUBY ... RUBY` with a non-interpolated heredoc defines
115
+ # methods on the enclosing owner (#544). Only a bare call with one
116
+ # heredoc argument counts: an explicit receiver names another owner, and
117
+ # an interpolated heredoc does not map to file bytes 1:1, so it stays on
118
+ # the code-in-strings warning (#467).
119
+ def heredoc_eval?(node)
120
+ return false unless %i[class_eval module_eval].include?(node.name) && node.receiver.nil? && node.block.nil?
121
+
122
+ arguments = node.arguments&.arguments
123
+ return false unless arguments&.size == 1
124
+
125
+ heredoc = arguments.first
126
+ heredoc.is_a?(Prism::StringNode) && heredoc.opening_loc&.slice&.start_with?("<<")
127
+ end
128
+
129
+ # The heredoc body's bytes sit in the real file 1:1, so blanking every
130
+ # byte outside the body (keeping newlines) parses the defs at their
131
+ # real offsets and lines: mutants apply through the ordinary file-bytes
132
+ # path. The enclosing nesting supplies the owner. A body that does not
133
+ # parse defines nothing.
134
+ def walk_heredoc_eval(node, nesting, out, **ctx)
135
+ location = node.arguments.arguments.first.content_loc
136
+ virtual = blank_outside(ctx[:source], location.start_offset...location.end_offset)
137
+ result = Prism.parse(virtual, filepath: ctx[:file])
138
+ return if result.failure?
139
+
140
+ walk(result.value, nesting, out, **ctx)
141
+ end
142
+
143
+ # source with every byte outside range spaced over, except newlines:
144
+ # offsets and lines inside range stay exactly as in the real file.
145
+ def blank_outside(source, range)
146
+ source.bytes.each_with_index.map { |byte, index| range.cover?(index) || byte == 10 ? byte : 32 }.pack("C*")
147
+ .force_encoding(source.encoding)
148
+ end
149
+
150
+ def define_method_subject?(node)
151
+ return false unless node.name == :define_method && node.receiver.nil?
152
+ return false unless node.block.is_a?(Prism::BlockNode)
153
+
154
+ # With two arguments the second is the body and the block is dead code.
155
+ return false unless node.arguments&.arguments&.size == 1
156
+
157
+ name_arg = node.arguments.arguments.first
158
+ name_arg.is_a?(Prism::SymbolNode) || name_arg.is_a?(Prism::StringNode)
159
+ end
160
+
161
+ # Calls that define a method, all with a literal first argument for the
162
+ # name: define_method (instance, or singleton inside class << self) and
163
+ # the two class-level shapes the human-essentials dogfood exposed,
164
+ # `scope :name, -> { ... }` and define_singleton_method (#194). The
165
+ # whole call is the subject's source and re-evaluates on the owner.
166
+ def call_defined_method?(node)
167
+ return false unless node.receiver.nil?
168
+ return false unless literal_name?(node)
169
+
170
+ case node.name
171
+ when :define_method then define_method_subject?(node)
172
+ when :define_singleton_method then lambda_body?(node) || block_only?(node)
173
+ # Rails scope: exactly a literal name and a lambda body.
174
+ when :scope then lambda_body?(node) && node.arguments.arguments.size == 2
175
+ else false
176
+ end
177
+ end
178
+
179
+ def literal_name?(node)
180
+ name_arg = node.arguments&.arguments&.first
181
+ name_arg.is_a?(Prism::SymbolNode) || name_arg.is_a?(Prism::StringNode)
182
+ end
183
+
184
+ def lambda_body?(node)
185
+ node.block.nil? && node.arguments&.arguments&.last.is_a?(Prism::LambdaNode)
186
+ end
187
+
188
+ def block_only?(node)
189
+ node.block.is_a?(Prism::BlockNode) && node.arguments&.arguments&.size == 1
190
+ end
191
+
72
192
  # `Point = Data.define(:x) do ... end`: the defs belong to Point. Only the
73
193
  # four core factories count, called on the bare constant; any other call
74
194
  # that takes a block says nothing about the class it returns.
@@ -77,9 +197,24 @@ module Saboteur
77
197
  return node.compact_child_nodes.each { |child| walk(child, nesting, out, **ctx) } unless class_factory?(call)
78
198
 
79
199
  # The receiver and arguments stay in the enclosing scope; only the
80
- # factory's own block belongs to the new class.
200
+ # factory's own block belongs to the new class. The block's body is
201
+ # walked directly, not as a block: the factory names its class, so the
202
+ # defs re-evaluate through X.class_eval and are ordinary subjects
203
+ # (#290), while a block nested deeper still marks its defs skipped.
81
204
  (call.compact_child_nodes - [call.block]).each { |child| walk(child, nesting, out, **ctx) }
82
- walk(call.block, nesting + [Scope.new(kind: :class, path: node.name.to_s)], out, **ctx)
205
+ walk(call.block.body, lexical_nesting(nesting) + [Scope.new(kind: :factory, path: node.name.to_s)], out, **ctx)
206
+ end
207
+
208
+ # Constant-introducing declarations (class/module keywords and factory
209
+ # assignments) bind on the enclosing lexical scope: factory blocks open
210
+ # none, so their scopes never join a new constant's path (#339) - unless
211
+ # an sclass follows the factory: `class << self` inside a factory block
212
+ # attaches to the factory's class at runtime (class_eval sets self), and
213
+ # the sclass needs the factory's path to name that attachment (#438).
214
+ def lexical_nesting(nesting)
215
+ nesting.each_with_index.reject do |scope, index|
216
+ scope.factory? && nesting[(index + 1)..].none?(&:sclass?)
217
+ end.map(&:first)
83
218
  end
84
219
 
85
220
  def class_factory?(call)
@@ -123,26 +258,35 @@ module Saboteur
123
258
  end
124
259
 
125
260
  # Lexical path of the enclosing class/module. `class ::Foo` restarts at the top.
261
+ # A bare `class << self` scope leaves the owner alone (its defs are the
262
+ # attached class's singleton methods), but a factory constant assigned
263
+ # through it binds on the singleton class (#352), so the sclass renders
264
+ # as a `singleton_class` path segment when a factory scope sits after it
265
+ # (#406): `Host.singleton_class::Widget`, mirroring the constant side
266
+ # (#380).
126
267
  def owner_path(nesting)
127
- parts = nesting.reject(&:sclass?).map(&:path)
128
- return nil if parts.empty?
268
+ segments = nesting.each_with_index.filter_map do |scope, index|
269
+ if scope.sclass?
270
+ :singleton_class if nesting[(index + 1)..].any?(&:factory?)
271
+ else
272
+ scope.path
273
+ end
274
+ end
275
+ return nil if segments.empty?
129
276
 
130
- parts.each_with_object([]) do |path, acc|
131
- acc.clear if path.start_with?("::")
132
- acc << path.delete_prefix("::")
133
- end.join("::")
277
+ segments.each_with_object(+"") do |segment, out|
278
+ if segment == :singleton_class
279
+ out << ".singleton_class"
280
+ else
281
+ out.clear if segment.start_with?("::")
282
+ out << "::" unless out.empty?
283
+ out << segment.delete_prefix("::")
284
+ end
285
+ end
134
286
  end
135
287
 
136
288
  def mark_refinements(subjects, program)
137
- return unless uses_refinements?(program)
138
-
139
- subjects.each { |subject| subject.skip_reason = "refinements" }
140
- end
141
-
142
- def uses_refinements?(node)
143
- return true if node.is_a?(Prism::CallNode) && node.name == :using && node.receiver.nil?
144
-
145
- node.compact_child_nodes.any? { |child| uses_refinements?(child) }
289
+ RefinementActivations.mark(subjects, program)
146
290
  end
147
291
  end
148
292
  end
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Saboteur
5
- VERSION = "0.7.0"
5
+ VERSION = "0.8.1"
6
6
  end
@@ -2,6 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "open3"
5
+ require_relative "text"
5
6
 
6
7
  module Saboteur
7
8
  # The state of the working source a run looked at: the commit it was on and
@@ -11,23 +12,25 @@ module Saboteur
11
12
  # report from an earlier run does not make the tree look dirty. Without git, or
12
13
  # outside a repository, the state is unknown.
13
14
  class WorkingTree
14
- State = Data.define(:head, :dirty, :changed_files) do
15
- def label
16
- return "unknown" if dirty.nil?
15
+ # One uncommitted change: its path relative to the root (the new path
16
+ # of a rename, the old path of a deletion) and whether git tracks it.
17
+ Change = Data.define(:path, :tracked)
17
18
 
18
- dirty ? "dirty" : "clean"
19
+ State = Data.define(:head, :dirty, :changed_files, :changes) do
20
+ def initialize(head:, dirty:, changed_files:, changes: [])
21
+ super
19
22
  end
20
23
 
21
- # Shown before a run: mutants run your code and can change the tree.
22
- def warning
23
- return unless dirty
24
+ def label
25
+ return "unknown" if dirty.nil?
24
26
 
25
- "saboteur: warning: #{changed_files} uncommitted change(s) in the working tree. " \
26
- "Mutants run your code and could alter or delete files; run on a clean, committed tree or a CI checkout."
27
+ dirty ? "dirty" : "clean"
27
28
  end
28
29
  end
29
30
 
30
31
  UNKNOWN = State.new(head: nil, dirty: nil, changed_files: nil)
32
+ UNTRACKED = "??"
33
+ RENAMED_OR_COPIED = /[RC]/
31
34
 
32
35
  # ignored: paths relative to root that are not source (saboteur's cache and reports).
33
36
  def initialize(root, ignored: [])
@@ -35,22 +38,42 @@ module Saboteur
35
38
  @ignored = ignored
36
39
  end
37
40
 
41
+ # git status names paths from the top of the repository; the prefix
42
+ # turns them into paths relative to the root.
38
43
  def state
39
- head, head_status = Open3.capture2e("git", "rev-parse", "HEAD", chdir: @root)
40
- changes, changes_status = Open3.capture2e(*status_command, chdir: @root)
41
- return UNKNOWN unless head_status.success? && changes_status.success?
44
+ head, _, head_status = Open3.capture3("git", "rev-parse", "HEAD", "--show-prefix", chdir: @root)
45
+ status, _, status_status = Open3.capture3(*status_command, chdir: @root)
46
+ return UNKNOWN unless head_status.success? && status_status.success?
42
47
 
43
- count = changes.lines.size
44
- State.new(head: head.strip, dirty: count.positive?, changed_files: count)
48
+ sha, prefix = head.lines.map(&:chomp)
49
+ changes = changes_in(status, Text.utf8_identity(prefix.to_s))
50
+ State.new(head: sha, dirty: changes.any?, changed_files: changes.size, changes: changes)
45
51
  rescue SystemCallError
46
52
  UNKNOWN
47
53
  end
48
54
 
49
55
  private
50
56
 
57
+ # Porcelain v1 with -z: "XY path" entries separated by NUL, a rename or
58
+ # copy followed by one more entry holding its old path.
59
+ def changes_in(status, prefix)
60
+ entries = status.b.split("\0")
61
+ changes = []
62
+ until entries.empty?
63
+ entry = entries.shift
64
+ code = entry[0, 2]
65
+ entries.shift if code.match?(RENAMED_OR_COPIED)
66
+ path = Text.utf8_identity(entry[3..]).delete_prefix(prefix)
67
+ changes << Change.new(path: path, tracked: code != UNTRACKED)
68
+ end
69
+ changes
70
+ end
71
+
72
+ # -z implies --porcelain=v1, and status takes no revisions, so the
73
+ # pathspecs need no "--" in front.
51
74
  def status_command
52
75
  excluded = @ignored.map { |path| ":(exclude)#{path}" }
53
- ["git", "status", "--porcelain", "--untracked-files=all", "--", ".", *excluded]
76
+ ["git", "status", "-z", "--untracked-files=all", ".", *excluded]
54
77
  end
55
78
  end
56
79
  end
data/lib/saboteur.rb CHANGED
@@ -43,25 +43,37 @@ module Saboteur
43
43
  end
44
44
  end
45
45
 
46
+ require_relative "saboteur/coverage_reads"
46
47
  require_relative "saboteur/hooks"
47
48
  require_relative "saboteur/mutation_source/base"
48
49
  require_relative "saboteur/mutation_source/builtin"
49
50
  require_relative "saboteur/integration/base"
50
51
  require_relative "saboteur/subject"
52
+ require_relative "saboteur/refinement_activations"
51
53
  require_relative "saboteur/subject_finder"
54
+ require_relative "saboteur/attribute_finder"
55
+ require_relative "saboteur/constant_subject"
56
+ require_relative "saboteur/constant_subject_finder"
57
+ require_relative "saboteur/constant_reads"
58
+ require_relative "saboteur/mutation_source/constant_literals"
52
59
  require_relative "saboteur/execution/protocol"
53
60
  require_relative "saboteur/execution/process_table"
54
61
  require_relative "saboteur/execution/process_tree"
62
+ require_relative "saboteur/execution/marker_sweep"
55
63
  require_relative "saboteur/execution/supervisor"
56
64
  require_relative "saboteur/execution/reevaluator"
57
65
  require_relative "saboteur/execution/wrapper"
58
66
  require_relative "saboteur/execution/runner"
67
+ require_relative "saboteur/execution/external_runner"
59
68
  require_relative "saboteur/execution/worker_pool"
60
69
  require_relative "saboteur/execution/fork_readiness"
61
70
  require_relative "saboteur/execution/sandbox"
71
+ require_relative "saboteur/execution/seatbelt"
62
72
  require_relative "saboteur/selection/coverage_map"
73
+ require_relative "saboteur/selection/external_test_map"
63
74
  require_relative "saboteur/selection/recorder"
64
75
  require_relative "saboteur/selection/git_diff"
76
+ require_relative "saboteur/selection/source_scope"
65
77
  require_relative "saboteur/result"
66
78
  require_relative "saboteur/custom_map"
67
79
  require_relative "saboteur/gates"
@@ -72,8 +84,10 @@ require_relative "saboteur/reporter/diff"
72
84
  require_relative "saboteur/reporter/findings"
73
85
  require_relative "saboteur/reporter/agent"
74
86
  require_relative "saboteur/working_tree"
87
+ require_relative "saboteur/dirty_tree_warning"
75
88
  require_relative "saboteur/agent_skill"
76
89
  require_relative "saboteur/reporter/terminal"
77
90
  require_relative "saboteur/reporter/stryker"
91
+ require_relative "saboteur/reporter/survivor_classification"
78
92
  require_relative "saboteur/reporter/html"
79
93
  require_relative "saboteur/engine"
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saboteur
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vamsi Pavan Mahesh Gunturu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-16 00:00:00.000000000 Z
11
+ date: 2026-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: fiddle
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '1.1'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '1.1'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: prism
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -61,6 +47,7 @@ files:
61
47
  - lib/generators/saboteur/install/install_generator.rb
62
48
  - lib/saboteur.rb
63
49
  - lib/saboteur/agent_skill.rb
50
+ - lib/saboteur/attribute_finder.rb
64
51
  - lib/saboteur/baseline/acceptance.rb
65
52
  - lib/saboteur/baseline/command.rb
66
53
  - lib/saboteur/baseline/comparison.rb
@@ -74,13 +61,23 @@ files:
74
61
  - lib/saboteur/cli.rb
75
62
  - lib/saboteur/cli/exit_status.rb
76
63
  - lib/saboteur/cli/help_options.rb
64
+ - lib/saboteur/cli/history_command.rb
77
65
  - lib/saboteur/cli/presets.rb
78
66
  - lib/saboteur/cli/run_budget_options.rb
79
67
  - lib/saboteur/cli/run_reporting.rb
68
+ - lib/saboteur/cli/selection_options.rb
69
+ - lib/saboteur/cli/shard_options.rb
70
+ - lib/saboteur/cli/source_set.rb
71
+ - lib/saboteur/cli/survivors_command.rb
80
72
  - lib/saboteur/config.rb
81
73
  - lib/saboteur/config_file.rb
74
+ - lib/saboteur/constant_reads.rb
75
+ - lib/saboteur/constant_subject.rb
76
+ - lib/saboteur/constant_subject_finder.rb
77
+ - lib/saboteur/coverage_reads.rb
82
78
  - lib/saboteur/crash_report.rb
83
79
  - lib/saboteur/custom_map.rb
80
+ - lib/saboteur/dirty_tree_warning.rb
84
81
  - lib/saboteur/doctor.rb
85
82
  - lib/saboteur/engine.rb
86
83
  - lib/saboteur/engine/baseline_guard.rb
@@ -92,15 +89,22 @@ files:
92
89
  - lib/saboteur/engine/coverage_guard.rb
93
90
  - lib/saboteur/engine/coverage_store.rb
94
91
  - lib/saboteur/engine/data_inputs.rb
92
+ - lib/saboteur/engine/defined_order_prefix.rb
95
93
  - lib/saboteur/engine/diagnostics.rb
96
94
  - lib/saboteur/engine/diff_scope.rb
97
95
  - lib/saboteur/engine/distribution.rb
98
96
  - lib/saboteur/engine/early_stop_recording.rb
97
+ - lib/saboteur/engine/gated_run.rb
98
+ - lib/saboteur/engine/load_coverage.rb
99
+ - lib/saboteur/engine/out_of_scope_guard.rb
100
+ - lib/saboteur/engine/pipelines.rb
99
101
  - lib/saboteur/engine/result_cache.rb
100
102
  - lib/saboteur/engine/run_budget.rb
101
103
  - lib/saboteur/engine/run_fingerprint.rb
102
104
  - lib/saboteur/engine/sandbox_policy.rb
103
105
  - lib/saboteur/engine/scheduler.rb
106
+ - lib/saboteur/engine/selection_announcement.rb
107
+ - lib/saboteur/engine/shard.rb
104
108
  - lib/saboteur/engine/subject_selection.rb
105
109
  - lib/saboteur/engine/suite_files.rb
106
110
  - lib/saboteur/engine/test_guess.rb
@@ -108,19 +112,26 @@ files:
108
112
  - lib/saboteur/engine/unchanged_syntax.rb
109
113
  - lib/saboteur/engine/unscoped_suite_warning.rb
110
114
  - lib/saboteur/engine/verdict_check.rb
115
+ - lib/saboteur/execution/external_runner.rb
116
+ - lib/saboteur/execution/fiddle_loader.rb
111
117
  - lib/saboteur/execution/fork_readiness.rb
118
+ - lib/saboteur/execution/marker_sweep.rb
119
+ - lib/saboteur/execution/peak_memory.rb
112
120
  - lib/saboteur/execution/process_table.rb
113
121
  - lib/saboteur/execution/process_tree.rb
114
122
  - lib/saboteur/execution/protocol.rb
115
123
  - lib/saboteur/execution/reevaluator.rb
116
124
  - lib/saboteur/execution/runner.rb
117
125
  - lib/saboteur/execution/sandbox.rb
126
+ - lib/saboteur/execution/seatbelt.rb
118
127
  - lib/saboteur/execution/stale_captures.rb
119
128
  - lib/saboteur/execution/supervisor.rb
129
+ - lib/saboteur/execution/test_command_shape.rb
120
130
  - lib/saboteur/execution/worker_pool.rb
121
131
  - lib/saboteur/execution/wrapper.rb
122
132
  - lib/saboteur/frameworks/database_hosts.rb
123
133
  - lib/saboteur/frameworks/rails.rb
134
+ - lib/saboteur/frameworks/sqlite_memory_database.rb
124
135
  - lib/saboteur/gates.rb
125
136
  - lib/saboteur/help.rb
126
137
  - lib/saboteur/hooks.rb
@@ -131,12 +142,16 @@ files:
131
142
  - lib/saboteur/integration/focus_guard.rb
132
143
  - lib/saboteur/integration/rspec.rb
133
144
  - lib/saboteur/mutation_source/argument_removal.rb
145
+ - lib/saboteur/mutation_source/argument_swap.rb
134
146
  - lib/saboteur/mutation_source/base.rb
135
147
  - lib/saboteur/mutation_source/builtin.rb
136
148
  - lib/saboteur/mutation_source/chain_removal.rb
137
149
  - lib/saboteur/mutation_source/condition_negation.rb
150
+ - lib/saboteur/mutation_source/constant_literals.rb
138
151
  - lib/saboteur/mutation_source/edit.rb
152
+ - lib/saboteur/mutation_source/element_removal.rb
139
153
  - lib/saboteur/mutation_source/endpoint_replacement.rb
154
+ - lib/saboteur/mutation_source/entry_edits.rb
140
155
  - lib/saboteur/mutation_source/filter_replacement.rb
141
156
  - lib/saboteur/mutation_source/hazard_guard.rb
142
157
  - lib/saboteur/mutation_source/interpolation_removal.rb
@@ -150,7 +165,9 @@ files:
150
165
  - lib/saboteur/mutation_source/operator_visit.rb
151
166
  - lib/saboteur/mutation_source/pair_removal.rb
152
167
  - lib/saboteur/mutation_source/range_replacement.rb
168
+ - lib/saboteur/mutation_source/regex_replacement.rb
153
169
  - lib/saboteur/preview.rb
170
+ - lib/saboteur/refinement_activations.rb
154
171
  - lib/saboteur/replay.rb
155
172
  - lib/saboteur/reporter/agent.rb
156
173
  - lib/saboteur/reporter/agent_clipping.rb
@@ -161,6 +178,7 @@ files:
161
178
  - lib/saboteur/reporter/findings.rb
162
179
  - lib/saboteur/reporter/history_paths.rb
163
180
  - lib/saboteur/reporter/history_policy.rb
181
+ - lib/saboteur/reporter/history_reader.rb
164
182
  - lib/saboteur/reporter/history_record.rb
165
183
  - lib/saboteur/reporter/html.rb
166
184
  - lib/saboteur/reporter/mutation_text.rb
@@ -170,6 +188,7 @@ files:
170
188
  - lib/saboteur/reporter/score_history.rb
171
189
  - lib/saboteur/reporter/score_table.rb
172
190
  - lib/saboteur/reporter/stryker.rb
191
+ - lib/saboteur/reporter/survivor_classification.rb
173
192
  - lib/saboteur/reporter/survivor_hints.rb
174
193
  - lib/saboteur/reporter/survivor_list.rb
175
194
  - lib/saboteur/reporter/survivor_ranking.rb
@@ -178,8 +197,12 @@ files:
178
197
  - lib/saboteur/result.rb
179
198
  - lib/saboteur/score.rb
180
199
  - lib/saboteur/selection/coverage_map.rb
200
+ - lib/saboteur/selection/dependency_shield.rb
201
+ - lib/saboteur/selection/external_test_map.rb
181
202
  - lib/saboteur/selection/git_diff.rb
203
+ - lib/saboteur/selection/layout_only_lines.rb
182
204
  - lib/saboteur/selection/recorder.rb
205
+ - lib/saboteur/selection/source_scope.rb
183
206
  - lib/saboteur/selection/untracked_changes.rb
184
207
  - lib/saboteur/subject.rb
185
208
  - lib/saboteur/subject_finder.rb