Page MenuHomePhabricator

Final round is sometimes not shown in STV election results
Closed, InvalidPublicBUG REPORT

Description

What is the problem?

Further to our work on T291821. In some STV elections, we appear to be electing candidates even though they have not reached the quota. This is because we are missing a final round where the quota is recalculated and the remaining candidate(s) exceed it.

Steps to reproduce

After the change is made we should expect to be able to re-tally the above elections and see the final round.

Environment

Wiki(s): https://vote.wikimedia.beta.wmflabs.org SecurePoll 3.0.0 (9ca747c) 07:26, 26 June 2025.

Screenshots

before:

Screen Shot 2025-05-21 at 09.39.51.png (868×710 px, 100 KB)

after: (notice how candidate A is declared elected on 509 votes despite the quota being 669)

Screen Shot 2025-05-21 at 09.40.02.png (541×690 px, 59 KB)

Event Timeline

Amdrel changed the task status from Open to In Progress.Jun 26 2025, 6:08 PM
Amdrel claimed this task.

It looks like this bug was introduced when we added short circuit logic at the beginning of the round that checks if all remaining hopefuls are eligible to be elected or eliminated with the current remaining seat count. This change was introduced to workaround the infinite loop bug if I recall correctly (http://phabricator.wikimedia.org/T291821). If I move that logic to the end of the round (and update the local round object) instead then we get an elected message as well. There is the problem though that the quota doesn't align with the new elected winner, which looks suspect. Is this fine? If not, would it be fine if we also added a note that says, "Candidate 'A' elected to fill remaining seats"? The same could also apply where we eliminate remaining hopefuls once we reach the seat limit.

Screenshot 2025-06-26 at 1.54.22 PM.png (1×1 px, 193 KB)

Change #1164309 had a related patch set uploaded (by Amdrel; author: Amdrel):

[mediawiki/extensions/SecurePoll@master] WIP: Show elected and eliminated candidates in final round

https://gerrit.wikimedia.org/r/1164309

Change #1164309 abandoned by STran:

[mediawiki/extensions/SecurePoll@master] WIP: Show elected and eliminated candidates in final round

Reason:

implementation this modifies was reverted

https://gerrit.wikimedia.org/r/1164309

STran subscribed.

I'm going to close this as I've re-opened the original task to be fixed instead.