Skip to content

Resolve mutation in list_qualifies_for_extra_seat#3453

Merged
stacktraceghost merged 10 commits into
kiesraad:mainfrom
Hiddentale:3446_mutation
Jun 25, 2026
Merged

Resolve mutation in list_qualifies_for_extra_seat#3453
stacktraceghost merged 10 commits into
kiesraad:mainfrom
Hiddentale:3446_mutation

Conversation

@Hiddentale

@Hiddentale Hiddentale commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

What & why

Kills a surviving mutation on list_qualifies_for_extra_seat The mutant changes == to != on line 202 of backend/apportionment/src/seat_assignment/residual_seat_assignment.rs making it impossible for a seat to be reassigned to a list that had a seat assigned to it and which then was retracted.
Now if anyone accidentally makes this change in the future, this unit test will flag it by failing.

closes #3446
closes #3355

Reviewer notes

list_qualifies_for_extra_seat(0, Some(1), &[previous_steps], 1u32),
where
number_of_seats_largest_remainders = 0,
number_of_seats_unique_highest_averages = Some(1),
and previous_steps makes sure has_retracted_seat = true,

is the unique combination that makes

(has_retracted_seat && number_of_seats_unique_highest_averages == 1 && number_of_seats_largest_remainders <= 1)

at line 202 of residual_seat_assignment.rs return true.

@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.17%. Comparing base (0d93e20) to head (0eaf3ff).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3453   +/-   ##
=======================================
  Coverage   90.16%   90.17%           
=======================================
  Files         484      484           
  Lines       23914    23927   +13     
  Branches     2487     2487           
=======================================
+ Hits        21563    21576   +13     
  Misses       2216     2216           
  Partials      135      135           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Comment thread backend/apportionment/src/seat_assignment/residual_seat_assignment.rs Outdated
@Hiddentale Hiddentale changed the title WIP: Resolve mutation in list_qualifies_for_extra_seat Resolve mutation in list_qualifies_for_extra_seat Jun 21, 2026
@Hiddentale Hiddentale marked this pull request as ready for review June 21, 2026 07:54
@Hiddentale Hiddentale requested a review from a team as a code owner June 21, 2026 07:54
@praseodym praseodym requested a review from Lionqueen94 June 23, 2026 11:09
@Lionqueen94 Lionqueen94 requested a review from jschuurk-kr June 23, 2026 11:20
Lionqueen94
Lionqueen94 previously approved these changes Jun 23, 2026
@Hiddentale Hiddentale dismissed stale reviews from Lionqueen94 and stacktraceghost via dcb94fb June 24, 2026 10:34
@stacktraceghost stacktraceghost added this pull request to the merge queue Jun 25, 2026
Merged via the queue into kiesraad:main with commit 908bd86 Jun 25, 2026
21 checks passed
@Hiddentale Hiddentale deleted the 3446_mutation branch June 25, 2026 09:46
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.

Mutation survives in list_qualifies_for_extra_seat Mutation testing of apportionment and extending/updating apportionment tests where it makes sense

3 participants