Skip to content

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

Draft
astrovm wants to merge 3 commits into
mainfrom
test/mutants-150
Draft

astrovm wants to merge 3 commits into
mainfrom
test/mutants-150

Conversation

@astrovm

@astrovm astrovm commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Catches or excludes all 39 mutants that the weekly run reported in Issue #150.

Closes #150

Done when

  • All 39 reported mutants are caught or excluded. A cargo-mutants 27.1.0 run of the reported functions on the PR code, in the test container: 66 mutants, 66 caught, 0 missed, 0 timeouts.
  • The "Mutants / Changed code" job finds no missed mutant in the lines this PR changes.
  • scripts/coverage-container.sh passes: fmt, clippy -D warnings, nextest, 100% line coverage. Local run on 1455996: 894 tests pass, 14392 of 14392 lines covered.
  • CI passes on 1455996.
  • Agent review (see Review).

How each finding is handled

Findings File Fix
3 cli.rs resolve_setup_languages, prompt_theme New test language_prompts_start_on_the_saved_choices with a prompt that answers every list with its default. prompt_theme only returned ColorfulTheme::default(), so the three prompts call that directly.
5 display.rs preferred_resolution Test cases: a monitor with no width or no height is not a monitor, and the biggest area wins, not the longest side.
5 download.rs SLOW_WINDOW_BYTES, unpooled_client The release constant is written out as 5_242_880 with a comment (tests use 5, so no test could check the product). New test another_mirror_that_stops_responding_still_fails: the client for other mirrors keeps the stall timeout.
1 common.rs discard_stale_archive Excluded: an archive exactly MAX_CACHED_ARCHIVE_AGE old, to the nanosecond, is kept or dropped, and no test can make that age.
1 app.rs remember_window New test a_zoomed_window_bigger_than_its_monitor_shrinks_to_fit, with the monitor known only after the zoom, as on Wayland.
2 dialogs.rs ChoiceDialog::show New test long_choice_lists_scroll_and_keep_cancel_on_screen: with 40 options, the list takes at most 60% of the window and Cancel stays on screen.
6 motion.rs highlight, press Excluded: their values only tint and offset what is painted.
3 setup.rs show_install, skip_completed_steps New test install_texts_leave_room_for_the_status_icons. skip_completed_steps uses (start..last).find(..), so no counter can stop moving (two of its mutants timed out).
1 welcome.rs cover_uv Excluded: when the image and the area have the same shape, both branches give the whole image.
6 widgets.rs focus_ring, card Excluded: the focus outline and the card frame are only color, radius and shadow.
1 widgets.rs status_dot Removed: nothing outside its own test called it.
3 widgets.rs toggle_row New test toggle_row_texts_wrap_inside_the_row: both texts stay inside the row in a narrow window.
2 cli.rs has_only_gui_flags (timeouts) Rewritten over an iterator, so there is no index to mutate and no loop that can stop moving.

All changes

  1. .cargo/mutants.toml: exclude highlight and press (both name forms), focus_ring, card, and the equivalent mutants in cover_uv and discard_stale_archive, each with a comment.
  2. src/cli.rs: remove prompt_theme, and rewrite has_only_gui_flags over an iterator.
  3. src/cli_tests.rs: a default-answer prompt and the saved language test.
  4. src/display.rs: zero-size and area cases for preferred_resolution.
  5. src/external/download.rs: SLOW_WINDOW_BYTES written out, a /stall mirror and the stall test. Flaky test fix: cancelling_stops_a_download_that_receives_nothing now allows STALL_TIMEOUT * 3. On a busy machine it failed at 1.75 s against a 1 s limit. The server answers only after STALL_TIMEOUT * 3, so the test still fails if the cancel waits for the answer.
  6. src/ui/app_tests.rs: zoomed window test.
  7. src/ui/dialogs.rs: long list test. Its state is only the ChoiceDialog, so every line of the test runs (CI coverage had found a closure line that never ran).
  8. src/ui/setup.rs: skip_completed_steps with find.
  9. src/ui/setup_tests.rs: install text width test.
  10. src/ui/widgets.rs: remove the unused status_dot, and add the toggle row wrap test.
  11. .cargo/mutants.toml (review fix): the highlight, press, focus_ring and card exclusions now name their files. \bcard\b also matched WelcomeScreen::card in src/ui/welcome.rs. cargo mutants --list gives the same 2048 mutants before and after.
  12. src/ui/setup.rs (review fix): INSTALL_CARD_WIDTH and STATUS_ICON_SIZE name the install card width and the status icon size, and the layout test uses them.

Review

One Sonnet 5.5 review of the full diff on adcf7db (usage.py showed Room 0, so one review). I checked each finding myself:

  1. Exclusions without a file anchor (\bcard\b, in (highlight|press)$): fixed in 1455996, see item 11.
  2. Hardcoded layout numbers in install_texts_leave_room_for_the_status_icons: fixed, see item 12.
  3. another_mirror_that_stops_responding_still_fails may flake under load: not changed. I ran it and the cancel test 40 times each with --stress-count 40 at a load average of 38 to 51. All 80 runs passed. The exact retry count is what catches the mutant, so a weaker assert would lose it.
  4. install_texts_leave_room_for_the_status_icons removes hold-mods only when it passes: not changed. A failed assert ends the test and the temporary folder, which stops the worker. The test before it does the same.

The fixes do not change logic: a regex anchor (checked with --list) and two named constants.

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