Page MenuHomePhabricator

Expectation (writes <= 0) by MediaWiki\SpecialPage\SpecialPageFactory::executePath not met (actual: 1)
Closed, ResolvedPublicBUG REPORT

Description

What is the problem?

When creating or editing watchlist labels, I am seeing in the logs:

[rdbms] Expectation (writes <= 0) by MediaWiki\SpecialPage\SpecialPageFactory::executePath not met (actual: 1) in trx #6e673b1c99:
role-primary: INSERT IGNORE INTO `watchlist_label` (wll_user,wll_name) VALUES '?'

#0 /var/www/html/w/includes/libs/Rdbms/TransactionProfiler.php(345): Wikimedia\Rdbms\TransactionProfiler->reportExpectationViolated()
#1 /var/www/html/w/includes/libs/Rdbms/Database/TransactionManager.php(572): Wikimedia\Rdbms\TransactionProfiler->recordQueryCompletion()
#2 /var/www/html/w/includes/libs/Rdbms/Database/Database.php(852): Wikimedia\Rdbms\TransactionManager->recordQueryCompletion()
#3 /var/www/html/w/includes/libs/Rdbms/Database/Database.php(705): Wikimedia\Rdbms\Database->attemptQuery()
#4 /var/www/html/w/includes/libs/Rdbms/Database/Database.php(632): Wikimedia\Rdbms\Database->executeQuery()
#5 /var/www/html/w/includes/libs/Rdbms/Database/Database.php(1506): Wikimedia\Rdbms\Database->query()
#6 /var/www/html/w/includes/libs/Rdbms/Database/DBConnRef.php(127): Wikimedia\Rdbms\Database->insert()
#7 /var/www/html/w/includes/libs/Rdbms/Database/DBConnRef.php(455): Wikimedia\Rdbms\DBConnRef->__call()
#8 /var/www/html/w/includes/libs/Rdbms/QueryBuilder/InsertQueryBuilder.php(340): Wikimedia\Rdbms\DBConnRef->insert()
#9 /var/www/html/w/includes/Watchlist/WatchlistLabelStore.php(45): Wikimedia\Rdbms\InsertQueryBuilder->execute()
#10 /var/www/html/w/includes/Specials/SpecialWatchlistLabels.php(139): MediaWiki\Watchlist\WatchlistLabelStore->save()
#11 /var/www/html/w/includes/HTMLForm/HTMLForm.php(812): MediaWiki\Specials\SpecialWatchlistLabels->onSubmit()
#12 /var/www/html/w/includes/HTMLForm/HTMLForm.php(693): MediaWiki\HTMLForm\HTMLForm->trySubmit()
#13 /var/www/html/w/includes/HTMLForm/HTMLForm.php(709): MediaWiki\HTMLForm\HTMLForm->tryAuthorizedSubmit()
#14 /var/www/html/w/includes/Specials/SpecialWatchlistLabels.php(103): MediaWiki\HTMLForm\HTMLForm->show()
#15 /var/www/html/w/includes/Specials/SpecialWatchlistLabels.php(58): MediaWiki\Specials\SpecialWatchlistLabels->showForm()
#16 /var/www/html/w/includes/SpecialPage/SpecialPage.php(711): MediaWiki\Specials\SpecialWatchlistLabels->execute()
#17 /var/www/html/w/includes/SpecialPage/SpecialPageFactory.php(1743): MediaWiki\SpecialPage\SpecialPage->run()
#18 /var/www/html/w/includes/Actions/ActionEntryPoint.php(499): MediaWiki\SpecialPage\SpecialPageFactory->executePath()
#19 /var/www/html/w/includes/Actions/ActionEntryPoint.php(143): MediaWiki\Actions\ActionEntryPoint->performRequest()
#20 /var/www/html/w/includes/MediaWikiEntryPoint.php(184): MediaWiki\Actions\ActionEntryPoint->execute()
#21 /var/www/html/w/index.php(44): MediaWiki\MediaWikiEntryPoint->run()
#22 {main}
Steps to reproduce problem
  1. On any local test environment, add this to LocalSettings.php: $wgEnableWatchlistLabels = true;
  2. Login
  3. Create a new label by going to Special:WatchlistLabels/edit
  4. Look in your local logs (if you have a local docker setup you should see in the cache directory of your mediawiki install a file called mw-debug-web.log)
Environment

Wiki(s): local docker MediaWiki 1.46.0-alpha (66c0066) 07:36, 25 November 2025.


Derived Requirement

The system must not perform unintended database write operations when a user creates or edits watchlist labels on *Special:WatchlistLabels/edit*. Executing this page must meet the “writes ≤ 0” expectation in MediaWiki\SpecialPage\SpecialPageFactory::executePath and should not trigger any unexpected writes to watchlist_label or any other table.

Test Steps

Test Case 1: Ensure no unexpected DB writes occur when creating a new watchlist label

Preconditions:

  • $wgEnableWatchlistLabels = true is set in LocalSettings (or Patchdemo environment configured similarly).
  1. Log in to the Local Wiki.
  2. Navigate to *Special:WatchlistLabels/edit*.
  3. Create a new watchlist label.
  4. Access the debug logs (e.g., mw-debug-web.log in local ).
  5. ✅❓❌⬜ AC1: Confirm no unexpected database write violations occur and the “writes ≤ 0” expectation is satisfied.

Test Case 2: Ensure no unexpected DB writes occur when editing an existing watchlist label

Preconditions:

  • $wgEnableWatchlistLabels = true enabled.
  • At least one label already exists.
  1. Log in to the wiki.
  2. Navigate to *Special:WatchlistLabels/edit*.
  3. Select an existing label and modify its name.
  4. Save the changes.
  5. Open and inspect the debug logs.
  6. ✅❓❌⬜ AC2: Confirm no unexpected database write violations occur and the “writes ≤ 0” expectation is satisfied.

QA Results - Local

ACStatusDetails
1T411030#11450008
2T411030#11450008

Event Timeline

Change #1213421 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/core@master] POST requests to Special:WatchlistLabels can write to the DB

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

Change #1213421 merged by jenkins-bot:

[mediawiki/core@master] POST requests to Special:WatchlistLabels can write to the DB

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

@Samwilson Confirm edno unexpected database write violations occur and the “writes ≤ 0” expectation is satisfied, as seen in the videos and screenshots below. I will mark this as Resolved. Thanks for all your work!

Test Result - Local

Status: ✅ PASS
Environment: Local: MediaWiki 1.46.0-alpha (5061777) 19:37, 4 December 2025
OS: macOS Tahoe 26.1
Browser: Chrome 142
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Ensure no unexpected DB writes occur when creating a new watchlist label

Preconditions:

  • $wgEnableWatchlistLabels = true is set in LocalSettings (or Patchdemo environment configured similarly).
  1. Log in to the Local Wiki.
  2. Navigate to *Special:WatchlistLabels/edit*.
  3. Create a new watchlist label.
  4. Access the debug logs (e.g., mw-debug-web.log in local ).
  5. AC1: Confirm no unexpected database write violations occur and the “writes ≤ 0” expectation is satisfied.
CreateLog
2025-12-10_17-42-13.png (795×1 px, 359 KB)

Test Case 2: Ensure no unexpected DB writes occur when editing an existing watchlist label

Preconditions:

  • $wgEnableWatchlistLabels = true enabled.
  • At least one label already exists.
  1. Log in to the wiki.
  2. Navigate to *Special:WatchlistLabels/edit*.
  3. Select an existing label and modify its name.
  4. Save the changes.
  5. Open and inspect the debug logs.
  6. AC2: Confirm no unexpected database write violations occur and the “writes ≤ 0” expectation is satisfied.
CreateLog
2025-12-10_17-45-20.png (282×1 px, 71 KB)
GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF updated Other Assignee, removed: GMikesell-WMF.