Skip to content

test: catch the missed mutants from the weekly run - #145

Merged
astrovm merged 8 commits into
mainfrom
test/missed-mutants
Nov 22, 2026
Merged

astrovm merged 8 commits into
mainfrom
test/missed-mutants

Conversation

@astrovm

@astrovm astrovm commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Catches or excludes all 101 mutants that the weekly run reported in Issue #138.

Closes #138

Done when

  • All 101 reported mutants are caught or excluded (cargo-mutants 27.1.0 with nextest, in the coverage container). 50 of them still exist in the code: 49 caught, 1 unviable. The other 51 are in excluded paint code or in code this PR rewrote. The last 4 survivors were fixed in 95e87ce and 6d6dc50, and a run of their functions on 6d6dc50 caught all 9 mutants.
  • The "Mutants / Changed code" job finds no missed mutant in the lines this PR changes. On bf221f8: 156 mutants, 150 caught, 6 unviable, and the trial part of the weekly run: 33 mutants, 30 caught, 3 unviable. On 6d6dc50 it had missed 3, which bf221f8 fixes.
  • scripts/coverage-container.sh passes: fmt, clippy -D warnings, nextest, 100% line coverage. On bf221f8: 888 tests passed, lines 14345 of 14345.
  • CI passes on bf221f8: all 20 checks.
  • Agent review (see Review).

How each finding is handled

Findings File Fix
1 banner.rs print_banner New test turns colors on and checks every line is colored.
4 cli.rs resolve_game_path_from, detect_resolution, use_rich_prompts, setup_is_fully_specified Tests for the exact "not detected" error, the resolution source, and each preset or mod choice. The terminal check moves into rich_prompts_fit, which takes the two terminal flags, so a test can cover all cases.
3 download.rs download_attempt Test: an empty partial file starts over without a Range header. The slow-mirror check moves into too_slow, with a test at the window minimum.
4 proton.rs split_number uses trim_start_matches (the old loop timed out when mutated). configured_tool_from_config uses std::cmp::max_by_key, so an equal priority has no second branch. New scenarios: a switch to Proton Hotfix is caught before launch, and a Proton 10 that Steam still has to download is not refused. prefix_state_in is caught by the new scenarios.
3 main.rs in_game_mode Test of all 4 combinations of GAMESCOPE_WAYLAND_DISPLAY and SteamGamepadUI. Removed the unused let _ = in_game_mode();.
2 common.rs default_cache_dir The release version was only called by integration tests that set ADVENTURE_MODS_CACHE_DIR, so its result was never used. New integration test a_prefetched_mod_waits_in_the_app_folder_of_the_users_cache points XDG_CACHE_HOME at a temporary folder, prefetches a mod, and checks the archive is in adventure-mods/downloads there. A new unit test checks the test version.
3 pipeline.rs Retry loops are now for attempt in 1..=MAX_MOD_INSTALL_ATTEMPTS, so a mutant cannot make them endless (they timed out before).
5 library.rs Trailing NUL bytes are removed with while let Some(&0) = buf.last(). New tests: a blocked Steam folder offers a game that another list missed, and only a game that is nowhere is logged as not found.
6 vdf.rs parse_quoted_string Rewritten over a chars() iterator, so there is no index math to mutate and no loop that can stop moving.
8 app.rs Tests: a window size counts as saved only with both sides, a toast fades in, stays and fades out, and a toast keeps the window repainting. The fade math moves into Toast::fade and the offset into TOAST_OFFSET. || !self.toasts.is_empty() is removed from the 100 ms repaint condition: show_toasts already asks for a repaint on every frame while a toast is open, so that term could never change anything.
5 images.rs worker_count leaves one core for the UI, with a test. A 1600-wide screenshot shrinks to exactly MAX_WIDTH. The prefetch test checks that a ready image stays ready. replace > with >= in decode is equivalent (an image exactly MAX_WIDTH wide is resized to the same size), so it is excluded with a comment.
4 motion.rs, progress.rs The slide offset moves into slide, with a test. The clear_mod test checks that only the other mod's download is left.
21 setup.rs on_back uses (0..current).rev().find(..). Layout math moves into mod_columns, mod_list_height, picture_size, centering_space and height_changed, with tests. New UI tests: the previous-page pad button turns back, a step without a download shows no progress bar, each question has its own screen key, and the pad label is empty during the manager step.
1 theme.rs bold Test checks that bold and heavy use their own Rubik weights.
20 welcome.rs Layout math moves into side_margin, tile_widths and tile_size, with tests. The selected tile's width uses egui::lerp, and its grow time is the named constant motion::TILE_GROW. GameCard::select is tested with an index just past the last install. Which game has a backdrop moves into has_backdrop, with a test. The rest of paint_backdrops only paints, so it is excluded.
11 widgets.rs Test: a button grows with its label and padding. The paint code of choice_row moves into paint_choice_row, which is excluded. The Back button chevron (back_button) is paint only and is excluded.

All changes

  1. .cargo/mutants.toml: exclude paint_choice_row, back_button and paint_backdrops (paint only), and the one equivalent mutant in decode, each with a comment.
  2. src/banner.rs: new colored banner test. It puts back the global color setting when it ends.
  3. src/cli.rs: new rich_prompts_fit, used by use_rich_prompts.
  4. src/cli_tests.rs: exact error text, mod choice and rich prompt tests. detect_resolution_uses_a_safe_fallback is replaced by detect_resolution_asks_the_display_server_then_xrandr, which compares with the real sources.
  5. src/external/download.rs: new too_slow, and tests for the empty partial file and the slow window.
  6. src/external/proton.rs: split_number with trim_start_matches, max_by_key for the best failure, and a split_number test.
  7. src/external/proton_scenarios_tests.rs: Proton Hotfix and Proton 10 download scenarios.
  8. src/main.rs: removed the unused in_game_mode() call, new game mode test. The test leaves both variables unset.
  9. tests/download.rs: release cache folder integration test, Linux only because XDG_CACHE_HOME moves the cache only there.
  10. src/setup/common_tests.rs: test cache folder test.
  11. src/setup/pipeline.rs: bounded for retry loops in prefetch and install.
  12. src/steam/library.rs: bounded NUL trim loop.
  13. src/steam/library_tests.rs: blocked folder and "not found" log tests.
  14. src/steam/vdf.rs: parse_quoted_string over chars().
  15. src/ui/app.rs: TOAST_OFFSET and Toast::fade, and the redundant toast term removed from the repaint condition.
  16. src/ui/app_tests.rs: window size and toast tests.
  17. src/ui/images.rs: worker_count, wide screenshot test, ready image check.
  18. src/ui/motion.rs: slide, with a test, and the TILE_GROW constant.
  19. src/ui/progress.rs: clear_mod check.
  20. src/ui/setup.rs: on_back with find, layout helpers, and height_changed for the centering check.
  21. src/ui/setup_tests.rs: the fake runtimes hold while a marker exists, so a test can see the Dotnet step. New pad, progress bar, screen key and layout tests.
  22. src/ui/theme.rs: font weight test.
  23. src/ui/welcome.rs: TILE_GAP, side_margin, tile_widths, tile_size, has_backdrop, egui::lerp for the tile width, tests, one more select case.
  24. src/ui/widgets.rs: paint_choice_row and a button width test.
  25. src/setup/pipeline.rs: the mod install loop leaves at the first success through a match, like the prefetch loop. Before, a success went through the same condition as the last attempt. Replacing that || with && only added a pause and a second, no-op install, so no test could see it.
  26. src/setup/pipeline_tests.rs: a mod that fails once installs on the second try, with 2 downloads.
  27. src/ui/app_tests.rs: the toast sits at least 100 points above the bottom of the window, inside it. The test uses a fixed number, so a changed TOAST_OFFSET fails it.
  28. src/ui/welcome.rs: tile_widths tests for rows of 1 and 3 tiles. With 2 tiles, the gap times 1 equals the gap divided by 1, so * to / went unseen.

Review

Sonnet 5.5 (high) reviewed the full diff on 7825a2d. It found 3 problems, all fixed in 36134d7. None is rejected.

  1. The paint_backdrops exclusion hid logic: which game shows a backdrop. Fixed: has_backdrop holds it, with a test.
  2. The cache folder integration test relies on XDG_CACHE_HOME, which only Linux uses. On macOS it would fail and write to the real cache. Fixed: the test is Linux only.
  3. Two tests changed global state without putting it back (the console color flag, and two environment variables). Fixed: both now restore it.

I re-checked each fix myself: the new and changed tests pass. The "Mutants / Changed code" job checks the mutants of has_backdrop.

The changes after the review (95e87ce, 6d6dc50) keep the same behavior, and I checked them myself: egui::lerp(small..=large, grow) computes (1 - grow) * small + grow * large, the same width as before; TILE_GROW is 0.24 s, the old QUICK * 2.0; height_changed is the old expression. The usage limit (Room 0) allows no second agent review.

The install loop change in bf221f8 is also checked by me only, for the same reason. The old if broke on success, on the last attempt, or on cancel, and slept otherwise. The new match does the same in that order: Ok breaks, an Err on the last attempt or after cancel breaks, any other Err sleeps. cargo-mutants caught all 5 mutants of the new lines.

It also checked these and found no change in behavior: the parse_quoted_string rewrite (escapes, unterminated strings, multibyte characters), split_number, the max_by_key tie, the retry loops (attempts, sleeps, reported attempt numbers, cancel), the NUL trim, on_back, the layout helpers, the removed toast repaint term, and the decode exclusion (with image 0.25.10).

@astrovm
astrovm marked this pull request as draft November 22, 2026 03:22
@astrovm
astrovm marked this pull request as ready for review November 22, 2026 16:45
@astrovm
astrovm merged commit f3b7be1 into main Nov 22, 2026
20 checks passed
@astrovm
astrovm deleted the test/missed-mutants branch November 22, 2026 16:47
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