henitai 0.5.3 → 0.7.0
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 +4 -4
- data/CHANGELOG.md +332 -1
- data/README.md +123 -19
- data/assets/schema/henitai.schema.json +26 -0
- data/lib/henitai/arid_node_filter.rb +4 -19
- data/lib/henitai/bootstrap_error_message.rb +38 -0
- data/lib/henitai/canonical_report_merger.rb +23 -2
- data/lib/henitai/checkpoint_reporter.rb +5 -0
- data/lib/henitai/cli/operator_command.rb +10 -3
- data/lib/henitai/cli/run_command.rb +25 -7
- data/lib/henitai/cli/run_options.rb +1 -1
- data/lib/henitai/cli.rb +6 -2
- data/lib/henitai/composite_progress_reporter.rb +15 -2
- data/lib/henitai/configuration.rb +9 -1
- data/lib/henitai/configuration_validator/rules.rb +9 -0
- data/lib/henitai/configuration_validator/scalars.rb +22 -0
- data/lib/henitai/configuration_validator.rb +4 -2
- data/lib/henitai/constant_path.rb +48 -0
- data/lib/henitai/control_gate.rb +78 -0
- data/lib/henitai/control_run.rb +67 -0
- data/lib/henitai/coverage_bootstrapper.rb +46 -11
- data/lib/henitai/coverage_formatter.rb +26 -3
- data/lib/henitai/coverage_report_reader.rb +21 -0
- data/lib/henitai/equivalence_detector/operand_predicates.rb +16 -0
- data/lib/henitai/equivalence_detector.rb +46 -38
- data/lib/henitai/example_summary.rb +24 -0
- data/lib/henitai/execution_engine/env_scope.rb +3 -3
- data/lib/henitai/execution_engine/fork_server_scope.rb +57 -0
- data/lib/henitai/execution_engine.rb +109 -119
- data/lib/henitai/execution_provenance.rb +67 -0
- data/lib/henitai/fidelity_check.rb +173 -0
- data/lib/henitai/flaky_detection_baseline.rb +63 -0
- data/lib/henitai/flaky_retry_decision.rb +23 -0
- data/lib/henitai/flaky_test_registry.rb +63 -0
- data/lib/henitai/fork_server/client.rb +222 -0
- data/lib/henitai/fork_server/group_killer.rb +48 -0
- data/lib/henitai/fork_server/launcher.rb +38 -0
- data/lib/henitai/fork_server/mutant_runner.rb +110 -0
- data/lib/henitai/fork_server/protocol.rb +73 -0
- data/lib/henitai/fork_server/reaper.rb +24 -0
- data/lib/henitai/fork_server/runtime.rb +109 -0
- data/lib/henitai/fork_server/server.rb +108 -0
- data/lib/henitai/fork_server/server_process.rb +73 -0
- data/lib/henitai/fork_server/status.rb +52 -0
- data/lib/henitai/fork_server.rb +42 -0
- data/lib/henitai/generated_artifacts.rb +3 -0
- data/lib/henitai/git_diff_analyzer.rb +28 -11
- data/lib/henitai/history_checkpointer.rb +72 -0
- data/lib/henitai/incremental_filter.rb +20 -10
- data/lib/henitai/integration/base.rb +78 -19
- data/lib/henitai/integration/capped_log_sink.rb +34 -0
- data/lib/henitai/integration/child_bootstrap.rb +7 -0
- data/lib/henitai/integration/child_report_store.rb +65 -0
- data/lib/henitai/integration/minitest.rb +8 -13
- data/lib/henitai/integration/minitest_autorun.rb +20 -0
- data/lib/henitai/integration/minitest_fail_fast.rb +43 -0
- data/lib/henitai/integration/minitest_outcome_reporter.rb +44 -0
- data/lib/henitai/integration/minitest_preload.rb +30 -0
- data/lib/henitai/integration/minitest_runnable_filter.rb +61 -0
- data/lib/henitai/integration/minitest_test_runner.rb +47 -18
- data/lib/henitai/integration/mutant_run_support.rb +80 -17
- data/lib/henitai/integration/rspec_child_runner.rb +49 -9
- data/lib/henitai/integration/rspec_file_order.rb +37 -0
- data/lib/henitai/integration/rspec_preload.rb +35 -0
- data/lib/henitai/integration/rspec_process_runner.rb +4 -20
- data/lib/henitai/integration/scenario_log_support.rb +31 -18
- data/lib/henitai/integration.rb +18 -6
- data/lib/henitai/kill_history/store.rb +67 -0
- data/lib/henitai/kill_history.rb +85 -0
- data/lib/henitai/minitest_coverage_reporter.rb +22 -6
- data/lib/henitai/minitest_result_file.rb +62 -0
- data/lib/henitai/mutant/activation.rb +32 -0
- data/lib/henitai/mutant/activator.rb +75 -55
- data/lib/henitai/mutant/def_injection.rb +136 -0
- data/lib/henitai/mutant/lexical_scope_check.rb +120 -0
- data/lib/henitai/mutant/lexical_target.rb +105 -0
- data/lib/henitai/mutant/replacement.rb +52 -0
- data/lib/henitai/mutant.rb +32 -8
- data/lib/henitai/mutant_generator.rb +62 -18
- data/lib/henitai/mutant_history_store/database.rb +61 -0
- data/lib/henitai/mutant_history_store/sql.rb +9 -3
- data/lib/henitai/mutant_history_store/subject_scans.rb +101 -0
- data/lib/henitai/mutant_history_store/verdict_cache.rb +48 -18
- data/lib/henitai/mutant_history_store.rb +77 -51
- data/lib/henitai/mutant_identity.rb +5 -1
- data/lib/henitai/mutant_verdict.rb +71 -0
- data/lib/henitai/operator.rb +6 -2
- data/lib/henitai/operators/array_declaration.rb +4 -0
- data/lib/henitai/operators/assignment_expression.rb +2 -0
- data/lib/henitai/operators/conditional_expression.rb +21 -1
- data/lib/henitai/operators/equality_identity_operator.rb +2 -2
- data/lib/henitai/operators/hash_key_type.rb +11 -1
- data/lib/henitai/operators/hash_literal.rb +37 -9
- data/lib/henitai/operators/method_expression.rb +14 -3
- data/lib/henitai/operators/regex_metacharacters.rb +89 -0
- data/lib/henitai/operators/regex_mutator.rb +23 -28
- data/lib/henitai/operators/return_value.rb +1 -1
- data/lib/henitai/operators/string_literal.rb +17 -4
- data/lib/henitai/operators.rb +1 -0
- data/lib/henitai/per_test_coverage.rb +11 -7
- data/lib/henitai/per_test_coverage_collector.rb +30 -31
- data/lib/henitai/per_test_coverage_delta.rb +60 -0
- data/lib/henitai/per_test_coverage_selector.rb +26 -13
- data/lib/henitai/process_wakeup.rb +8 -3
- data/lib/henitai/process_worker_runner.rb +41 -7
- data/lib/henitai/reporter.rb +15 -8
- data/lib/henitai/result.rb +32 -16
- data/lib/henitai/reuse_context.rb +52 -0
- data/lib/henitai/rspec_coverage_formatter.rb +4 -0
- data/lib/henitai/rspec_outcomes.rb +74 -0
- data/lib/henitai/runner.rb +112 -21
- data/lib/henitai/runner_dependencies.rb +44 -3
- data/lib/henitai/sampling_strategy.rb +36 -6
- data/lib/henitai/scenario_execution_result.rb +51 -5
- data/lib/henitai/signal_deferral.rb +25 -0
- data/lib/henitai/signature_line.rb +21 -0
- data/lib/henitai/slot_scheduler/control_slots.rb +58 -0
- data/lib/henitai/slot_scheduler/draining.rb +35 -6
- data/lib/henitai/slot_scheduler/process_control.rb +33 -0
- data/lib/henitai/slot_scheduler/retry_policy.rb +20 -6
- data/lib/henitai/slot_scheduler.rb +64 -21
- data/lib/henitai/source_file_selection.rb +1 -1
- data/lib/henitai/source_parser.rb +29 -9
- data/lib/henitai/static_filter.rb +45 -14
- data/lib/henitai/stillborn_filter.rb +70 -2
- data/lib/henitai/subject.rb +8 -3
- data/lib/henitai/subject_resolver.rb +65 -31
- data/lib/henitai/suite_boot_clock.rb +48 -0
- data/lib/henitai/survivor_activation_cache.rb +18 -11
- data/lib/henitai/survivor_rerun_strategy.rb +47 -43
- data/lib/henitai/test_file_outcomes.rb +93 -0
- data/lib/henitai/test_prioritizer.rb +10 -2
- data/lib/henitai/timeout_calibrator.rb +31 -9
- data/lib/henitai/timeout_ceiling.rb +37 -0
- data/lib/henitai/verdict_fingerprint.rb +29 -30
- data/lib/henitai/version.rb +1 -1
- data/lib/henitai.rb +21 -1
- data/sig/configuration_validator.rbs +1 -0
- data/sig/henitai.rbs +254 -56
- metadata +63 -5
- data/lib/henitai/survivor_test_filter.rb +0 -72
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 656b11a422036d85c179982cc35ef056288e27198be4867cb860566cd77405fb
|
|
4
|
+
data.tar.gz: a49ae867dc83272fad2988e6fc771f8673a7015ab9b6b7c6618e0d8845bc8ef5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 145b510c9396f5373d4e65bb9a7c2aa37814545c763a4d57116e8deda72ddb7b8ba88f706653eabb113f7ed42e28cbe6c559ae3ba35e9ebe6afacc4938d85443
|
|
7
|
+
data.tar.gz: 4d081f6082f5beceed0d8650466223fe241e573231241fe1805fa3e8f8a942ec7b3dac50724ee7a6670260c5b920987228b4b0fd5244adcde4ba8e9909052013
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,335 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.7.0] - 2026-11-24
|
|
11
|
+
|
|
12
|
+
Minor release. Interrupted runs can be resumed, `jobs: 1` runs through the
|
|
13
|
+
same scheduler as parallel runs, a mutant's test run stops at its first
|
|
14
|
+
failure, and test files are ordered by what earlier runs learned (kills,
|
|
15
|
+
hangs). Expect shorter runs and a higher MSI: mutants that a test killed
|
|
16
|
+
before a later test hung used to be reported as `Timeout`. Custom
|
|
17
|
+
integrations must implement `#spawn_mutant` and `#build_result`;
|
|
18
|
+
`Integration#run_mutant` is gone.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- `mutation.suite_timeout` (default `900.0` seconds) sets the limit for one
|
|
23
|
+
baseline suite run (coverage bootstrap and flaky detection).
|
|
24
|
+
- The test order learned in a run (kill counts per test file and the test files
|
|
25
|
+
that hung per subject) is saved to `henitai_test_order.json` in the reports
|
|
26
|
+
directory and seeds the next run, so a hang is paid once rather than in every
|
|
27
|
+
run. `henitai clean` removes the file and so resets the learned order. A
|
|
28
|
+
save failure (for example a read-only reports dir) only warns and never
|
|
29
|
+
fails the run.
|
|
30
|
+
- Interrupted runs can be resumed with `henitai run --incremental`
|
|
31
|
+
(ADR-19). Verdicts are written to the history store in batches while the
|
|
32
|
+
run goes on; on Ctrl-C, `TERM` or `HUP` henitai saves what it has, prints
|
|
33
|
+
`interrupted; N verdicts saved, resume with --incremental` and exits.
|
|
34
|
+
After a hard kill at most the last unsaved batch is lost. Detections are
|
|
35
|
+
saved only after their control run passed: the control now runs at a
|
|
36
|
+
group's first detection instead of after the last mutant. A verdict is
|
|
37
|
+
cached only if the files it ran against are unchanged since the run
|
|
38
|
+
started, and a kill whose flaky retry was cut short by the shutdown is
|
|
39
|
+
never cached. Aborted runs add no trend point; each run writes one
|
|
40
|
+
history entry per mutant. Toggling `mutation.control_runs` now
|
|
41
|
+
invalidates cached verdicts. `rake oracle:resume` checks the resume end
|
|
42
|
+
to end
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
|
|
46
|
+
- The default limit for a baseline suite run went from 300 s to 900 s; it is
|
|
47
|
+
now configurable as `mutation.suite_timeout`.
|
|
48
|
+
- `jobs: 1` runs through the same scheduler as `jobs: N` (ADR-20); `jobs`
|
|
49
|
+
only sets how many mutants run at once. One-job runs now handle INT, TERM
|
|
50
|
+
and HUP like parallel runs (drain the running child, then stop with
|
|
51
|
+
`Interrupt`), mark kills whose flaky retry a shutdown cut short, and run
|
|
52
|
+
control runs as scheduler jobs. `jobs: 0` means one job. Verdicts are
|
|
53
|
+
unchanged. Removed the synchronous mutant API `Integration#run_mutant`
|
|
54
|
+
(and its RSpec, Minitest and fork-server variants); integrations implement
|
|
55
|
+
`#spawn_mutant` and `#build_result`
|
|
56
|
+
- A mutant's test run stops at its first failure (RSpec: `fail_fast = 1`,
|
|
57
|
+
overriding the project's setting; Minitest: no further test class starts).
|
|
58
|
+
Killed mutants finish sooner. A mutant that one test kills before another
|
|
59
|
+
test hangs, exits or crashes is now `Killed` instead of `Timeout` or
|
|
60
|
+
`RuntimeError` (MSI rises; MS is unchanged with the default
|
|
61
|
+
`coverage_criteria`). With `flaky_detection`, a kill whose first failing
|
|
62
|
+
file is flaky is retried, and ends `Survived` if no retry fails
|
|
63
|
+
|
|
64
|
+
### Fixed
|
|
65
|
+
|
|
66
|
+
- A baseline suite run that exceeds its limit is reported as a timeout that
|
|
67
|
+
names `mutation.suite_timeout`, instead of "Configured test suite failed
|
|
68
|
+
while generating coverage".
|
|
69
|
+
- Test prioritization works. Kill counts never reached `TestPrioritizer`
|
|
70
|
+
(it read a `config.history` that does not exist), and with
|
|
71
|
+
`config.order = :random` the RSpec child reshuffled the spec files anyway.
|
|
72
|
+
Now a test file that hung (timed out) for an earlier mutant of the same
|
|
73
|
+
subject runs last; the others run by kills earlier in the run, then
|
|
74
|
+
fastest first, and the RSpec child keeps that file order (random order
|
|
75
|
+
still applies within a file). On the dogfood benchmark this cut wall time
|
|
76
|
+
by 20-46% and timeouts by more than half. Minitest shuffles test classes
|
|
77
|
+
and is unaffected
|
|
78
|
+
- `StringLiteral` no longer emits an equivalent mutant for strings without
|
|
79
|
+
interpolation that parse as `dstr` (adjacent literals such as
|
|
80
|
+
`"a " "b"`, multi-line heredocs). It used to "remove the interpolation"
|
|
81
|
+
and reproduce the original string, which survived every time. Such
|
|
82
|
+
strings now get the plain-string mutations (`""`,
|
|
83
|
+
`"Henitai was here"`). Affected mutants get new stable ids and re-execute
|
|
84
|
+
once under `--incremental`
|
|
85
|
+
- `HashKeyType` descriptions name the replaced key
|
|
86
|
+
(`replaced symbol key foo with string key`) instead of one constant string,
|
|
87
|
+
so several mutants of the same hash are distinguishable in every report
|
|
88
|
+
surface. A symbol key containing a newline falls back to its position.
|
|
89
|
+
Affected mutants get new stable ids and re-execute once under
|
|
90
|
+
`--incremental`
|
|
91
|
+
- Retired mutant identities no longer linger in `mutation-history.json`.
|
|
92
|
+
When a description or operator changes, the old stable id can never match
|
|
93
|
+
again; those rows kept appearing in the trend export with a frozen
|
|
94
|
+
`lastSeenVersion` and a meaningless `daysAlive`. Retirement is decided per
|
|
95
|
+
subject — a mutant is retired only once its own subject has been mutated
|
|
96
|
+
in full without it — so narrow `--since` runs and `--survivors-from`
|
|
97
|
+
partial reruns cannot retire mutants they simply did not re-record, and a
|
|
98
|
+
`light` scan never retires `full`-only mutants. Rows stay in the SQLite
|
|
99
|
+
database as an audit trail; only the export filters. Rows written before
|
|
100
|
+
this release carry no subject, and a retired identity is by definition
|
|
101
|
+
never re-recorded, so pre-existing retired rows stay in the export —
|
|
102
|
+
retirement applies from the first full scan after upgrading onward
|
|
103
|
+
- `HashLiteral` pair-removal descriptions no longer leak AST s-expressions
|
|
104
|
+
into reports. Only literal keys are named (string keys now quoted, so
|
|
105
|
+
`{ "a" => 1, a: 2 }` yields two distinguishable descriptions); variable,
|
|
106
|
+
array, nested-hash and interpolated-symbol keys fall back to a positional
|
|
107
|
+
label such as `removed hash pair #1`. A nested-hash key previously produced
|
|
108
|
+
a multi-line description, which broke every single-line output surface and
|
|
109
|
+
reached `stableId` in the JSON report and the SQLite history. Affected
|
|
110
|
+
mutants get new stable ids and re-execute once under `--incremental`
|
|
111
|
+
- `henitai operator list` gains a `Hard set` section, so `HashKeyType` and
|
|
112
|
+
`EqualityIdentityOperator` are discoverable again (`EqualityIdentityOperator`
|
|
113
|
+
was listed in 0.3.1 and nowhere in 0.4.0). Sets now nest in the output —
|
|
114
|
+
each section lists only what it adds to the previous one, instead of
|
|
115
|
+
re-printing the light operators in every set
|
|
116
|
+
- `HashKeyType` requires `parser_current` itself instead of relying on a
|
|
117
|
+
sibling operator having loaded the parser first
|
|
118
|
+
|
|
119
|
+
## [0.6.0] - 2026-10-20
|
|
120
|
+
|
|
121
|
+
Minor release with a deliberate score break: false kills and harness
|
|
122
|
+
failures no longer count as detected mutants, so most projects, including
|
|
123
|
+
Henitai's own dogfood run, will report lower Mutation Scores. Re-measure
|
|
124
|
+
before adjusting thresholds.
|
|
125
|
+
|
|
126
|
+
### Changed
|
|
127
|
+
|
|
128
|
+
- **Scores will drop, by design.** A mutant now counts as detected only when a
|
|
129
|
+
test failed because of its mutation (ADR-14). Harness failures that used to
|
|
130
|
+
be credited as kills are now reported as `CompileError` or `RuntimeError`,
|
|
131
|
+
with the reason in `statusReason`. On an assertion-free test suite, 0.5.3
|
|
132
|
+
reported 130 of 137 mutants as killed; this release reports none. Projects
|
|
133
|
+
should expect lower Mutation Scores. Re-measure before adjusting thresholds.
|
|
134
|
+
- **Flaky-test handling.** Survivors are no longer retried: a retry could only
|
|
135
|
+
turn a survivor into a kill and inflate the score. Kills are re-checked, up
|
|
136
|
+
to `max_flaky_retries`, only when every failing test file is known to be
|
|
137
|
+
flaky, as found by the new opt-in `mutation.flaky_detection` (baseline suite
|
|
138
|
+
runs twice; flaky files go to `henitai_flaky_tests.json`, removed by
|
|
139
|
+
`henitai clean`). Without it nothing is retried, so runtime on survivor-heavy
|
|
140
|
+
suites drops. The ">5% of mutants needed a retry" warning is replaced by a
|
|
141
|
+
report of flaky tests and re-checked kills. Child reports now carry
|
|
142
|
+
`failed_tests`. Failures outside an example (an `after(:context)` hook error,
|
|
143
|
+
a suite-level hook, a Minitest result without a file) are attributed to their
|
|
144
|
+
spec file when RSpec names it; otherwise the run is flagged
|
|
145
|
+
`unattributed_failures`, which makes a kill genuine (never retried) and makes
|
|
146
|
+
the flaky baseline reject the run. Baseline runs that fail on a file the two
|
|
147
|
+
runs cannot call flaky (for example one seen in a single run) now abort
|
|
148
|
+
instead of being accepted. Minitest outcomes are keyed to the file defining
|
|
149
|
+
the test class, not to a shared module that supplies the test method.
|
|
150
|
+
- Mutant runs are classified from an explicit report written by the child
|
|
151
|
+
process instead of from its exit status. An exception while activating the
|
|
152
|
+
mutant (for example a `NameError` from a superclass defined in another file)
|
|
153
|
+
is `CompileError`, not `Killed`. A child killed by a signal, or one that
|
|
154
|
+
exits without reporting, is `RuntimeError`, not `Killed`. A `SystemExit`
|
|
155
|
+
raised by the code under test is `RuntimeError`, not `Survived`.
|
|
156
|
+
- Mutants are activated only after the spec or test files have loaded, so a
|
|
157
|
+
subject whose superclass or constants live in other files can be tested.
|
|
158
|
+
Previously the child loaded the subject file on its own and failed with a
|
|
159
|
+
`NameError` (every `ApplicationRecord` model, for example).
|
|
160
|
+
- Mutants are activated by re-evaluating the subject's own `def` inside its
|
|
161
|
+
original module and class openers (ADR-13), not through `define_method`.
|
|
162
|
+
Constant lookup through enclosing modules, implicit `super`, `yield`,
|
|
163
|
+
`block_given?`, argument forwarding, default values, `__FILE__`/`__LINE__`,
|
|
164
|
+
`frozen_string_literal` and visibility now behave as in the original method.
|
|
165
|
+
Mutations in default values take effect, and splices no longer shift after
|
|
166
|
+
multibyte characters or leave heredoc bodies behind. Activation recipes from
|
|
167
|
+
earlier versions are ignored and regenerated.
|
|
168
|
+
|
|
169
|
+
### Added
|
|
170
|
+
|
|
171
|
+
- `mutation.sampling.seed` (integer >= 0, default `0`) and real stratified
|
|
172
|
+
sampling: per subject `max(1, ceil(size * ratio))` mutants, strata by
|
|
173
|
+
operator ordered by `SHA256(seed, stable_id)`, visited round-robin, original
|
|
174
|
+
order kept. The report records `"sampling": {strategy, ratio, seed}`.
|
|
175
|
+
- Report fields: top-level `completeFiles` (non-authoritative runs) and
|
|
176
|
+
per-file `sessionId` and `gitSha` provenance.
|
|
177
|
+
- `rake oracle:reuse` (run in CI): on a scratch copy of the oracle corpus, the
|
|
178
|
+
`--incremental` verdicts must equal a fresh full run after scripted edits to
|
|
179
|
+
source, tests, a helper and the configuration.
|
|
180
|
+
- **Fork server for Minitest and parallel runs.** `mutation.fork_server`
|
|
181
|
+
(opt-in, ADR-15) now supports Minitest and `jobs > 1`: the environment is
|
|
182
|
+
booted once and each mutant process is forked from the server. Falls back to
|
|
183
|
+
per-mutant boot with a warning if the server is unavailable.
|
|
184
|
+
- A fidelity check rejects, before execution, every mutant whose activated
|
|
185
|
+
code differs from the original method by more than the reported mutation.
|
|
186
|
+
Examples are a negated condition that lost its parentheses, keyword
|
|
187
|
+
arguments re-rendered as a positional hash, `|x|` re-rendered as `|x,|`, a
|
|
188
|
+
splice shifted by a multibyte character, and a removed assignment that turns
|
|
189
|
+
a later local-variable read into a method call. Such mutants are reported as
|
|
190
|
+
`CompileError` with the reason.
|
|
191
|
+
- `mutation.control_runs` (default `true`): after execution, every subject
|
|
192
|
+
with a detected verdict runs once more with its unmutated method injected.
|
|
193
|
+
If its tests fail, the subject's detected verdicts are reclassified as
|
|
194
|
+
`CompileError`, because the injection itself broke them.
|
|
195
|
+
- Methods defined in a constructor block assigned to a constant
|
|
196
|
+
(`Point = Struct.new(:x) do ... end`, likewise `Data.define` and
|
|
197
|
+
`Class.new`) and in `class << CONST` are now subjects. Top-level
|
|
198
|
+
`def Const.name` methods are subjects as well.
|
|
199
|
+
- `rake oracle` runs a corpus whose verdicts follow from its construction and
|
|
200
|
+
fails on false kills or false survivors. CI runs it.
|
|
201
|
+
|
|
202
|
+
### Fixed
|
|
203
|
+
|
|
204
|
+
- **Verdict reuse is bound to a reuse context.** `--incremental` reused stale
|
|
205
|
+
`Killed` verdicts after a spec helper, the configuration or the henitai
|
|
206
|
+
version changed. Every cached `Killed` and `Survived` verdict now stores a
|
|
207
|
+
`ReuseContext` fingerprint (test dependency files, henitai version,
|
|
208
|
+
integration, operators, `test_excludes`, `coverage_criteria`) and is reused
|
|
209
|
+
only under an identical one; rows recorded without it are never reused.
|
|
210
|
+
`rake oracle:reuse` reproduced 121 mismatches against fresh runs after a
|
|
211
|
+
helper edit before the fix and none after it.
|
|
212
|
+
- **`--survivors-from` no longer skips survivors on a git heuristic.** The
|
|
213
|
+
selected survivors go through the same content-fingerprint reuse rules as
|
|
214
|
+
`--incremental`, always: new or edited tests and helpers invalidate them,
|
|
215
|
+
reused survivors are reported with `fromCache`, and recipe stubs without a
|
|
216
|
+
source range are always re-executed. `SurvivorTestFilter` is removed.
|
|
217
|
+
The recipe fast path now refreshes coverage (Gate 0) so new or edited tests
|
|
218
|
+
are selected, recipe stubs also run their name-matched tests, and survivor
|
|
219
|
+
reruns never sample (sampling had dropped prior survivors before matching).
|
|
220
|
+
`--force` now also bypasses this reuse. Duplicate programs are collapsed
|
|
221
|
+
before sampling, so a sampled run keeps the same representative as an
|
|
222
|
+
unsampled survivor rerun and its survivors are found again.
|
|
223
|
+
- A survived verdict whose covering-test fingerprint cannot be recomputed keeps
|
|
224
|
+
stored fingerprints only from a survived row of the same subject source,
|
|
225
|
+
never from a killed row or an edited method.
|
|
226
|
+
- Gate 1 source selection has its own per-test coverage instance, so reuse and
|
|
227
|
+
history read the post-bootstrap per-test map.
|
|
228
|
+
- Recipe stubs keep their precomputed stable ID and persist the `replacement`
|
|
229
|
+
source in the history store.
|
|
230
|
+
- **Trend history only records authoritative runs.** `--since`,
|
|
231
|
+
subject-scoped and survivor-rerun results no longer add a `runs` row.
|
|
232
|
+
- **Canonical report merge.** A scoped run that mutated every subject of a file
|
|
233
|
+
replaces that file's prior entry wholesale (and removes it when it has no
|
|
234
|
+
mutants), so stale mutants of edited or deleted code no longer linger.
|
|
235
|
+
`--survivors-from <canonical report>` redirects to the session snapshot only
|
|
236
|
+
when every file entry carries the report's `sessionId`; a file whose every
|
|
237
|
+
prior mutant was re-run takes the new run's provenance.
|
|
238
|
+
- `--since` diffs against the merge base (`REF...HEAD`) instead of the ref's
|
|
239
|
+
tip, so commits that landed on the base branch after the fork point are not
|
|
240
|
+
treated as changes.
|
|
241
|
+
- The dashboard reporter uploads the merged canonical report for scoped runs
|
|
242
|
+
instead of the partial one.
|
|
243
|
+
- `Pending` mutants are excluded from the MS and MSI denominators; MSI is
|
|
244
|
+
`killed / (total - pending)`.
|
|
245
|
+
- **Equivalence detection only flags sound cases.** `false || x` and
|
|
246
|
+
`true && x` (left literal only); `n + 0`, `n * 1` and siblings only for
|
|
247
|
+
Integer/Float literal receivers (not `-0.0`); `==` <-> `eql?` only when both
|
|
248
|
+
operands are string literals; `==` <-> `equal?` for singleton literals.
|
|
249
|
+
Unsound rules (`x || false`, `x && true`, unknown receivers, a single string
|
|
250
|
+
literal) no longer mark mutants `Equivalent`.
|
|
251
|
+
- **`mutation.ignore_patterns` is line-scoped.** A pattern is matched against
|
|
252
|
+
the source line where the mutant's node starts, in `StaticFilter`; matching
|
|
253
|
+
mutants are reported as `Ignored` with an `ignore_reason` instead of being
|
|
254
|
+
dropped at generation time. An enclosing construct whose body matches is no
|
|
255
|
+
longer suppressed. The line is decoded honouring a magic encoding comment,
|
|
256
|
+
so a non-UTF-8 source file no longer aborts filtering.
|
|
257
|
+
- **Review follow-ups.** The slot scheduler no longer signals the process
|
|
258
|
+
group of a reaped pid that owns no mutant slot. Minitest results for tests
|
|
259
|
+
added by reopening a class in another file are attributed to the file that
|
|
260
|
+
defines the method, so coverage-first selection no longer misses them. With
|
|
261
|
+
the fork server active, calibrated timeouts keep the measured suite boot
|
|
262
|
+
(served mutants still run `before(:suite)` hooks). The `fork_server` schema
|
|
263
|
+
description and the remediation plan now state the real scope (RSpec and
|
|
264
|
+
Minitest, any `jobs`).
|
|
265
|
+
- **`--incremental` no longer reuses stale survived verdicts for def-line
|
|
266
|
+
mutants.** Their test selection is widened with name-matched tests that the
|
|
267
|
+
survivor fingerprint does not cover, so survived verdicts for mutants on a
|
|
268
|
+
method's def line always re-execute (killed reuse is unaffected: a kill by
|
|
269
|
+
an unchanged covering test remains valid).
|
|
270
|
+
- **Output capture no longer delays or races on lingering grandchildren.**
|
|
271
|
+
Closing a mutant child's captured stdout/stderr no longer waits up to 1 s
|
|
272
|
+
per stream for EOF and no longer kills the drain thread mid-write (which
|
|
273
|
+
could exceed the cap or write the truncation marker twice). The drain
|
|
274
|
+
thread is stopped cooperatively through a stop pipe and takes what is
|
|
275
|
+
already readable.
|
|
276
|
+
- **Fork-server lifecycle.** A server lost or stalled mid-run no longer turns
|
|
277
|
+
its in-flight mutants into `runtime_error`: they are rerun through the
|
|
278
|
+
per-mutant-boot fallback. Fallback runs use boot-inclusive timeouts. Mutant
|
|
279
|
+
processes forked by the server are cleaned up on timeout, loss and teardown
|
|
280
|
+
even before they lead a process group, and the connection and wake-pipe fds
|
|
281
|
+
are no longer inherited by mutant processes. The parallel event loop no
|
|
282
|
+
longer stalls on an exit event already buffered in the client, and the
|
|
283
|
+
SIGTERM drain window always runs its full length.
|
|
284
|
+
- The "negated condition" mutant now negates the whole condition
|
|
285
|
+
(`!(a > b)`), not just its left operand (`!a > b`).
|
|
286
|
+
- Source files are read as UTF-8 regardless of the process locale. With `LANG`
|
|
287
|
+
unset or `C`, any non-ASCII source file used to abort subject resolution.
|
|
288
|
+
- Per-test coverage now narrows RSpec test selection. RSpec records test files
|
|
289
|
+
as `./spec/x_spec.rb` while candidates arrive as `spec/x_spec.rb`, so the
|
|
290
|
+
lookup never matched and every mutant ran all candidate files.
|
|
291
|
+
- `--since` and the dirty-source and survivor checks now work for a project in
|
|
292
|
+
a sub-directory of its git repository and for non-ASCII file names.
|
|
293
|
+
- A corrupt or locked `mutation-history.sqlite3` no longer discards the run's
|
|
294
|
+
reports. History recording and export now warn instead.
|
|
295
|
+
- Forked mutant children reset the INT, TERM, HUP and CHLD handlers inherited
|
|
296
|
+
from the parent, so a draining SIGTERM is no longer ignored.
|
|
297
|
+
- A zero-example check no longer matches `10 examples, 0 failures`, nor a
|
|
298
|
+
`No examples found.` or `0 examples, 0 failures` quoted in failure output;
|
|
299
|
+
only the run's last summary line counts. Such kills were reported as
|
|
300
|
+
`CompileError`.
|
|
301
|
+
- A run in which harness errors (`CompileError`) left no mutant to score now
|
|
302
|
+
exits `1` with a warning instead of passing its threshold with nothing
|
|
303
|
+
tested.
|
|
304
|
+
- Mutating an `elsif` condition no longer rewrites the whole `if` chain; only
|
|
305
|
+
the condition changes.
|
|
306
|
+
- String parts of interpolated strings, symbols, backticks and regexps, and
|
|
307
|
+
elements of `%w` arrays, are no longer mutated as standalone strings. Their
|
|
308
|
+
replacement text changed the literal's syntax rather than its value.
|
|
309
|
+
- Operator replacements are parenthesised when spliced, so `a && b && c`
|
|
310
|
+
mutated to `a || b` no longer reads as `a || (b && c)`.
|
|
311
|
+
- Two mutants at the same position with the same description no longer share
|
|
312
|
+
one stable identity and history entry.
|
|
313
|
+
- `ReturnValue` mutates only the method's final expression, not every
|
|
314
|
+
expression that happens to equal it.
|
|
315
|
+
- Subject expressions for predicate, bang, setter and operator methods, such
|
|
316
|
+
as `Foo#empty?`, `Foo#save!`, `Foo#name=` and `Foo#==`, select their method
|
|
317
|
+
instead of nothing.
|
|
318
|
+
- Mutants from different operators that produce the same program run once.
|
|
319
|
+
- The implicit value of a shorthand hash pair (`build(config:)`) is no longer
|
|
320
|
+
mutated. Its replacement rewrote the key to `build(nil:)`.
|
|
321
|
+
- A mutant that removes the only assignment of a local variable read later in
|
|
322
|
+
the method is no longer generated. Ruby parses the later read as a method
|
|
323
|
+
call, so every such mutant failed with a `NameError` wherever it ran.
|
|
324
|
+
- Subjects are attributed to the right namespace. A `class ::Top` inside
|
|
325
|
+
`module Outer` is `Top`, not `Outer::Top`. A `def Other.name` inside `Outer`
|
|
326
|
+
belongs to `Other`, not `Outer`. Methods of `class << obj` or `def obj.name`
|
|
327
|
+
for a non-constant `obj` are no longer reported as class methods of the
|
|
328
|
+
enclosing class.
|
|
329
|
+
- "replaced method call with nil" on a call with a block replaces the call
|
|
330
|
+
together with its block. Replacing only the call left `nil { ... }`, which
|
|
331
|
+
does not parse, so these sites were never tested. Blocks attached to
|
|
332
|
+
logger, output and debug calls stay arid.
|
|
333
|
+
- `RegexMutator` no longer drops the interpolations and later lines of a
|
|
334
|
+
dynamic or multi-line regexp, which it now leaves unmutated. It skips
|
|
335
|
+
escaped characters and the contents of character classes, so `[^0-9]` is
|
|
336
|
+
no longer reported as a removed `^` anchor and `[+-]` no longer as a
|
|
337
|
+
quantifier swap.
|
|
338
|
+
|
|
10
339
|
## [0.5.3] - 2026-08-26
|
|
11
340
|
|
|
12
341
|
### Fixed
|
|
@@ -588,7 +917,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
588
917
|
- CLI critical path: `henitai run` now executes the full pipeline, supports `--since`, returns CI-friendly exit codes, and `henitai version` prints `Henitai::VERSION`
|
|
589
918
|
- RSpec per-test coverage output: `henitai/coverage_formatter` now writes `coverage/henitai_per_test.json`
|
|
590
919
|
|
|
591
|
-
[Unreleased]: https://github.com/martinotten/henitai/compare/v0.
|
|
920
|
+
[Unreleased]: https://github.com/martinotten/henitai/compare/v0.7.0...HEAD
|
|
921
|
+
[0.7.0]: https://github.com/martinotten/henitai/compare/v0.6.0...v0.7.0
|
|
922
|
+
[0.6.0]: https://github.com/martinotten/henitai/compare/v0.5.3...v0.6.0
|
|
592
923
|
[0.5.3]: https://github.com/martinotten/henitai/compare/v0.5.2...v0.5.3
|
|
593
924
|
[0.5.2]: https://github.com/martinotten/henitai/compare/v0.5.1...v0.5.2
|
|
594
925
|
[0.5.1]: https://github.com/martinotten/henitai/compare/v0.5.0...v0.5.1
|
data/README.md
CHANGED
|
@@ -80,14 +80,20 @@ test_excludes:
|
|
|
80
80
|
- spec/end_to_end/*_spec.rb # never run these files, mutants or coverage baseline
|
|
81
81
|
|
|
82
82
|
mutation:
|
|
83
|
-
operators: light # light | full
|
|
83
|
+
operators: light # light | full | hard
|
|
84
84
|
timeout: 10.0
|
|
85
|
+
timeout_multiplier: 3.0
|
|
85
86
|
max_flaky_retries: 3
|
|
87
|
+
flaky_detection: false # run the baseline twice to find flaky test files
|
|
86
88
|
max_log_bytes: 5000000
|
|
87
89
|
max_timeout: 30.0
|
|
90
|
+
suite_timeout: 900.0 # seconds the baseline suite run (coverage bootstrap, flaky detection) may take
|
|
91
|
+
control_runs: true # re-run detected subjects with the unmutated method
|
|
92
|
+
fork_server: false # opt-in: boot the RSpec/Minitest environment once, fork each mutant run from it (any jobs; falls back to per-mutant boot with a warning)
|
|
88
93
|
sampling:
|
|
89
94
|
ratio: 0.05
|
|
90
95
|
strategy: stratified
|
|
96
|
+
seed: 0 # integer >= 0; selects which mutants of each stratum are kept
|
|
91
97
|
reports_dir: reports
|
|
92
98
|
reporters:
|
|
93
99
|
- terminal
|
|
@@ -118,31 +124,88 @@ baseline suite has a fixed timeout. Lines covered only by excluded tests count
|
|
|
118
124
|
as uncovered and are not mutated. Excluding every test file aborts with
|
|
119
125
|
`Henitai::ConfigurationError`.
|
|
120
126
|
`mutation.max_log_bytes` is a positive per-stream byte cap for captured child
|
|
121
|
-
output. `mutation.
|
|
122
|
-
`mutation.
|
|
127
|
+
output. Without an explicit `mutation.timeout`, each mutant's timeout is
|
|
128
|
+
calibrated as `mutation.timeout_multiplier` (default `3.0`) × (the summed
|
|
129
|
+
durations of the selected test files + the measured suite boot time), with a
|
|
130
|
+
2 s floor. `mutation.max_timeout` (default `30.0`) caps the calibrated value,
|
|
131
|
+
but never below the measured baseline plus 2 s; when the baseline alone exceeds
|
|
132
|
+
`max_timeout`, Henitai warns once and uses baseline + 2 s. An explicit
|
|
133
|
+
`mutation.timeout` still takes precedence. `mutation.suite_timeout` (default
|
|
134
|
+
`900.0`) limits one baseline suite run (coverage bootstrap and flaky detection);
|
|
135
|
+
if it is exceeded, Henitai reports a timeout and names the setting to raise. When JSON or HTML reporting is
|
|
123
136
|
enabled, `reports.checkpoint*` controls periodic canonical-report checkpoints.
|
|
124
137
|
Each checkpoint updates `mutation-report.json`; when the HTML reporter is
|
|
125
138
|
configured, it also regenerates `mutation-report.html` from that merged JSON.
|
|
126
139
|
|
|
140
|
+
`mutation.sampling` keeps `ceil(size * ratio)` mutants per subject (at least
|
|
141
|
+
one). Mutants are stratified by operator: each operator's mutants are ordered
|
|
142
|
+
by a SHA256 of `seed` and the mutant's stable ID, and the strata are visited
|
|
143
|
+
round-robin, so every operator is represented before any contributes a second
|
|
144
|
+
mutant. The kept mutants retain their original order. The same seed selects the
|
|
145
|
+
same mutants across runs and line shifts; change `seed` to draw another sample.
|
|
146
|
+
The applied `{strategy, ratio, seed}` is recorded in the report under
|
|
147
|
+
`sampling`.
|
|
148
|
+
|
|
149
|
+
Scoped runs (`--since`, subject patterns, survivor reruns) are merged into the
|
|
150
|
+
existing `mutation-report.json` by `stableId`. A run that mutated every
|
|
151
|
+
subject of a file (a non-authoritative run without subject patterns, such as
|
|
152
|
+
`--since`) lists it under the top-level `completeFiles` and replaces that
|
|
153
|
+
file's prior entry wholesale, dropping it when it yields no mutants, so stale
|
|
154
|
+
mutants of edited or deleted code do not linger. Each file entry carries
|
|
155
|
+
`sessionId` and `gitSha` provenance of the run that produced it; a file merged
|
|
156
|
+
from several sessions has none. `--since` diffs against the merge base
|
|
157
|
+
(`REF...HEAD`), so commits that landed on the base branch after you forked do
|
|
158
|
+
not count as your changes.
|
|
159
|
+
|
|
127
160
|
Before mutation testing starts, Henitai checks whether the current coverage data
|
|
128
161
|
covers the configured source files. If not, Henitai runs the configured test
|
|
129
162
|
suite once to bootstrap a usable coverage baseline. If coverage is still
|
|
130
163
|
unavailable for the current sources, `henitai run` aborts with
|
|
131
164
|
`Henitai::CoverageError`.
|
|
132
165
|
|
|
133
|
-
|
|
134
|
-
|
|
166
|
+
Survivors are never retried: flakiness can only turn a survivor into a kill, so
|
|
167
|
+
a retry could only inflate the score. A killed mutant is retried, up to
|
|
168
|
+
`mutation.max_flaky_retries` times (default 3), only when every test file that
|
|
169
|
+
failed for it is a known flaky test; if any retry survives, the mutant is
|
|
170
|
+
reported as `Survived`.
|
|
171
|
+
|
|
172
|
+
Known flaky tests come from the opt-in `mutation.flaky_detection: true`. The
|
|
173
|
+
baseline suite then runs twice (existing coverage is not reused), and test files
|
|
174
|
+
whose pass/fail outcome differs between the runs are written to
|
|
175
|
+
`reports/henitai_flaky_tests.json`. Without `flaky_detection` there is no flaky
|
|
176
|
+
set and nothing is retried. At the end of the run Henitai reports the flaky
|
|
177
|
+
tests and how many kills were re-checked.
|
|
178
|
+
|
|
179
|
+
A mutant only counts as detected when a test failed because of the mutation.
|
|
180
|
+
Before a mutant runs, Henitai checks that its activated code differs from the
|
|
181
|
+
original method by exactly the reported mutation; a mutant that fails this
|
|
182
|
+
check is reported as `CompileError` with the reason in `statusReason` instead
|
|
183
|
+
of running. Each mutant child reports what it got to — a failed activation, a
|
|
184
|
+
finished test run, or a `SystemExit` raised by the code under test — and only
|
|
185
|
+
a finished test run yields `Killed` or `Survived`. A failed activation is a
|
|
186
|
+
`CompileError`; a child killed by a signal, one that exits without reporting,
|
|
187
|
+
and a `SystemExit` during the tests are `RuntimeError`. With
|
|
188
|
+
`mutation.control_runs` (on by default), every subject that has detected
|
|
189
|
+
mutants is run once more with its unmutated method injected; if its tests fail
|
|
190
|
+
then, the injection itself is broken for that subject and its detected
|
|
191
|
+
verdicts are reclassified as `CompileError`.
|
|
135
192
|
|
|
136
193
|
Per-test coverage reporting is currently wired through the RSpec child runner.
|
|
137
194
|
Minitest integration reuses the same selection and execution flow, but does not
|
|
138
195
|
yet enable the per-test coverage formatter.
|
|
139
196
|
|
|
140
|
-
|
|
141
|
-
|
|
197
|
+
Test selection is coverage first: the per-test coverage map is the primary source
|
|
198
|
+
of candidate tests for a mutant, and name matching is only the fallback for when
|
|
199
|
+
the map cannot decide (no map, no location, or no covering test left in the
|
|
200
|
+
integration).
|
|
201
|
+
|
|
202
|
+
Henitai runs one mutant at a time by default. Set `jobs` in `.henitai.yml`
|
|
203
|
+
or pass `--jobs N` to run N mutants in parallel. `jobs` only sets how many
|
|
204
|
+
run at once: timeouts, flaky retries, control runs and INT/TERM handling
|
|
205
|
+
behave the same for every value.
|
|
142
206
|
|
|
143
207
|
Every forked test child sees a `HENITAI_WORKER_SLOT` environment variable
|
|
144
|
-
holding a stable worker-slot index (`0..jobs-1`; always `0`
|
|
145
|
-
path). A flaky-retry respawn keeps the original attempt's value. Test suites
|
|
208
|
+
holding a stable worker-slot index (`0..jobs-1`; always `0` with one job). A flaky-retry respawn keeps the original attempt's value. Test suites
|
|
146
209
|
that touch shared external resources can isolate themselves per slot without
|
|
147
210
|
any henitai-side hooks — for example a per-worker database:
|
|
148
211
|
|
|
@@ -161,6 +224,13 @@ for framework errors. With `--strict-exit-codes` (opt-in, additive) it also
|
|
|
161
224
|
exits `3` when one or more mutants timed out and `4` when runtime/compile
|
|
162
225
|
errors are present; precedence `2` > `3` > `4` > `1` > `0`. The timeout code
|
|
163
226
|
is informational — a run can pass its threshold and still exit `3`.
|
|
227
|
+
A run with no scoreable mutant passes its threshold only when there was
|
|
228
|
+
nothing to score (no changed code, everything ignored). When `CompileError`
|
|
229
|
+
harness errors emptied the score denominator, nothing was tested, and the run
|
|
230
|
+
exits `1`.
|
|
231
|
+
`Pending` mutants (left over from an interrupted run, without a verdict) are
|
|
232
|
+
excluded from both the MS and the MSI denominators; MSI is
|
|
233
|
+
`killed / (total - pending)`.
|
|
164
234
|
|
|
165
235
|
For pull-request feedback, add the `github` reporter to `reporters:` in
|
|
166
236
|
`.henitai.yml`: it prints one `::warning file=...,line=...` workflow command
|
|
@@ -174,10 +244,13 @@ and every covering test file are byte-identical to what was recorded. A
|
|
|
174
244
|
`Survived` verdict needs more proof, because a *new* test could now kill it:
|
|
175
245
|
it is reused only when, additionally, the live covering set derived from the
|
|
176
246
|
current per-test coverage map matches the recorded set exactly (no test
|
|
177
|
-
added, dropped, or changed)
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
247
|
+
added, dropped, or changed). Both kinds additionally require the *reuse
|
|
248
|
+
context* to be unchanged: a fingerprint of the test dependency files (spec
|
|
249
|
+
helpers, `spec/support`, fixtures/factories, `Gemfile.lock`, `.henitai.yml`,
|
|
250
|
+
`.rspec`), the henitai version, the integration, the operator set,
|
|
251
|
+
`test_excludes` and `coverage_criteria`. Verdicts recorded without a reuse
|
|
252
|
+
context are never reused. When per-test coverage is unavailable, survivors
|
|
253
|
+
simply re-execute — reuse never happens on doubt (see ADR-11).
|
|
181
254
|
Reused mutants stay visible in the report (`fromCache: true` beside
|
|
182
255
|
`stableId`) and count toward MS/MSI; the terminal prints
|
|
183
256
|
`N of M verdicts reused from history (K killed, S survived)` plus an
|
|
@@ -186,7 +259,20 @@ results.
|
|
|
186
259
|
Generated mutants temporarily include `legacyStableId` so scoped runs replace
|
|
187
260
|
canonical entries written before site-offset IDs were introduced instead of
|
|
188
261
|
duplicating them.
|
|
189
|
-
Timeouts and errors always re-execute. `--force` bypasses reuse
|
|
262
|
+
Timeouts and errors always re-execute. `--force` bypasses reuse, including
|
|
263
|
+
the reuse applied to `--survivors-from` reruns.
|
|
264
|
+
|
|
265
|
+
An interrupted run can be resumed. During the run, finished verdicts are
|
|
266
|
+
written to the history store in batches (the `reports.checkpoint_every` /
|
|
267
|
+
`checkpoint_interval` cadence). When the run is stopped with Ctrl-C, `TERM`
|
|
268
|
+
or `HUP`, henitai stops its test processes, saves what it has, prints
|
|
269
|
+
`henitai: interrupted; N verdicts saved, resume with --incremental` and exits.
|
|
270
|
+
`henitai run --incremental` then re-executes only what is missing. A detected
|
|
271
|
+
verdict is saved only after its control run passed, and only while the files
|
|
272
|
+
it ran against are unchanged since the run started, so an edit during the run
|
|
273
|
+
makes the affected verdicts re-execute instead of being reused. After a hard
|
|
274
|
+
kill (`SIGKILL`, out of memory) at most the last unsaved batch is lost. An
|
|
275
|
+
aborted run adds no point to the trend in `mutation-history.json`.
|
|
190
276
|
`henitai run --dry-run` lists the post-filter mutant set without executing
|
|
191
277
|
mutants and always exits `0`. Gate 0 may still run the configured test suite to
|
|
192
278
|
refresh baseline coverage.
|
|
@@ -201,9 +287,20 @@ authoritative, and the file may be the only artifact a dry run creates.
|
|
|
201
287
|
|
|
202
288
|
`henitai run --survivors-from ...` performs a partial rerun: it reports only
|
|
203
289
|
the selected survivors, skips threshold-based exit checks, and does not update
|
|
204
|
-
the run trend history.
|
|
290
|
+
the run trend history. The selected survivors go through the same reuse rules
|
|
291
|
+
as `--incremental`, always, not only with that flag: a survivor is skipped
|
|
292
|
+
(reported with `fromCache: true`) only when its subject source, its covering
|
|
293
|
+
test set and the reuse context are unchanged, so new or edited tests and
|
|
294
|
+
helpers invalidate it. Dirty worktree changes are included, so you can edit
|
|
205
295
|
tests locally without committing first; if source files under `includes` are
|
|
206
|
-
dirty,
|
|
296
|
+
dirty, the activation-recipe fast path is not used and the survivors are
|
|
297
|
+
re-matched against freshly generated mutants. Survivors restored from
|
|
298
|
+
activation recipes have no source range to fingerprint and are always
|
|
299
|
+
re-executed. When `--survivors-from` names a canonical report, Henitai uses the
|
|
300
|
+
matching session snapshot only if every file entry carries that report's
|
|
301
|
+
`sessionId`; a report merged from several runs is used as is.
|
|
302
|
+
Only authoritative runs (no `--since`, no subject patterns, no survivor rerun)
|
|
303
|
+
add a row to the trend history.
|
|
207
304
|
|
|
208
305
|
### Skipping mutations inline
|
|
209
306
|
|
|
@@ -226,8 +323,11 @@ standalone comment in the contiguous comment block directly above a `def`
|
|
|
226
323
|
(a blank line breaks the association). Trailing text is allowed
|
|
227
324
|
(`# henitai:disable -- reviewed defensive branch`). Skipped mutants are
|
|
228
325
|
reported as `Ignored`, so they stay visible in the report instead of silently
|
|
229
|
-
vanishing.
|
|
230
|
-
|
|
326
|
+
vanishing. `mutation.ignore_patterns` is matched against the source line where
|
|
327
|
+
each mutant's node starts, so only mutants on a matching line are reported as
|
|
328
|
+
`Ignored`; an enclosing `if` or block whose body matches stays mutated. Use
|
|
329
|
+
`mutation.ignore_patterns` for repo-wide policy and `# henitai:disable` for
|
|
330
|
+
one-off, reviewed exclusions.
|
|
231
331
|
|
|
232
332
|
Directives can also target specific operators, carry a reason (serialized as
|
|
233
333
|
`statusReason`, visible in the HTML report), and cover regions:
|
|
@@ -307,7 +407,8 @@ dashboard:
|
|
|
307
407
|
Set `STRYKER_DASHBOARD_API_KEY` in your CI environment to publish reports. When
|
|
308
408
|
the key, project, and version are present, the `dashboard` reporter uploads the
|
|
309
409
|
Stryker-schema report to the dashboard REST API (default
|
|
310
|
-
`https://dashboard.stryker-mutator.io`); otherwise it is skipped silently.
|
|
410
|
+
`https://dashboard.stryker-mutator.io`); otherwise it is skipped silently.
|
|
411
|
+
Scoped runs upload the merged canonical report rather than their partial one. The
|
|
311
412
|
project defaults to the git remote and the version to the current branch or CI
|
|
312
413
|
ref (`GITHUB_REF_NAME`/`GITHUB_REF`/`GITHUB_SHA`).
|
|
313
414
|
|
|
@@ -323,6 +424,9 @@ bundle install
|
|
|
323
424
|
bundle exec rspec # run tests
|
|
324
425
|
bundle exec ruby bin/verify-process-free-specs # verify self-mutation-safe specs
|
|
325
426
|
bundle exec rake smoke:integration:all # run rspec/minitest integration smoke projects
|
|
427
|
+
bundle exec rake oracle # measure false kills/survivors on the oracle corpus
|
|
428
|
+
bundle exec rake oracle:reuse # check --incremental verdicts equal fresh runs
|
|
429
|
+
bundle exec rake oracle:resume # interrupt runs with INT/TERM/HUP, check the resume
|
|
326
430
|
bundle exec rubocop # lint
|
|
327
431
|
bundle exec henitai clean # remove stale generated report artifacts
|
|
328
432
|
bundle exec henitai run # dogfood
|
|
@@ -65,6 +65,27 @@
|
|
|
65
65
|
"type": "number",
|
|
66
66
|
"exclusiveMinimum": 0
|
|
67
67
|
},
|
|
68
|
+
"suite_timeout": {
|
|
69
|
+
"type": "number",
|
|
70
|
+
"exclusiveMinimum": 0,
|
|
71
|
+
"default": 900.0,
|
|
72
|
+
"description": "Seconds the baseline suite run (coverage bootstrap, flaky detection) may take before it is stopped. A timed-out baseline is reported as a timeout, not a failure."
|
|
73
|
+
},
|
|
74
|
+
"flaky_detection": {
|
|
75
|
+
"type": "boolean",
|
|
76
|
+
"default": false,
|
|
77
|
+
"description": "Run the baseline suite twice and mark test files whose outcome differs between runs as flaky. Only killed mutants whose killing tests are all flaky are re-checked, up to max_flaky_retries times."
|
|
78
|
+
},
|
|
79
|
+
"fork_server": {
|
|
80
|
+
"type": "boolean",
|
|
81
|
+
"default": false,
|
|
82
|
+
"description": "Opt-in. Boot the test environment once in a long-lived fork server and fork each mutant run from it instead of re-booting per mutant. Supported for RSpec and Minitest with any jobs value; unsupported integrations and a server that fails to boot fall back to per-mutant boot with a warning."
|
|
83
|
+
},
|
|
84
|
+
"control_runs": {
|
|
85
|
+
"type": "boolean",
|
|
86
|
+
"default": true,
|
|
87
|
+
"description": "After execution, re-run each subject that has detected mutants with its unmutated method injected; if its tests fail, the subject's detections are reclassified as CompileError."
|
|
88
|
+
},
|
|
68
89
|
"ignore_patterns": {
|
|
69
90
|
"type": "array",
|
|
70
91
|
"items": {
|
|
@@ -83,6 +104,11 @@
|
|
|
83
104
|
},
|
|
84
105
|
"strategy": {
|
|
85
106
|
"enum": ["stratified"]
|
|
107
|
+
},
|
|
108
|
+
"seed": {
|
|
109
|
+
"type": "integer",
|
|
110
|
+
"minimum": 0,
|
|
111
|
+
"default": 0
|
|
86
112
|
}
|
|
87
113
|
}
|
|
88
114
|
}
|