⚓ T357723 MediaWiki\Extension\DiscussionTools\Tests\ApiParseDiscussionToolsTest::testApiParseSections failure
Page MenuHomePhabricator

MediaWiki\Extension\DiscussionTools\Tests\ApiParseDiscussionToolsTest::testApiParseSections failure
Closed, ResolvedPublic

Description

On my patch set https://gerrit.wikimedia.org/r/c/mediawiki/extensions/FlaggedRevs/+/1003822 there is a unrelated failure

Also seen on the gate-and-submit for MobileFrontend - https://gerrit.wikimedia.org/r/c/mediawiki/extensions/MobileFrontend/+/1003869

https://integration.wikimedia.org/ci/job/quibble-vendor-mysql-php74-noselenium-docker/155805/console

There was 1 failure:

1) MediaWiki\Extension\DiscussionTools\Tests\ApiParseDiscussionToolsTest::testApiParseSections
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'<span class="ext-discussiontools-init-sidebar-meta">1 comment</span>'
+''

/workspace/src/extensions/DiscussionTools/tests/phpunit/integration/ApiParseDiscussionToolsTest.php:35
/workspace/src/tests/phpunit/includes/api/ApiTestCase.php:319
phpvfscomposer:///workspace/src/vendor/phpunit/phpunit/phpunit:97

There are core changes related to OutputTransform

and headline changes,

not sure if that could be related, but could be related to comment handling in DiscussionTools extension

Event Timeline

It seems the class mw-headline with the id is now missing in the headline and DiscussionTools CommentParser is looking for that.


Locally I get

1) MediaWiki\Extension\DiscussionTools\Tests\ApiParseDiscussionToolsTest::testApiParseSections
Undefined array key "extensionData"

It changed to the error from the task here, when MobileFrontend is also loaded. Without MobileFrontend in ApiParse the OutputPageParserOutput hook is not run when only prop=sections is requested, requesting subtitle as well runs the hook and test fails with the error from here instead of undefined key.

For both order of extension it passed after the revert.

Thanks for reverting, I'll take a look.

The failure actually indicated a real problem – the comment metadata in the table of contents (the grey text like "3 comments") was missing.

This happened because, after the core patch, DiscussionTools will see HTML without the <span class="mw-headline"> wrappers, and it wasn't handled correctly in the code that generates this.

It seems that we handle it well everywhere else (it goes through the same code paths as Parsoid HTML), but I'm double-checking.

Change 1004223 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/DiscussionTools@master] Support for core section heading formatting in post-cache transform

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

Change 1004223 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Support for core section heading formatting in post-cache transform

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