mutineer 1.8.0 → 1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86c3963ad7e14aed11afda2b474e0465f5eeec91d4bac3aea68c8aaa8d405391
4
- data.tar.gz: d8d632c8cde79fccda2e29583ac213cff95460f9f430afed56e31675170c27ba
3
+ metadata.gz: '081f3529886cfc83b690d64e36364e98233618681f2fd5378d74c2fdc7417494'
4
+ data.tar.gz: 9eb4fb6837004332586b527f12cb55fbaaf8def2982e38ba9752b816fbd74b02
5
5
  SHA512:
6
- metadata.gz: ffd90e04f7af0a47b630e7083873d2dfa2442b386900a03ee4ae12e0ef08709f126b1cedfa3e9397e68448b49c51795012b7430264717aed6975f1c69ee74bca
7
- data.tar.gz: d5dadd48db5f383cae7220cc6eda44f6fe1c53b5e6348eda92f97be16a176af239c2ce5556f605b980141e54d5805b62a33a96f2254fdfdbe590a5c7f1c78d51
6
+ metadata.gz: 68417680427040b670ca63cf5c9bd65f3a1a144d32a3f7ca42ff34bd9eabeaa6f17f2db7e78eb59d28c293a47bd503d77ec7e6a55922f6fc08c6d8a2d7b3cefb
7
+ data.tar.gz: ab9d5c1ab942e221414af34e85b000847f71f512bf32efc4200d42b7a3fc43e091a7aeff5ae1136cbc83797d0d23debfea5483665e3bed3a30d48dceade0be49
data/CHANGELOG.md CHANGED
@@ -6,6 +6,39 @@ All notable changes to this project are documented here. The format is based on
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.8.1] - 2026-11-02
10
+
11
+ ### Fixed
12
+
13
+ - **No "already initialized constant" warnings under reload (#364).** Each
14
+ mutant loads its whole file again, so every constant in the file was
15
+ assigned twice. Ruby then printed two warning lines per constant, per
16
+ mutant, on stderr. Mutineer now turns warnings off while it loads the
17
+ mutant file, in-process and on `--daemon`, and turns them back on before
18
+ the tests run. Warnings that the tests raise still print. Other warnings
19
+ raised while the mutant file loads, such as an unused variable under `-w`,
20
+ no longer print either. Scores and the JSON report do not change.
21
+ - **The "not green" message says it once (#360).** When the clean run of a
22
+ file's tests failed, the message said "the unmutated suite is not green"
23
+ twice. It now says it once, then names the test files after `Failed:`.
24
+ A failure that only the check of all test files together finds is listed
25
+ as `Failed: combined suite`.
26
+ Under Minitest, the seed hint follows them.
27
+ The message itself still does not name the failing tests or the first
28
+ error; #360 tracks that. On the default in-process path, the failing
29
+ test's own report still prints on stderr before the message.
30
+ - **An unexpected error no longer prints an unredacted message (#341).**
31
+ An error that no other handler expected went to Ruby's default printer,
32
+ which did not hide a database password in its message. The CLI now prints
33
+ that error with the password hidden, with its backtrace, and exits 1, as
34
+ before. No known path raised such an error with the password.
35
+ - **An ambiguous or malformed option is a usage error (exit 2).** An option
36
+ that matches more than one flag, such as `--ver` (`--verbose` or
37
+ `--version`), or a value given to a flag that takes none, such as
38
+ `--verbose=1`, crashed with a backtrace and exit 1. It now prints one line
39
+ and exits 2, like every other bad option. This holds for `init` and
40
+ `triage` too.
41
+
9
42
  ## [1.8.0] - 2026-10-29
10
43
 
11
44
  ### Highlights
@@ -1828,6 +1861,7 @@ Rails hardening + CI batch (issues #8–#13), all verified Rails-free.
1828
1861
  - `.mutineer.yml` configuration (CLI > config > default precedence).
1829
1862
  - Byte-correct source handling for multibyte (UTF-8) sources.
1830
1863
 
1864
+ [1.8.1]: https://github.com/davidteren/mutineer/releases/tag/v1.8.1
1831
1865
  [1.8.0]: https://github.com/davidteren/mutineer/releases/tag/v1.8.0
1832
1866
  [1.7.0]: https://github.com/davidteren/mutineer/releases/tag/v1.7.0
1833
1867
  [1.6.0]: https://github.com/davidteren/mutineer/releases/tag/v1.6.0
data/lib/mutineer/cli.rb CHANGED
@@ -184,7 +184,7 @@ module Mutineer
184
184
 
185
185
  begin
186
186
  parser.parse!(argv)
187
- rescue OptionParser::InvalidOption, OptionParser::MissingArgument, Mutineer::ConfigError => e
187
+ rescue OptionParser::ParseError, Mutineer::ConfigError => e
188
188
  warn "mutineer: #{e.message}"
189
189
  exit 2
190
190
  end
@@ -241,6 +241,18 @@ module Mutineer
241
241
  warn "mutineer: unknown command '#{argv.first}'"
242
242
  exit 2
243
243
  end
244
+ rescue StandardError, ScriptError => e
245
+ # Last resort (#341): an error no handler above expects would otherwise
246
+ # reach Ruby's default printer, which shows its message unredacted. Same
247
+ # exit 1 as that printer, with the message and backtrace redacted. A
248
+ # message that raises while it is built is not shown at all.
249
+ details = begin
250
+ e.full_message(highlight: false)
251
+ rescue StandardError, ScriptError
252
+ Redaction::FAILED
253
+ end
254
+ warn "mutineer: #{Redaction.text(details)}"
255
+ exit 1
244
256
  end
245
257
 
246
258
  # Rewrites old-format ids in the loaded `.mutineer.yml` `ignore:` list.
@@ -46,6 +46,25 @@ module Mutineer
46
46
  end
47
47
  end
48
48
 
49
+ # Loads the mutant file at `path` over `source_file`, through {.replace}.
50
+ # The load assigns each of the file's constants a second time, so Ruby
51
+ # would warn twice per constant, per mutant (#364). Warnings are off for
52
+ # the load only, and back on before the tests run.
53
+ #
54
+ # @param source_file [String] the file the mutant replaces.
55
+ # @param path [String] the mutant file to load.
56
+ # @return [Object] what `load` returns.
57
+ def self.load_mutant(source_file, path)
58
+ replace(source_file) do
59
+ verbose, $VERBOSE = $VERBOSE, nil
60
+ begin
61
+ load path
62
+ ensure
63
+ $VERBOSE = verbose
64
+ end
65
+ end
66
+ end
67
+
49
68
  # Removes every stored `included` and `prepended` block that the source
50
69
  # file defined, from every concern. Blocks from other files stay.
51
70
  #
@@ -484,7 +484,7 @@ module Mutineer
484
484
  f.flock(File::LOCK_EX) rescue nil # rubocop:disable Style/RescueModifier
485
485
  f.write(payload.fetch("code"))
486
486
  f.flush
487
- ConcernBlocks.replace(payload.fetch("source_file")) { load f.path }
487
+ ConcernBlocks.load_mutant(payload.fetch("source_file"), f.path)
488
488
  end
489
489
  hook = payload["hook_def"] or return
490
490
 
data/lib/mutineer/init.rb CHANGED
@@ -31,7 +31,7 @@ module Mutineer
31
31
  end
32
32
  begin
33
33
  parser.parse!(argv)
34
- rescue OptionParser::InvalidOption, OptionParser::MissingArgument => e
34
+ rescue OptionParser::ParseError => e
35
35
  err.puts "mutineer: #{e.message}"
36
36
  return 2
37
37
  end
@@ -196,12 +196,15 @@ module Mutineer
196
196
  # text from {JobPlan.hook_mutant} and then calls
197
197
  # {ConcernBlocks.place_hook_def} (#297).
198
198
  #
199
+ # {ConcernBlocks.load_mutant} turns Ruby's warnings off for the load, so
200
+ # the constants it assigns again do not warn (#364).
201
+ #
199
202
  # @api private
200
203
  # @param mutated [String] mutated source text.
201
204
  # @param source_file [String] original source file path.
202
205
  # @return [Object] whatever `load` returns.
203
206
  def self.apply_whole_file(mutated, source_file)
204
- write_beside(mutated, source_file) { |path| ConcernBlocks.replace(source_file) { load path } }
207
+ write_beside(mutated, source_file) { |path| ConcernBlocks.load_mutant(source_file, path) }
205
208
  end
206
209
 
207
210
  # Writes `code` to a hidden `.mutineer_mutant` file beside `source_file`,
@@ -183,9 +183,10 @@ module Mutineer
183
183
  return if files.empty?
184
184
 
185
185
  seed_hint = TestRunners.for(framework) == TestRunners::Minitest ? minitest_seed_hint : ""
186
+ # The hint opens with "the unmutated suite is not green", so the files
187
+ # follow it rather than repeat that sentence (#360).
186
188
  raise SmokeCheckError,
187
- "the unmutated suite is not green (#{files.join(', ')}) — " \
188
- "#{ExternalBackend.generic_env_hint}.#{seed_hint}"
189
+ "#{ExternalBackend.generic_env_hint}. Failed: #{files.join(', ')}.#{seed_hint}"
189
190
  end
190
191
 
191
192
  # Names the configured seed, and accounts for helper overrides.
@@ -31,7 +31,7 @@ module Mutineer
31
31
  end
32
32
  begin
33
33
  parser.parse!(argv)
34
- rescue OptionParser::InvalidOption, OptionParser::MissingArgument => e
34
+ rescue OptionParser::ParseError => e
35
35
  err.puts "mutineer: #{e.message}"
36
36
  return 2
37
37
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Mutineer
4
4
  # Current Mutineer release version.
5
- VERSION = "1.8.0"
5
+ VERSION = "1.8.1"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mutineer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Teren