Page MenuHomePhabricator

alreadyVoted pattern matching is off
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Vote on a wish
  • Edit votes manually and append characters to the username. If the user is Admin, make it Adminsss

What happens?:
Support wish is disabled even tho there are no votes from the current username.

What should have happened instead?:
Support wish should be enabled since there are no usernames matching the current user on the /votes page


Derived Requirement

The vote-checking logic for detecting whether a user has already voted must use exact username matching. Pattern-based or substring-based matching (e.g., treating Adminsss as Admin) must be prevented to avoid false positives.

Test Steps

Test Case 1: Exact Match Required

  1. Log in as a user with username Admin.
  2. Submit a vote on a wish.
  3. ✅❓❌⬜ AC1: Confirm the vote is recorded and the "Support wish" button is disabled.

Test Case 2: Modified Username with Extra Characters

  1. Manually edit the votes list to append characters to the username (e.g., Adminsss).
  2. Refresh the wish voting interface.
  3. ✅❓❌⬜ AC2: Confirm the "Support wish" button is enabled since Adminsss is not the same as Admin.

Test Case 3: Similar but Different Usernames

  1. Create or log in as a different user with a similar name (e.g., Admin1).
  2. Try voting on the same wish.
  3. ✅❓❌⬜ AC3: Confirm the new user can vote without being blocked by the existing vote from Admin.

Test Case 4: Case Sensitivity

  1. Test voting logic with usernames that differ only in case (e.g., admin vs. Admin).
  2. ✅❓❌⬜ AC4: Confirm behavior follows MediaWiki’s standard username handling (case-insensitive first letter, case-sensitive remainder).

Test Case 5: Integrity of Vote Page

  1. Inspect the /votes page to ensure usernames are stored exactly as submitted.
  2. ✅❓❌⬜ AC5: Confirm no substring matching is applied during vote validation.

QA Results - Meta Beta

ACStatusDetails
1T404994#11202748
2Pass per T404994#11204069
3Pass per T404994#11204069
4T404994#11202748
5T404994#11202748

Details

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change #1189528 had a related patch set uploaded (by Dmaza; author: Dmaza):

[mediawiki/extensions/CommunityRequests@master] Fix alreadyVoted regex

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

dmaza renamed this task from alreadyVoted patterm matching is off to alreadyVoted pattern matching is off.Sep 18 2025, 4:09 PM
dmaza moved this task from Backlog to v1 on the MediaWiki-extensions-CommunityRequests board.
dmaza edited projects, added: Community-Tech (Sea Lion Squad); removed: Community-Tech.

Change #1189528 merged by jenkins-bot:

[mediawiki/extensions/CommunityRequests@master] Fix alreadyVoted regex

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

@dmaza Please review AC2 and AC3 and if you have any questions, let me know. Thanks!

Test Result - Beta|Prod

Status: ✅ PASS / ❓Need More Info / ❌ FAIL
Environment: Meta Beta
OS: macOS Tahoe 26.0
Browser: Chrome 140
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Exact Match Required

  1. Log in as a user with username Admin.
  2. Submit a vote on a wish.
  3. AC1: Confirm the vote is recorded and the "Support wish" button is disabled.

Test Case 2: Modified Username with Extra Characters

  1. Manually edit the votes list to append characters to the username (e.g., Adminsss).
  2. Refresh the wish voting interface.
  3. AC2: Confirm the "Support wish" button is enabled since Adminsss is not the same as Admin.

After going back to the wish, the name was not updated

Test Case 3: Similar but Different Usernames

  1. Create or log in as a different user with a similar name (e.g., Admin1).
  2. Try voting on the same wish.
  3. AC3: Confirm the new user can vote without being blocked by the existing vote from Admin.

Number has been updated to 2 but like AC2, the name did not update on the most recent username edit. It does fix the first edit though.

2025-09-22_10-47-23.png (1,090×1,151 px, 158 KB)

Test Case 4: Case Sensitivity

  1. Test voting logic with usernames that differ only in case (e.g., admin vs. Admin).
  2. AC4: Confirm behavior follows MediaWiki’s standard username handling (case-insensitive first letter, case-sensitive remainder).

2025-09-22_10-08-14.mp4.gif (1,280×1,162 px, 2 MB)

Test Case 5: Integrity of Vote Page

  1. Inspect the /votes page to ensure usernames are stored exactly as submitted.
  2. AC5: Confirm no substring matching is applied during vote validation.

2025-09-22_10-53-43.png (1,061×508 px, 92 KB)

GMikesell-WMF changed the task status from Open to In Progress.Sep 22 2025, 6:11 PM
GMikesell-WMF moved this task from QA to In Development on the Community-Tech (Sea Lion Squad) board.

No need to stress on this one. The voting API (T404000) is almost done and it will effectively supersede this task.

GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF updated Other Assignee, removed: GMikesell-WMF.