CommunityConfiguration uses the domain events mechanism to respond to page changes (so that cache can be invalidated). Recently, we received a bug report (T401322) that made me realise we shouldn't use just PageRevisionUpdated, as that does not include other changes of a page, such as page deletion.
To fix that, I decided to switch to PageRecordChanged. According to the docs, that should group together other events related to page changes: PageCreatedEvent, PageDeletedEvent, PageMovedEvent and PageLatestRevisionChangedEvent. In the bug report, @daniel confirmed directly subscribing to PageRecordChanged can be done to capture all related events:
I implemented this in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CommunityConfiguration/+/1176770/6. Unfortunately, CI did not like what I did, and failed with:
12:48:12 There were 2 failures: 12:48:12 12:48:12 1) GrowthExperiments\Tests\Integration\NewcomerMilestoneIngressTest::testMilestoneNotification with data set "notification sent when threshold reached" (4, 5, 1, 1) 12:48:12 Expected 1 notification(s) for milestone threshold 12:48:12 Failed asserting that actual size 0 matches expected size 1. 12:48:12 12:48:12 /workspace/src/extensions/GrowthExperiments/tests/phpunit/integration/NewcomerTasks/MediawikiEventSubscribers/NewcomerMilestoneIngressTest.php:102 12:48:12 12:48:12 2) GrowthExperiments\Tests\Integration\TaskTypeManagerTest::testFiltersTaskWhenLimitReached 12:48:12 Failed asserting that two arrays are identical. 12:48:12 --- Expected 12:48:12 +++ Actual 12:48:12 @@ @@ 12:48:12 Array &0 ( 12:48:12 0 => 'copyedit' 12:48:12 + 1 => 'link-recommendation' 12:48:12 ) 12:48:12 12:48:12 /workspace/src/extensions/GrowthExperiments/tests/phpunit/integration/NewcomerTasks/TaskType/TaskTypeManagerTest.php:66
To see what might cause this error, I tried splitting PageRecordChangedListener into the PageDeletedEvent and PageRevisionUpdated (deprecated, but used in CC beforehand), handling them separately. This passed the CI with no issues. I also tried switching to PageLatestRevisionChanged (as the replacement for PageRevisionUpdated) and subscribing to the remaining two events (PageCreatedEvent and PageMovedEvent), which also passed CI.
Based on those observations, it seems like subscribing to PageRecordChanged and individually to its subevents produce different results. I'm not sure what else I could try to localize the error – so far, my impression is the issue is somewhere within domain events rather than the way I integrate with it.
Filling a task with my observations, hoping I could be helped out.