Skip to content

test: catch missed mutants from #175 - #183

Open
astrovm wants to merge 2 commits into
mainfrom
test/mutants-175
Open

astrovm wants to merge 2 commits into
mainfrom
test/mutants-175

Conversation

@astrovm

@astrovm astrovm commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Handles every missed mutant in Issue #175 (weekly parts 0-63), and fixes the Rust weekly parts that failed with no mutant.

Closes #175

How each finding is handled

Rows in Issue #175 Verdict Handling
scripts/check-coverage.ts 23-31 (glob and root scope) Test gap New test: every root, file roots, nested roots, . and globs with * and ?. (config.exclude ?? []) became config.exclude?., which has no empty-array mutant.
scripts/check-coverage.ts 36-43 (tracked files) Test gap, plus dead code New test: a directory that is not a git repository. The filter(Boolean) and \\ replace did nothing (git writes /, and the empty last name matches no extension), so they are removed.
scripts/check-coverage.ts 48-49, 75 (report paths) Test gap, plus dead code New test: report base paths, and paths outside the root. The .. guard was dead: an outside path starts with .. and no tracked file does. Removed.
scripts/check-coverage.ts 79-91 (line data) Test gap One regex now parses DA:<line>,<hits>[,<checksum>]. New tests: negative, zero, missing, extra and checksum fields, and a record's lines after end_of_record.
scripts/check-coverage.ts sort of missing Equivalent Removed: the sources come from git ls-files, which is sorted.
scripts/check-coverage.ts import.meta.main block Not testable in process // Stryker disable all with the reason. check-coverage-cli.test.ts already runs it as a subprocess.
scripts/supplement-sbf-coverage.ts 11, 25, 32 Test gap New tests: LF/LH are recomputed per record, host summary lines add nothing, and every field after the count is kept.
scripts/supplement-sbf-coverage.ts 8 (let source = "") Equivalent A DA line before any SF line is not LCOV, and its key matches no line. Disabled with the reason.
scripts/supplement-sbf-coverage.ts 40-48 (command line) Test gap The command line moved to an exported main(args, base). New tests: it writes the output, each missing or empty path fails, and the default base is solana/.
evm/src/Timba.sol:123 remove __Ownable2Step_init() Equivalent OpenZeppelin's function has an empty body. The call stays, because OpenZeppelin asks every parent initializer to be called. scripts/mutants-sol/run.py now has an EQUIVALENT list that drops it, with this reason.
evm/src/Timba.sol:146, 199, 244, 271, 319, 340 remove nonReentrant Test gap The old test passed without the guard: its token marked the call "blocked" when the nested join failed for any reason, and the nested join also failed on the token's empty balance. ReentrantToken now passes on the nested call's revert. testReentryFromTransfersAndUpgradesIsBlocked expects ReentrancyGuardReentrantCall from createGame, closeGame, joinGame, completeGame, refundPlayer and upgradeToAndCall, then shows the same nested join succeeds outside the guard.
evm/src/Timba.sol:169, 173 remove onlyOwner Test gap A stranger calling renounceOwnership or transferOwnership(timba) gets OwnableUnauthorizedAccount, not InvalidAuthorization.
evm/src/Timba.sol:161, 204, 215, 216, 218, 248 boundaries Test gap Tests at each limit itself: maxTimeout == minTimeout, creation at its deadline, timeout at the minimum and maximum, the largest coinflip amount, the latest start that fits in uint48, and a private join at its deadline.
evm/src/Timba.sol:268 - to + in the PlayerJoined index Test gap The private join test checks the event's index.
evm/src/Timba.sol:307 < to <= (32 entropy samples) Test gap ExhaustedEntropyTimba now returns usable entropy only from the last rehash, which the 32-sample budget never reads.

Rust parts with no mutant

Parts 49-63 of the Rust weekly run failed on 2026-11-14 with Found 0 mutants to test. The Solana program has 194 mutants. The default slice sharding gives each of the 64 parts a run of 4, so parts 0-48 get all of them and parts 49-63 get none. found then treated an empty part as a broken setup.

  1. scripts/mutants-rust.sh shard now uses --sharding round-robin, so each part gets 3 or 4 mutants.
  2. If a part is still empty, the script lists all mutants with cargo mutants --list. The part passes only when there is at least one mutant and fewer mutants than parts. With as many mutants as parts, round-robin gives each part one, so an empty part fails as a broken setup.

All changes

  1. scripts/check-coverage.ts: simpler scope, tracked-file and report-path code; one regex for DA lines; Stryker disable for the import.meta.main block.
  2. scripts/check-coverage.test.ts: tests for scope roots and globs, report base and outside paths, line data, record ends, and a non-git directory.
  3. scripts/supplement-sbf-coverage.ts: exported main(args, base); Stryker disable comments with reasons.
  4. scripts/supplement-sbf-coverage.test.ts: tests for summaries, checksum fields and the command line.
  5. scripts/mutants-rust.sh: round-robin sharding; an empty part passes when the unsharded list has mutants (has_mutants, found MUTANTS_OUT [ALL_LIST]).
  6. scripts/mutants-rust.test.ts: tests for both empty-part cases.
  7. scripts/mutants-sol/run.py and test_run.py: an EQUIVALENT list the filter drops, with a test.
  8. evm/test/Timba.t.sol: ReentrantToken replaces CallbackToken; new reentrancy, owner, boundary and event checks; ExhaustedEntropyTimba tests the exact budget.

Done when

  • Stryker on scripts/check-coverage.ts and scripts/supplement-sbf-coverage.ts: 0 survived, 0 no coverage (5 workers, 235 mutants, all killed).
  • bun test scripts: 63 pass on 6dfa64b. tsc --noEmit and prettier pass.
  • forge test --match-contract TimbaTest: 32 pass. forge fmt applied.
  • cargo mutants --list --shard K/64 --sharding round-robin: parts 0, 48 and 63 have 4, 3 and 3 mutants. With the old sharding, part 63 had 0 and wrote [].
  • vertigo-rs on every Timba.sol row of Issue Missed mutants #175 (17 lines): 24 of 24 changes caught. 11 more did not compile or kept the same bytecode, and remove __Ownable2Step_init(); was dropped as equivalent.
  • CI green on 6dfa64b: every check passes, including the setup trial of the Rust and Solidity parts. No mutants comment.
  • Agent review: one Sonnet review of the full diff. Its one finding is fixed in 6dfa64b.

Review

One Sonnet review of git diff origin/main...HEAD (the usage limit allowed one review).

  1. Fixed: the empty-part fallback passed whenever the unsharded --list had any output. It did not compare the mutant count with the part count, so a broken part could pass. found now takes the part count and passes an empty part only when 0 < mutants < parts. Two new tests in scripts/mutants-rust.test.ts cover both sides. I rechecked this logic fix myself instead of a second review.
  2. Fixed: the comment for the __Ownable2Step_init exclusion in scripts/mutants-sol/run.py now also names the onlyInitializing check.
  3. The reviewer checked the six nonReentrant removals that vertigo reports as caught. Each one is killed by testReentryFromTransfersAndUpgradesIsBlocked. No change.

Add tests for the coverage scripts, the Timba boundary, owner and
reentrancy checks, and the entropy budget. Spread the Rust mutants over
every weekly part, and let an empty part pass when the full list has
mutants. Skip the one equivalent Solidity mutant with its reason.
@astrovm
astrovm marked this pull request as ready for review November 29, 2026 02:03
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-11-29T02:05:41.760183Z 6dfa64b Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missed mutants

1 participant