Ever since we added Wikibase to EntitySchema’s CI (T333661), two PHPUnit tests have been failing (example console):
1) EntitySchema\Tests\Integration\MediaWiki\Actions\RestoreSubmitActionTest::testRestoreSubmit Failed asserting that two strings are identical. --- Expected +++ Actual @@ @@ -'abc' +'def' /workspace/src/extensions/EntitySchema/tests/phpunit/integration/MediaWiki/Actions/RestoreSubmitActionTest.php:71 2) EntitySchema\Tests\Integration\MediaWiki\Actions\RestoreViewActionTest::testRestoreView Failed asserting that '<div class="mw-message-box-error mw-message-box">The revision you tried to restore is identical to the current revision. Nothing to do.</div><p id="mw-returnto">Return to <a href="/index.php/EntitySchema:E1234" title="EntitySchema:E1234">EntitySchema:E1234</a>.</p>\n ' contains "<ins class="diffchange diffchange-inline">abc</ins>". /workspace/src/extensions/EntitySchema/tests/phpunit/integration/MediaWiki/Actions/RestoreViewActionTest.php:78
This is reproducible locally iff FlaggedRevisions is installed; it turns out that FlaggedRevs is a very indirect CI dependency of Wikibase (Wikibase → ArticlePlaceholder → Scribunto → SyntaxHighlight_GeSHi → VisualEditor → FlaggedRevs), and thus it’s now loaded in EntitySchema CI as well. Tracking calls to Title::loadFromRow() reveals the culprit:
/var/www/html/wiki1/includes/title/Title.php:620: class stdClass#3344 (12) { public $page_title => string(5) "E1234" public $page_latest => string(1) "2" } /var/www/html/wiki1/includes/title/Title.php:620: class stdClass#3349 (18) { public $page_title => string(5) "E1234" public $page_latest => string(1) "2" } /var/www/html/wiki1/includes/title/Title.php:620: class stdClass#3349 (18) { public $page_title => string(5) "E1234" public $page_latest => string(1) "2" public $fpc_override => NULL } /var/www/html/wiki1/includes/title/Title.php:620: class stdClass#3299 (11) { public $page_title => string(5) "E1234" public $page_latest => string(1) "2" } /var/www/html/wiki1/includes/title/Title.php:620: class stdClass#3820 (12) { public $page_title => string(5) "E1234" public $page_latest => string(1) "3" } /var/www/html/wiki1/includes/title/Title.php:620: class stdClass#3349 (18) { public $page_title => string(5) "E1234" public $page_latest => string(1) "2" public $fpc_override => NULL } /var/www/html/wiki1/includes/title/Title.php:620: class stdClass#3349 (18) { public $page_title => string(5) "E1234" public $page_latest => string(1) "2" public $fpc_override => NULL } /var/www/html/wiki1/includes/title/Title.php:620: class stdClass#3924 (11) { public $page_title => string(5) "E1234" public $page_latest => string(1) "3" }
Notice that there are two calls with $page_latest => 2 after the first call with $page_latest => 3, i.e., they’re resetting the latest revision ID to an outdated value; this is what causes the tests to fail, because they now load a non-latest revision as the latest revision. (It can be worked around in the tests with e.g. $page->getTitle()->resetArticleID( false ); or TestingAccessWrapper::newFromObject( $page->getTitle() )->mLatestID = false;.) And both of those calls have an $fpc_override column in the row, identifying them as coming from (or at least being influenced by) FlaggedRevs.
Ceterum censeo FlaggedRevs esse delendam.