Repository navigation
Releases
Releases · t-k/targeted-mutation
v0.14.0
Added
- Single-build targeted probes for range membership, slice
get/get_mutranges,clampcast bounds, andposition/rposition(further reducing library source-rebuild candidates ontargeted-mutationitself from 131 to 103, 98.1% overall probe coverage):- Range membership endpoint probes (
(a..b).contains(x)↔(a..=b).contains(x)): autoref-specialized for primitive ordered types (all 12 integer types,f32/f64, andchar), reborrowing arguments (&*(x)) to avoid moving&mutbindings, emitting a provableINPUT GAPwhen no test passes an input equal to the upper endpointb(witha <= b), and running only upper-endpoint-matching tests otherwise. - Slice/string
.get(a..b)/.get_mut(a..b)range probes: extendsRangeIndex(Get/GetMutmodes) to switch betweenRangeandRangeInclusivedirectly on simple single-line receivers with pure bounds. clampcast bounds and 128-bit integer support: allows side-effect-freeascast sources (literals, paths, and nested casts withoutDeref) inis_infallible_boundand addsi128/u128implementations toClampPrim.- Iterator
position↔rpositionprobes: autoref-specialized toDoubleEndedIterator + ExactSizeIterator(falling back toopaquewithout compile errors on non-double-ended or non-exact-size iterators such asstr::chars()), preserving original evaluation and iterator state during tracing and running reaching tests only.
- Range membership endpoint probes (
v0.13.0
Added
- Single-build targeted probes for indexed ranges, literal sets, and short-circuiting match guards (reducing source-rebuild candidates on
targeted-mutationitself from 305 to 217):- Indexed range endpoint probes (
&xs[a..b]↔&xs[a..=b],&mut xs[a..b]↔&mut xs[a..=b],xs[a..b].read_method()): switches between realRangeandRangeInclusiveat the indexing expression on simple single-line places with pure bounds, preserving identical return types, borrow modes (without requiringIndexMut<RangeFull>), evaluation order, out-of-bounds panics, andusize::MAXendpoints withoutRANGE_AT_TOPskips. - Targeted literal-set element deletion (
[lit1, lit2, ...].contains(&x)): lowers 2–8 distinct primitive literal sets with explicit shared-reference arguments into autoref-specialized probes (LitSetPrim/AnyLitSet) that record per-element match masks (Strace records), report unmatched elements directly as provableINPUT GAPfindings without running tests, run matched elements only against matching tests, fall back toopaqueif a trait overrides slice semantics, and unifyb'...'byte literals with integer literals during duplicate detection. - Short-circuiting
matchguard probes: evaluatesguard_overridebefore the guard expression so constanttrue/falsereplacements skip guard evaluation and match source mutations even when a guard has side effects or early exits (return/?), while preservingINPUT GAPplanning for strictly pure guards (trivial literals/paths or runtime-verified primitive comparisons).
- Indexed range endpoint probes (
v0.12.0
Added
- Eight new single-build targeted mutation rules (with autoref specialization so custom types with matching method names remain opaque without false positives, plus matching
--rebuild/--source-onlyedits):- Saturating and wrapping arithmetic (
SaturatingArith):a.saturating_{add,sub,mul}(b)↔a.wrapping_{add,sub,mul}(b)on all 12 primitive integer types, emitting a provableINPUT GAPwhen no test triggers differing results under overflow/underflow. - String whitespace trimming (
StrTrim):s.trim()→s.trim_start()/s.trim_end()ands.trim_start()/s.trim_end()→s.trim(), preserving receiver borrow lifetimes across&str,String, and&Stringand checking both slice length and pointer position (core::ptr::eq) for all-whitespace inputs. - ASCII case-insensitive equality (
StrCaseEq):a.eq_ignore_ascii_case(b)→ strict equality acrossstr,String,[u8],Vec<u8>,[u8; N], andu8(using.eq(...)in source rebuilds to preserve auto-deref/auto-ref resolution), emitting a provableINPUT GAPwhen no test matches only by ignoring ASCII case. - Absolute value (
Abs):x.abs()→xon signed integers and floats, checkingto_bits()on floats (distinguishing-0.0and-NaN) andcfg!(debug_assertions)on signedT::MIN, emitting a provableINPUT GAPwhen no test passes a negative value. - Iterator limits (
IterLimit):iter.take(n)→iter.take(usize::MAX)anditer.skip(n)→iter.skip(0)specialized toIteratorwithusizecounts (leavingstd::io::Read::take(u64)and custom methods untouched, and preserving count-expression side effects in source rebuilds). - Endian byte-order swaps (
EndianSwap):x.to_be_bytes()↔x.to_le_bytes()andx.to_be()↔x.to_le()on multi-byte primitive integers (excluding 1-byteu8/i8), emitting a provableINPUT GAPwhen every observed value is byte-palindromic (x == x.swap_bytes()). - Bit-count swaps (
BitCount):x.leading_zeros()↔x.trailing_zeros()andx.leading_ones()↔x.trailing_ones()across all 12 primitive integer types, emitting a provableINPUT GAPwhen leading and trailing counts agree on every test. - Loop control swaps (
LoopCtrl): unlabeled, value-lessbreak↔continueinside loops (restrictingcontinue→breakto unit-typedfor/whileloops so value-bearing or divergingloopexpressions always type-check), run only against reaching tests.
- Saturating and wrapping arithmetic (
v0.11.1
Improved
- Event-driven child process exit waiting (
kqueue/pidfd):- Replaced polling sleeps when waiting on test binaries with kernel exit notifications (
kqueueEVFILT_PROC/NOTE_EXITon macOS andpidfd_open+pollon Linuxx86_6464-bit,aarch64,x86, andriscv64, falling back to bounded sleep polling elsewhere), eliminating per-mutant wait latency while preserving timeout and interrupt handling.
- Replaced polling sleeps when waiting on test binaries with kernel exit notifications (
- Copy-on-Write executable cloning for witness runs (
fclonefileat/FICLONE):- Used APFS
fclonefileat(2)on macOS (falling back to regular copy when BSD file flags such asUF_IMMUTABLEare set) andioctl(FICLONE)on Linux (x86_6464-bit,aarch64,x86,riscv64) when staging witness test binaries, with a file-length mismatch short-circuit inWorkCopybyte comparisons.
- Used APFS
- SIMD-accelerated line and trace scanning (NEON / SSE2):
- Accelerated newline and tab scanning in
LineIndex::newandTrace::parseusingaarch64NEON andx86_64SSE2 intrinsics, paired with borrow-firstBTreeMaplookups and fast ASCIIu32parsing while preserving exactstr::linesandstr::parsecompatibility. - Pre-indexed primitive arithmetic and cast-probe spans per file during planning to avoid repeated AST scans.
- Accelerated newline and tab scanning in
- Lean 4-verified planner and runtime probe optimizations:
- Proved 4-bit comparison truth-table masks,
BitVecdisjoint-bit identities, domain-universal comparison equivalence, and zero-allocationstr::replacevsreplacen(..., 1)equivalence informal/lean/Planner.lean(Lean 4 v4.36.0, zero warnings). - Applied the verified bitmask table in
src/plan.rsandsrc/runtime/tmt_rt.rs, added zero-allocationstr_replace_differs, deferredVal::tmt_val()conversion behindidle(site)on comparison probes, addedbits_known/StrAffixshort-circuits, and batched per-thread trace backlog flushes.
- Proved 4-bit comparison truth-table masks,
v0.11.0
Added
- Project and workspace configuration file (
tmt.toml):- Added auto-discovery walking upward from the target directory to the workspace root (
[workspace]inCargo.toml) or.gitboundary fortmt.toml,.config/tmt.toml, or.cargo/tmt.toml(failing explicitly if more than one candidate exists in the same directory), plus--config <FILE>and--no-configCLI flags. - Supported declarative persistence of project-level mutation, test-selection, Cargo build, output, and fixture/work-directory options with
[package.<name>]per-package overrides applied consistently across single-package runs (including single-member virtual workspaces with globmembers) and--workspace/ multi--pruns (including per-packagework_dir, copy/fixture differences, and per-packagesource_only = truesharding). - Enforced
built-in defaults < top-level config < [package.<name>] < CLI flagsprecedence with automatic cross-layer conflict resolution (e.g. CLI--source-onlyoverridingrebuild = true, or--featuresoverridingall_features = true) and empty-array clearing ([]). - Hardened config loading with
#[serde(deny_unknown_fields)], 1 MiB read cap on opened regular files (O_NONBLOCK/O_NOFOLLOWon Unix to prevent FIFO hangs and symlink escapes outside the auto-discovered directory), NUL/control/BiDi character rejection across both raw text and TOML-decoded strings/paths/keys, and project-root-relative resolution forbaselineandwork_dir.
- Added auto-discovery walking upward from the target directory to the workspace root (
v0.10.1
Fixed
- Effect-trace representative selection with
UNKNOWN_TEST("?"):- Picked the first named test as representative when
UNKNOWN_TEST("?") is mixed with named tests in an effect-trace test list instead of rendering`?` (and N more), and rendered unnamed-only lists as"a test"/"a test (and N more)".
- Picked the first named test as representative when
- Static bit-disjointness filtering and clearer advice for
|↔^:- Recorded primitive integer type bounds on
|and^probes and skipped the equivalent|↔^(ArithSwap2) mutation when runtime-verified primitive sub-expressions prove(lhs_possible_ones & rhs_possible_ones) == 0(covering constant shifts, bitmasks, unsigned remainders, and power-of-two mul/div, while conservatively preserving signed right shifts, overloaded operators, and any site wherediffers2was observed). - Updated
INPUT GAPadvice for|↔^when disjointness cannot be statically proved to explain that operands must share at least one set bit and that|and^are equivalent if disjoint by construction.
- Recorded primitive integer type bounds on
- Standard collection capacity-hint noise filtering:
- Skipped pure capacity-hint expressions in standard collection constructors (
Vec,String,VecDeque,BinaryHeap,HashMap,HashSet,OsString,PathBuf,CString,BytesMut,SmallVec,IndexMap,IndexSetwith_capacity/with_capacity_and_hasher/reserve/reserve_exact) and.reserve_exact(...), as well as statement deletion on plain-placereserve/reserve_exactcalls, while keeping non-capacity arguments, side-effecting blocks/receivers, custom domain APIs, and fallibletry_reserveintact.
- Skipped pure capacity-hint expressions in standard collection constructors (
- Duplicate enclosing
ASSERTION GAPon constant-operand||/&&:- Suppressed surviving
||↔&&(LogicSwap) assertion gaps when every observed evaluation produced a boolean value wherea || b == a && b(all(false, false)for||or all(true, true)for&&) and the right-hand operand is syntactically side-effect-free, accounting for the survivor undersurvivor_breakdown.redundant_constantso report counts continue to reconcile.
- Suppressed surviving
v0.10.0
Added
- External parent-relative path staging (
--stage-external <SRC[=REL]>):- Added repeatable
--stage-externalsupporting both shorthand (../../proto) and explicit (SRC=REL) forms to stage parent-relative files and directories into a confined subdirectory layout under<work-dir>/srcfor monorepo subpackages whosebuild.rsorinclude_str!references shared parent paths. - Enforced symlink confinement to the staged root, case-insensitive collision rejection, and
WorkCopyseparation between staged external paths and the workspace copy.
- Added repeatable
- Substring/module test filtering and Cargo-compatible target flags:
- Added repeatable
--test-filter <PATTERN>for substring and module-prefix libtest filtering (combined with--include-testvia union and--exclude-testvia exclusion). - Added
--lib,--bins, and repeatable--test <NAME>target selection flags (including explicit selection oftest = falsetargets). - Added pre-build target validation against
cargo metadataand actionable zero-test hints (suggesting--lib/ underscore library target names when a binary target has no tests, and suggesting--test-filterwhen--include-testmatches a runnable test only by substring).
- Added repeatable
- Streaming Cargo build progress and persistent repair exclusion cache:
- Streamed
cargo test --no-run --message-format=jsonoutput to report compiled/cached crate counts and the latest crate name to stderr every 5 seconds during long builds (suppressed under--quiet). - Cached compile-error repair exclusions in
<work-dir>/.tmt-repair-cache.jsonusing exclusive atomic writes (create_new+rename) and a SHA-256 fingerprint covering the full staged tree, external path dependencies, environment variables, Cargo configuration, andrustcversion so identical repeat runs finish in a single build.
- Streamed
Fixed
- Skip pointless repair rebuilds on non-probe compile errors:
- Detected missing-file and compile-time environment errors (
include_str!/include_bytes!/include!, undefinedenv!, andE0583missing modules) outside probe-inserted text and exited immediately without running an unnecessary repair rebuild.
- Detected missing-file and compile-time environment errors (
v0.8.0
Added
- Six value-aware targeted mutation rules:
s.starts_with(p)/s.ends_with(p)→s.contains(p)(provableINPUT GAPwhen no test passes a string containingpaway from the start/end).s.replace(a, b)↔s.replacen(a, b, 1)(provableINPUT GAPwhenanever occurs more than once).x.clamp(lo, hi)→x.min(hi)(drop lower bound) andx.max(lo)(drop upper bound), with infallible-bound probe specialization, reversed/NaN panic tracking, and source-built fallback for potentially panicking or side-effecting bounds.x.floor()/.ceil()/.round()/.trunc()→ two rounding-mode alternatives each (provableINPUT GAPwith concrete distinguishing examples when observed inputs do not separate rounding modes).iter.all(closure)↔iter.any(closure)onIteratorreceivers (using method auto-reborrow andIteratorautoref specialization so&mutiterators,Copyiterators, and non-Iteratorcustom types compile without skips).[lit1, lit2, ...].contains(&x)element pruning (source-built under--rebuild/--source-only), with canonical value deduplication (includingf32/f64, hex/decimal, signed zero, and raw strings) and per-element survivor descriptions.
- AST sub-hunk undo for
--since:- Decomposes multi-addition diff hunks into independent AST sub-hunk reverts for added
&&/||terms, added struct literal fields (with..base), and added standalone statements, catching an untested clause inside an otherwise-tested hunk while preserving whole-hunkall_undonesemantics,#[cfg(test)]/#[mutants::skip]guards, andline!()/column!()/#[track_caller]location sensitivity.
- Decomposes multi-addition diff hunks into independent AST sub-hunk reverts for added
- Stronger-assertion struct field narrowing:
- When a surviving mutant and the original return the same multi-field
Debugstruct differing on exactly one field (recursively, supporting nested structs, raw keywords liker#type/r#gen, and Unicode identifiers), compiler-verifies&result.<path> == &(<value>)and suggestsassert_eq!(call.<path>, <value>);withwitness.fieldpopulated in JSON (even when the struct does not implementPartialEq).
- When a surviving mutant and the original return the same multi-field
- JSON
schema_version: 1:- Added top-level
schema_version: 1(report::SCHEMA_VERSION) to single-package JSON reports,--list --format json,--workspace --format json, and every--format jsonlrecord (both success and error).
- Added top-level
- Terminal control-character sanitization:
- Sanitized untrusted project strings (paths, package names, source snippets, test names, witness output, CLI errors, and progress notes) across terminal stdout and stderr — stripping 7-bit/8-bit ANSI CSI/OSC/DCS/SOS/PM/APC/nF escape sequences, C0/C1/DEL control characters, Unicode BiDi override/isolate controls, and forged inline newlines — while keeping JSON, JSONL, and SARIF outputs lossless.
v0.7.0
Added
- Unified output format flag (
--format text|json|jsonl|sarif) while preserving--json,--jsonl, and--sarifas backward-compatible shorthand flags. - Grouped CLI help organizing all options into six workflow sections (
Target & Scope,Mutation Mode,Test Execution & Selection,Output & Baselines,Performance & Cargo Build,Work Directory & Fixtures) with compact-hsummaries, detailed--helpdescriptions, usage examples, and an exit-code reference. - Expanded SARIF 2.1.0 reporting:
- Added rules for
unstable-prediction,weakened-test, andaudit-disagreement, plusproperties.auditmetadata on SARIF runs.
- Added rules for
- Structured audit diagnostics:
- Added
Audit.not_auditedfor sampled survivors whose full re-run wasUnableor an unconfirmed timeout. - Added
TraceDifference.rerun_failedso trace rerun failures are distinguished from ordinary trace drift in text, JSON, and SARIF output.
- Added
- Subreaper-aware orphan cleanup (
ACTIVE_CHILDRENtracking, PID 1 / LinuxPR_GET_CHILD_SUBREAPERdetection, Linuxpidfd_open+pidfd_send_signal+waitid(P_PIDFD)with safe fallbacks, and non-Linuxps-bracketedlsofverification) with an updatedformal/tla/Leftovers.tlamodel. - Documentation:
- Documented
i128/u128probe specialization limits (--source-onlyworkaround) and async/thread-pool worker thread attribution limits (tokio/rayon,--isolate-testsworkaround) inREADME.md.
- Documented
Changed
- Consistent CLI exit codes:
- All CLI argument parse, range, and conflict errors now exit with code
1(instead of clap's default2), keeping exit code2unambiguous for test gaps, unstable predictions, and audit discrepancies in CI pipelines. --auditdiscrepancies (disagreements,source_disagreements, andtrace_differences) now count as gaps and return exit code2(while unconfirmed timeouts still take precedence with exit code3).
- All CLI argument parse, range, and conflict errors now exit with code
- Baseline ignore-comment lexing:
- Replaced line-based comment scanning with a Rust lexer supporting string literals, raw strings, escaped character literals (
'\''), and nested block comments (/* ... */). Inline trailing// tmt:ignorecomments now apply only to their own line, while standalone comment lines continue to apply to the next line.
- Replaced line-based comment scanning with a Rust lexer supporting string literals, raw strings, escaped character literals (
- Stronger-assertion witness discovery:
- Added support for
super::f(...)calls inside direct childmod testsmodules, normalized argument token deduplication so duplicate/reformatted calls do not crowd out distinct inputs within the 4-call budget, and bounded scenario memory toO(MAX_CALLS). - Included boundary source mutants in stronger-assertion witness synthesis and preserved original binaries with exclusive
create_newtemporary files during shared witness runs.
- Added support for
- Parallel filtered timing pre-warming:
- Keyed cached filtered baseline timings by
(test_threads, filter)and pre-warmed uncached jobs serially at the parallel thread count. Added a warning when combining--source-onlywith--jobs > 1.
- Keyed cached filtered baseline timings by
- Internal module structure:
- Extracted shared witness AST helpers into
src/witness/common.rs, splitsrc/instrument.rsandsrc/driver.rsinto cohesive submodules, and decomposedrun_packageinto focused phase helpers without changing public APIs.
- Extracted shared witness AST helpers into
Fixed
- Probe runtime memory ordering: used
Release/Acquireordering onMODEsoTARGETwrites are guaranteed visible on weakly ordered architectures (e.g. ARM64), added fastidle(site)short-circuits, and fixed-0.0/+0.0/NaN handling inMinMaxPrim. - Checkpoint partial completion: kept checkpoints resumable when
Outcome::Unableremains in thesourcephase instead of marking the campaign completed (verified withformal/tla/CampaignCheckpoint.tla). - Work-copy and wrapper safety: skipped special files (FIFOs, sockets, device nodes) and symlinks pointing into excluded paths during workspace copying; rejected absolute, parent-traversal, and control-character paths in
--test-wrapper; rejected--jobs 0. - Output fixtures on case-insensitive filesystems: safely allowed case-only renames of owned fixtures while rejecting hard links to unowned files (
same_directory_entry). - Git diff & scope parsing: unified
Scope::from_diffwithhunks()to avoid mistaking+++lines in diff bodies for file headers and handleddiff.suppressBlankEmpty=true. - Instrumentation edge cases: preserved inner attributes (
#![...]) at the start of function bodies, avoided dropping meaningful trailing commas in 1-element tuples duringsame_built_tokens, inserted whitespace when removing unary!/-would merge tokens, and skipped#[cfg]/#[cfg_attr]/#[mutants::skip]-annotated assignments (including destructuring assignments). - Process cleanup and audit accuracy: killed timed-out/errored child processes before leftover sweeps, guarded process-group signalling with
id > 1, snapshotted nextest child groups beforewait, skipped Linux pseudo-FDs (/proc/<pid>/fd/*) without dropping renamed regular files, and avoided reportingUnable/unconfirmed-timeout audit reruns as false disagreements. - SARIF path handling: normalized Windows separators without breaking Unix literal backslashes or existing Windows baseline paths.
- Campaign identity: hashed canonicalized executable targets when the invoked binary is a symlink.