diff options
author | Máté Szabó <mszabo@wikimedia.org> | 2025-04-01 23:54:39 +0200 |
---|---|---|
committer | Máté Szabó <mszabo@wikimedia.org> | 2025-04-04 15:46:44 +0200 |
commit | 95485727e1d333be0995ff8b48b5f6e5593918b2 (patch) | |
tree | c32803ff762078e4bdd19bd42f7cb17bf09084e6 /tests/phpunit | |
parent | 7c0b1c06e558029664f6a02a8abccc53b7ed20eb (diff) | |
download | mediawikicore-95485727e1d333be0995ff8b48b5f6e5593918b2.tar.gz mediawikicore-95485727e1d333be0995ff8b48b5f6e5593918b2.zip |
storage: Push CategoryMembershipChangeJob in ChangeTrackingEventIngress
Why:
- CategoryMembershipChangeJob is currently enqueued in
DerivedPageDataUpdater.
- This job is responsible for creating RC entries for category
membership changes that resulted from an edit, so it is semantically a
better fit for ChangeTrackingEventIngress instead.
- Idf6625d3e737e4a225648b0fd81cc929b095d315 unintentionally changed the
logic to enqueue this job for both direct content changes and
reconciliation requests, rather than only direct content changes.
Since the job creates RC entries, it should only be enqueued
as a result of direct content changes.
What:
- Move the logic of enqueueing CategoryMembershipChangeJobs into
ChangeTrackingEventIngress.
- Only enqueue CategoryMembershipChangeJobs for direct content changes
and update tests accordingly.
- Resolve the old TODO of making this logic MCR-aware by checking
whether any changed content slot supports categories as a precondition
of enqueueing the job, rather than only checking the main slot.
Bug: T390636
Change-Id: Icfe33ccc6cfa391e65ecae21d8c1d575dc247ee3
Diffstat (limited to 'tests/phpunit')
-rw-r--r-- | tests/phpunit/includes/Storage/DerivedPageDataUpdaterTest.php | 9 | ||||
-rw-r--r-- | tests/phpunit/includes/Storage/PageUpdaterTest.php | 3 |
2 files changed, 8 insertions, 4 deletions
diff --git a/tests/phpunit/includes/Storage/DerivedPageDataUpdaterTest.php b/tests/phpunit/includes/Storage/DerivedPageDataUpdaterTest.php index cf679df61201..6eb49eeeb117 100644 --- a/tests/phpunit/includes/Storage/DerivedPageDataUpdaterTest.php +++ b/tests/phpunit/includes/Storage/DerivedPageDataUpdaterTest.php @@ -1130,12 +1130,15 @@ class DerivedPageDataUpdaterTest extends MediaWikiIntegrationTestCase { * @covers \MediaWiki\Storage\DerivedPageDataUpdater::doSecondaryDataUpdates() * @covers \MediaWiki\Storage\DerivedPageDataUpdater::doParserCacheUpdate() * @covers \MediaWiki\RecentChanges\ChangeTrackingEventIngress::handlePageRevisionUpdatedEvent() + * @covers \MediaWiki\RecentChanges\ChangeTrackingEventIngress::anyChangedSlotSupportsCategories() */ public function testDoUpdates( bool $simulateNullEdit, bool $simulatePageCreation, bool $rcWatchCategoryMembership ) { + $this->overrideConfigValue( MainConfigNames::RCWatchCategoryMembership, $rcWatchCategoryMembership ); + $page = $this->getPage( __METHOD__ ); $content = [ SlotRecord::MAIN => new WikitextContent( 'current [[main]]' ) ]; @@ -1199,7 +1202,6 @@ class DerivedPageDataUpdaterTest extends MediaWikiIntegrationTestCase { $pcache = $this->getServiceContainer()->getParserCache(); $pcache->deleteOptionsKey( $page ); - $updater->setRcWatchCategoryMembership( $rcWatchCategoryMembership ); $updater->setArticleCountMethod( 'link' ); $options = []; // TODO: test *all* the options... @@ -1256,11 +1258,12 @@ class DerivedPageDataUpdaterTest extends MediaWikiIntegrationTestCase { $this->assertSame( 1, $listenerCalled, 'PageRevisionUpdatedEvent listener' ); $this->assertSame( - $rcWatchCategoryMembership ? 1 : 0, + $rcWatchCategoryMembership && !$simulateNullEdit ? 1 : 0, $this->getServiceContainer() ->getJobQueueGroup() ->get( 'categoryMembershipChange' ) - ->getSize() + ->getSize(), + 'CategoryMembershipChangeJob should only be enqueued for non-null edits (T390636)' ); // TODO: MCR: test data updates for additional slots! diff --git a/tests/phpunit/includes/Storage/PageUpdaterTest.php b/tests/phpunit/includes/Storage/PageUpdaterTest.php index 7c8afdbae1da..d0af2f7d9d83 100644 --- a/tests/phpunit/includes/Storage/PageUpdaterTest.php +++ b/tests/phpunit/includes/Storage/PageUpdaterTest.php @@ -1420,7 +1420,8 @@ class PageUpdaterTest extends MediaWikiIntegrationTestCase { $services->getUserNameUtils(), $services->getTalkPageNotificationManager(), $services->getMainConfig(), - $services->getJobQueueGroup() + $services->getJobQueueGroup(), + $services->getContentHandlerFactory() ); $services->getDomainEventSource() |