Page MenuHomePhabricator

Upgrade zordius/lightncandy from 0.23 to 1.x
Closed, ResolvedPublic

Event Timeline

Reedy raised the priority of this task from to Medium.
Reedy updated the task description. (Show Details)
Reedy subscribed.
Reedy updated the task description. (Show Details)
Reedy renamed this task from Update zordius/lightncandy v0.89 to Update zordius/lightncandy.Apr 4 2017, 8:10 PM
Reedy updated the task description. (Show Details)

1.1.0 seems to break at least core and Flow for starters

Change 346351 had a related patch set uploaded (by Reedy):
[mediawiki/vendor@master] Update zordius/lightncandy v0.23 to v1.1.0

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

Change 346368 had a related patch set uploaded (by Reedy):
[mediawiki/core@master] Update zordius/lightncandy v0.23 to v1.1.0

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

@kaldari Do you remember much about this code?

It seems, something has changed with the partial stuff, and it kinda seems like it wants to be told about the partials, and how to process them...

https://github.com/zordius/lightncandy/issues/84#issuecomment-49014639
https://github.com/zordius/lightncandy/issues/212

https://gerrit.wikimedia.org/r/#/c/346368/

It's kinda more obvious in the actual error message given

you should provide partials or partialresolver in options

20:46:20 1) TemplateParserTest::testProcessTemplate with data set #10 ('has_partial', array('world'), 'Partial hello world!\n in here\n')
20:46:20 Exception: Can not find partial for 'foobar_args', you should provide partials or partialresolver in options
20:46:20 
20:46:20 /home/jenkins/workspace/mediawiki-phpunit-hhvm-jessie/src/vendor/zordius/lightncandy/src/LightnCandy.php:110
20:46:20 /home/jenkins/workspace/mediawiki-phpunit-hhvm-jessie/src/vendor/zordius/lightncandy/src/LightnCandy.php:55
20:46:20 /home/jenkins/workspace/mediawiki-phpunit-hhvm-jessie/src/includes/TemplateParser.php:176
20:46:20 /home/jenkins/workspace/mediawiki-phpunit-hhvm-jessie/src/includes/TemplateParser.php:143
20:46:20 /home/jenkins/workspace/mediawiki-phpunit-hhvm-jessie/src/includes/TemplateParser.php:107
20:46:20 /home/jenkins/workspace/mediawiki-phpunit-hhvm-jessie/src/includes/TemplateParser.php:197
20:46:20 /home/jenkins/workspace/mediawiki-phpunit-hhvm-jessie/src/tests/phpunit/includes/TemplateParserTest.php:31
20:46:20 /home/jenkins/workspace/mediawiki-phpunit-hhvm-jessie/src/tests/phpunit/MediaWikiTestCase.php:400
20:46:20 /home/jenkins/workspace/mediawiki-phpunit-hhvm-jessie/src/maintenance/doMaintenance.php:111
20:46:20

And FWIW, I suspect similar issues will break Flow, so not even attempting to fixup any of Flow until this issue with partials is fixed. Unless I'm missing the obvious (which a second set of eyes may spot), there is gonna be a bit of work to actually support this

It's been a long time since I've looked at it. There is a some documentation at https://www.mediawiki.org/wiki/Manual:HTML_templates, but not much about partials. @Jdlrobson might know more about it.

Any help appreciated. Even more so if we can get someone else invested because they can use bug fixes/newer features too ;)

https://github.com/wikimedia/mediawiki-extensions-Flow/commits/master/handlebars suggests most of the Collaboration Team have made some changes, but no point CC'ing them all...

Change 346351 abandoned by Reedy:
Update zordius/lightncandy v0.23 to v1.1.0

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

Change 346368 abandoned by Reedy:
Update zordius/lightncandy v0.23 to v1.1.0

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

Change 346351 restored by Reedy:
Update zordius/lightncandy v0.23 to v1.1.0

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

Change 346368 restored by Reedy:
Update zordius/lightncandy v0.23 to v1.1.0

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

Ok, so I noticed @Aleksey_WMDE actually did some work on the mw core patch, and made it work. Yay

StructuredDiscussions (Flow) is broken though...

03:12:47 Fatal error: Class undefined: LCRun3 in /home/jenkins/workspace/mediawiki-extensions-hhvm-jessie/src/extensions/Flow/handlebars/compiled/flow_block_loop.handlebars.php on line 26

So I guess we need to update Flows TemplateHandler... Then run extensions/Flow/maintenance/compileLightncandy.php and commit the lot, depending on core and vendor patches?

Handlebars recompiled, and the diffs look sane enough to the untrained eye

Unit tests currently failing with the below

03:41:33 ................................[Mon Dec  4 03:41:32 2017] [hphp] [3428:7f87ba0e1200:0:000003] [] 
03:41:33 Fatal error: Function name must be a string in /home/jenkins/workspace/mediawiki-extensions-hhvm-jessie/src/extensions/Flow/includes/TemplateHelper.php on line 113
03:41:33 use \LightnCandy\SafeString as SafeString;use \LightnCandy\Runtime as LR;return function ($in = null, $options = null) {
03:41:33     $helpers = array(            'block' => 'Flow\TemplateHelper::block',
03:41:33 );
03:41:33     $partials = array();
03:41:33     $cx = array(
03:41:33         'flags' => array(
03:41:33             'jstrue' => false,
03:41:33             'jsobj' => false,
03:41:33             'jslen' => false,
03:41:33             'spvar' => true,
03:41:33             'prop' => false,
03:41:33             'method' => false,
03:41:33             'lambda' => false,
03:41:33             'mustlok' => false,
03:41:33             'mustlam' => false,
03:41:33             'echo' => false,
03:41:33             'partnc' => false,
03:41:33             'knohlp' => false,
03:41:33             'debug' => isset($options['debug']) ? $options['debug'] : 1,
03:41:33         ),
03:41:33         'constants' => array(),
03:41:33         'helpers' => isset($options['helpers']) ? array_merge($helpers, $options['helpers']) : $helpers,
03:41:33         'partials' => isset($options['partials']) ? array_merge($partials, $options['partials']) : $partials,
03:41:33         'scopes' => array(),
03:41:33         'sp_vars' => isset($options['data']) ? array_merge(array('root' => $in), $options['data']) : array('root' => $in),
03:41:33         'blparam' => array(),
03:41:33         'partialid' => 0,
03:41:33         'runtime' => '\LightnCandy\Runtime',
03:41:33     );
03:41:33     
03:41:33     return ''.LR::sec($cx, ((is_array($in) && isset($in['blocks'])) ? $in['blocks'] : null), null, $in, true, function($cx, $in) {return '	'.LR::encq($cx, LR::hbch($cx, 'block', array(array($in),array()), 'encq', $in)).'
03:41:33 ';}).'<div class="flow-ui-load-overlay"></div>
03:41:33 <div style="clear: both"></div>
03:41:33 ';
03:41:33 };Build step 'Execute shell' marked build as failure
03:41:33 Recording test results
03:41:33 Archiving artifacts
03:41:35 [PostBuildScript] - Execution post build scripts.
03:41:35 [PostBuildScript] Build is not success : do not execute script
03:41:35 Finished: FAILURE

Line 113 is the return in the below

		/** @var callable $renderer */
		$renderer = require $filenames['compiled'];
		return $this->renderers[$templateName] = function ( $args, array $scopes = [] ) use ( $templateName, $renderer ) {
			return $renderer( $args, $scopes );
		};
1) Flow\Tests\Collection\PostCollectionTest::testGetCollection
Error: Function name must be a string

/var/www/wiki/mediawiki/extensions/Flow/includes/TemplateHelper.php:113
/var/www/wiki/mediawiki/extensions/Flow/includes/View.php:328
/var/www/wiki/mediawiki/extensions/Flow/includes/View.php:78
/var/www/wiki/mediawiki/extensions/Flow/includes/Content/BoardContent.php:224
/var/www/wiki/mediawiki/extensions/Flow/includes/Content/BoardContent.php:173
/var/www/wiki/mediawiki/core/includes/page/WikiPage.php:2112
/var/www/wiki/mediawiki/core/includes/page/WikiPage.php:1640
/var/www/wiki/mediawiki/extensions/Flow/includes/TalkpageManager.php:134
/var/www/wiki/mediawiki/extensions/Flow/includes/Data/Listener/TopicPageCreationListener.php:43
/var/www/wiki/mediawiki/core/includes/deferred/MWCallableUpdate.php:30
/var/www/wiki/mediawiki/core/includes/deferred/DeferredUpdates.php:259
/var/www/wiki/mediawiki/core/includes/deferred/DeferredUpdates.php:210
/var/www/wiki/mediawiki/core/includes/deferred/DeferredUpdates.php:131
/var/www/wiki/mediawiki/core/includes/deferred/DeferredUpdates.php:291
/var/www/wiki/mediawiki/core/includes/deferred/DeferredUpdates.php:97
/var/www/wiki/mediawiki/core/includes/deferred/DeferredUpdates.php:114
/var/www/wiki/mediawiki/extensions/Flow/tests/phpunit/PostRevisionTestCase.php:252
/var/www/wiki/mediawiki/extensions/Flow/tests/phpunit/Collection/PostCollectionTest.php:28
/var/www/wiki/mediawiki/core/tests/phpunit/MediaWikiTestCase.php:416
/var/www/wiki/mediawiki/core/maintenance/doMaintenance.php:94

Needs to check some other errors if they're happening locally without these 3 patches...

Other test failures seem to be fixable/unrelated, see T182024

#!/usr/bin/env php
Using PHP 7.1.11-0ubuntu0.17.10.1
PHPUnit 4.8.36 by Sebastian Bergmann and contributors.

......Euse \LightnCandy\SafeString as SafeString;use \LightnCandy\Runtime as LR;return function ($in = null, $options = null) {
    $helpers = array(            'block' => 'Flow\TemplateHelper::block',
);
    $partials = array();
    $cx = array(
        'flags' => array(
            'jstrue' => false,
            'jsobj' => false,
            'jslen' => false,
            'spvar' => true,
            'prop' => false,
            'method' => false,
            'lambda' => false,
            'mustlok' => false,
            'mustlam' => false,
            'echo' => false,
            'partnc' => false,
            'knohlp' => false,
            'debug' => isset($options['debug']) ? $options['debug'] : 1,
        ),
        'constants' => array(),
        'helpers' => isset($options['helpers']) ? array_merge($helpers, $options['helpers']) : $helpers,
        'partials' => isset($options['partials']) ? array_merge($partials, $options['partials']) : $partials,
        'scopes' => array(),
        'sp_vars' => isset($options['data']) ? array_merge(array('root' => $in), $options['data']) : array('root' => $in),
        'blparam' => array(),
        'partialid' => 0,
        'runtime' => '\LightnCandy\Runtime',
    );
    
    return ''.LR::sec($cx, ((is_array($in) && isset($in['blocks'])) ? $in['blocks'] : null), null, $in, true, function($cx, $in) {return '	'.LR::encq($cx, LR::hbch($cx, 'block', array(array($in),array()), 'encq', $in)).'
';}).'<div class="flow-ui-load-overlay"></div>
<div style="clear: both"></div>
';
};................................SS..........EE..........  63 / 514 ( 12%)
............................................................... 126 / 514 ( 24%)
....................SSSS..........................SSS.......... 189 / 514 ( 36%)
............S.....SSSSSSSSSSSSSSSSSSSSSSSSSSSS................. 252 / 514 ( 49%)
............................................SSSSSSSSSS......... 315 / 514 ( 61%)
............................................................... 378 / 514 ( 73%)
..................................................SSSS......... 441 / 514 ( 85%)
....................................................E.......... 504 / 514 ( 98%)
..........

Time: 50.82 seconds, Memory: 100.00MB

There were 4 errors:

1) Flow\Tests\Collection\PostCollectionTest::testGetCollection
Error: Function name must be a string

/var/www/wiki/mediawiki/extensions/Flow/includes/TemplateHelper.php:113
/var/www/wiki/mediawiki/extensions/Flow/includes/View.php:328
/var/www/wiki/mediawiki/extensions/Flow/includes/View.php:78
/var/www/wiki/mediawiki/extensions/Flow/includes/Content/BoardContent.php:224
/var/www/wiki/mediawiki/extensions/Flow/includes/Content/BoardContent.php:173
/var/www/wiki/mediawiki/core/includes/page/WikiPage.php:2112
/var/www/wiki/mediawiki/core/includes/page/WikiPage.php:1640
/var/www/wiki/mediawiki/extensions/Flow/includes/TalkpageManager.php:134
/var/www/wiki/mediawiki/extensions/Flow/includes/Data/Listener/TopicPageCreationListener.php:43
/var/www/wiki/mediawiki/core/includes/deferred/MWCallableUpdate.php:30
/var/www/wiki/mediawiki/core/includes/deferred/DeferredUpdates.php:259
/var/www/wiki/mediawiki/core/includes/deferred/DeferredUpdates.php:210
/var/www/wiki/mediawiki/core/includes/deferred/DeferredUpdates.php:131
/var/www/wiki/mediawiki/core/includes/deferred/DeferredUpdates.php:291
/var/www/wiki/mediawiki/core/includes/deferred/DeferredUpdates.php:97
/var/www/wiki/mediawiki/core/includes/deferred/DeferredUpdates.php:114
/var/www/wiki/mediawiki/extensions/Flow/tests/phpunit/PostRevisionTestCase.php:252
/var/www/wiki/mediawiki/extensions/Flow/tests/phpunit/Collection/PostCollectionTest.php:28
/var/www/wiki/mediawiki/core/tests/phpunit/MediaWikiTestCase.php:416
/var/www/wiki/mediawiki/core/maintenance/doMaintenance.php:94

2) Flow\Tests\Data\IndexTest::testShallow
Invalid argument supplied for foreach()

/var/www/wiki/mediawiki/extensions/Flow/includes/Data/Index/FeatureIndex.php:469
/var/www/wiki/mediawiki/extensions/Flow/includes/Data/Index/FeatureIndex.php:280
/var/www/wiki/mediawiki/extensions/Flow/includes/Data/Index/FeatureIndex.php:247
/var/www/wiki/mediawiki/extensions/Flow/tests/phpunit/Data/IndexTest.php:58
/var/www/wiki/mediawiki/core/tests/phpunit/MediaWikiTestCase.php:416
/var/www/wiki/mediawiki/core/maintenance/doMaintenance.php:94

3) Flow\Tests\Data\IndexTest::testCompositeShallow
Invalid argument supplied for foreach()

/var/www/wiki/mediawiki/extensions/Flow/includes/Data/Index/FeatureIndex.php:469
/var/www/wiki/mediawiki/extensions/Flow/includes/Data/Index/FeatureIndex.php:280
/var/www/wiki/mediawiki/extensions/Flow/includes/Data/Index/FeatureIndex.php:247
/var/www/wiki/mediawiki/extensions/Flow/tests/phpunit/Data/IndexTest.php:112
/var/www/wiki/mediawiki/core/tests/phpunit/MediaWikiTestCase.php:416
/var/www/wiki/mediawiki/core/maintenance/doMaintenance.php:94

4) Flow\Tests\Api\ApiFlowModeratePostTest::testModeratePostInLockedTopic
ApiUsageException: Insufficient permissions to execute this action.

/var/www/wiki/mediawiki/core/includes/api/ApiBase.php:1971
/var/www/wiki/mediawiki/extensions/Flow/includes/Api/ApiFlowBase.php:123
/var/www/wiki/mediawiki/extensions/Flow/includes/Api/ApiFlowBasePost.php:27
/var/www/wiki/mediawiki/extensions/Flow/includes/Api/ApiFlow.php:99
/var/www/wiki/mediawiki/core/includes/api/ApiMain.php:1582
/var/www/wiki/mediawiki/core/includes/api/ApiMain.php:513
/var/www/wiki/mediawiki/core/tests/phpunit/includes/api/ApiTestCase.php:99
/var/www/wiki/mediawiki/extensions/Flow/tests/phpunit/api/ApiTestCase.php:65
/var/www/wiki/mediawiki/extensions/Flow/tests/phpunit/api/ApiFlowModeratePostTest.php:80
/var/www/wiki/mediawiki/core/tests/phpunit/MediaWikiTestCase.php:416
/var/www/wiki/mediawiki/core/maintenance/doMaintenance.php:94

FAILURES!
Tests: 514, Assertions: 1294, Errors: 4, Skipped: 52.
PHP Fatal error:  Uncaught Wikimedia\Rdbms\DBTransactionError: Wikimedia\Rdbms\LBFactory::shutdown: transaction round 'MWCallableUpdate::doUpdate' still running. in /var/www/wiki/mediawiki/core/includes/libs/rdbms/lbfactory/LBFactory.php:213
Stack trace:
#0 /var/www/wiki/mediawiki/core/includes/libs/rdbms/lbfactory/LBFactory.php(144): Wikimedia\Rdbms\LBFactory->commitMasterChanges('Wikimedia\\Rdbms...')
#1 /var/www/wiki/mediawiki/core/includes/libs/rdbms/lbfactory/LBFactory.php(130): Wikimedia\Rdbms\LBFactory->shutdown(0)
#2 /var/www/wiki/mediawiki/core/includes/libs/rdbms/lbfactory/LBFactory.php(582): Wikimedia\Rdbms\LBFactory->destroy()
#3 [internal function]: Wikimedia\Rdbms\LBFactory->__destruct()
#4 {main}
  thrown in /var/www/wiki/mediawiki/core/includes/libs/rdbms/lbfactory/LBFactory.php on line 213
PHP Stack trace:
PHP   1. {main}() /var/www/wiki/mediawiki/core/tests/phpunit/phpunit.php:0
PHP   2. require() /var/www/wiki/mediawiki/core/tests/phpunit/phpunit.php:172
PHP   3. PHPUnitMaintClass->execute() /var/www/wiki/mediawiki/core/maintenance/doMaintenance.php:94
PHP   4. PHPUnit_TextUI_Command::main() /var/www/wiki/mediawiki/core/tests/phpunit/phpunit.php:133
PHP   5. PHPUnit_TextUI_Command->run() phar:///var/www/wiki/mediawiki/phpunit-old.phar/phpunit/TextUI/Command.php:100

Fatal error: Uncaught Wikimedia\Rdbms\DBTransactionError: Wikimedia\Rdbms\LBFactory::shutdown: transaction round 'MWCallableUpdate::doUpdate' still running. in /var/www/wiki/mediawiki/core/includes/libs/rdbms/lbfactory/LBFactory.php on line 213

Call Stack:
    0.0011     374456   1. {main}() /var/www/wiki/mediawiki/core/tests/phpunit/phpunit.php:0
    0.0072     645880   2. require('/var/www/wiki/mediawiki/core/maintenance/doMaintenance.php') /var/www/wiki/mediawiki/core/tests/phpunit/phpunit.php:172
    0.9099   26168904   3. PHPUnitMaintClass->execute() /var/www/wiki/mediawiki/core/maintenance/doMaintenance.php:94
    0.9236   26434192   4. PHPUnit_TextUI_Command::main() /var/www/wiki/mediawiki/core/tests/phpunit/phpunit.php:133
    0.9236   26434304   5. PHPUnit_TextUI_Command->run() phar:///var/www/wiki/mediawiki/phpunit-old.phar/phpunit/TextUI/Command.php:100

Wikimedia\Rdbms\DBTransactionError: Wikimedia\Rdbms\LBFactory::shutdown: transaction round 'MWCallableUpdate::doUpdate' still running. in /var/www/wiki/mediawiki/core/includes/libs/rdbms/lbfactory/LBFactory.php on line 213

Call Stack:
    0.0011     374456   1. {main}() /var/www/wiki/mediawiki/core/tests/phpunit/phpunit.php:0
    0.0072     645880   2. require('/var/www/wiki/mediawiki/core/maintenance/doMaintenance.php') /var/www/wiki/mediawiki/core/tests/phpunit/phpunit.php:172
    0.9099   26168904   3. PHPUnitMaintClass->execute() /var/www/wiki/mediawiki/core/maintenance/doMaintenance.php:94
    0.9236   26434192   4. PHPUnit_TextUI_Command::main() /var/www/wiki/mediawiki/core/tests/phpunit/phpunit.php:133
    0.9236   26434304   5. PHPUnit_TextUI_Command->run() phar:///var/www/wiki/mediawiki/phpunit-old.phar/phpunit/TextUI/Command.php:100
   50.8320  102876824   6. Wikimedia\Rdbms\LBFactorySimple->__destruct() /var/www/wiki/mediawiki/core/includes/libs/rdbms/lbfactory/LBFactory.php:0
   50.8320  102876824   7. Wikimedia\Rdbms\LBFactorySimple->destroy() /var/www/wiki/mediawiki/core/includes/libs/rdbms/lbfactory/LBFactory.php:582
   50.8320  102876824   8. Wikimedia\Rdbms\LBFactorySimple->shutdown() /var/www/wiki/mediawiki/core/includes/libs/rdbms/lbfactory/LBFactory.php:130
   50.8320  102876824   9. Wikimedia\Rdbms\LBFactorySimple->commitMasterChanges() /var/www/wiki/mediawiki/core/includes/libs/rdbms/lbfactory/LBFactory.php:144

So on the new version var_dump( $filenames ); die(); gives

/var/www/wiki/mediawiki/extensions/Flow/includes/TemplateHelper.php:112:
array(2) {
  'template' =>
  string(77) "/var/www/wiki/mediawiki/extensions/Flow/handlebars/flow_block_loop.handlebars"
  'compiled' =>
  string(90) "/var/www/wiki/mediawiki/extensions/Flow/handlebars/compiled/flow_block_loop.handlebars.php"
}

Ah. It's not being wrapped in a closure and stuff...

So if we shove "<?php\n" on the front of the compile output...

20:33:37 ................................[Mon Dec  4 20:33:37 2017] [hphp] [3293:7f31422e5200:0:000003] [] Runtime: call custom helper 'block' error: Expected one arguments but received 13
20:33:37 .[Mon Dec  4 20:33:37 2017] [hphp] [3293:7f31422e5200:0:000004] [] Runtime: call custom helper 'block' error: Expected one arguments but received 13
20:33:37 .[Mon Dec  4 20:33:37 2017] [hphp] [3293:7f31422e5200:0:000005] [] Runtime: call custom helper 'block' error: Expected one arguments but received 13
20:33:38 .[Mon Dec  4 20:33:37 2017] [hphp] [3293:7f31422e5200:0:000006] [] Runtime: call custom helper 'block' error: Expected one arguments but received 13
20:33:38 .[Mon Dec  4 20:33:37 2017] [hphp] [3293:7f31422e5200:0:000007] [] Runtime: call custom helper 'block' error: Expected one arguments but received 13
20:33:38 .[Mon Dec  4 20:33:37 2017] [hphp] [3293:7f31422e5200:0:000008] [] Runtime: call custom helper 'block' error: Expected one arguments but received 13
20:33:38 .[Mon Dec  4 20:33:38 2017] [hphp] [3293:7f31422e5200:0:000009] [] Runtime: call custom helper 'block' error: Expected one arguments but received 13
20:33:38 .[Mon Dec  4 20:33:38 2017] [hphp] [3293:7f31422e5200:0:000010] [] Runtime: call custom helper 'block' error: Expected one arguments but received 13
20:33:38 .[Mon Dec  4 20:33:38 2017] [hphp] [3293:7f31422e5200:0:000011] [] Runtime: call custom helper 'block' error: Expected one arguments but received 13
20:33:39 .[Mon Dec  4 20:33:38 2017] [hphp] [3293:7f31422e5200:0:000012] [] Runtime: call custom helper 'block' error: Expected one arguments but received 13
20:33:39 .[Mon Dec  4 20:33:38 2017] [hphp] [3293:7f31422e5200:0:000013] [] Runtime: call custom helper 'block' error: Expected one arguments but received 13
20:33:39 .[Mon Dec  4 20:33:39 2017] [hphp] [3293:7f31422e5200:0:000014] [] Runtime: call custom helper 'block' error: Expected one arguments but received 13
20:33:39 .[Mon Dec  4 20:33:39 2017] [hphp] [3293:7f31422e5200:0:000015] [] Runtime: call custom helper 'block' error: Expected one arguments but received 13
20:33:40 .[Mon Dec  4 20:33:39 2017] [hphp] [3293:7f31422e5200:0:000016] [] Runtime: call custom helper 'block' error: Expected one arguments but received 13
20:33:40 .[Mon Dec  4 20:33:39 2017] [hphp] [3293:7f31422e5200:0:000017] [] Runtime: call custom helper 'block' error: Expected one arguments but received 13
20:33:40 .[Mon Dec  4 20:33:40 2017] [hphp] [3293:7f31422e5200:0:000018] [] Runtime: call custom helper 'block' error: Expected one arguments but received 13
20:33:40 ............  3422 / 14906 ( 22%)
20:33:41 ......SS...................................................  3481 / 14906 ( 23%)
20:33:42 ..................................................[Mon Dec  4 20:33:41 2017] [hphp] [3293:7f31422e5200:0:000019] [] Runtime: call custom helper 'block' error: Expected one arguments but received 13
20:33:42 .[Mon Dec  4 20:33:42 2017] [hphp] [3293:7f31422e5200:0:000020] [] Runtime: call custom helper 'block' error: Expected one arguments but received 13
20:33:42 .[Mon Dec  4 20:33:42 2017] [hphp] [3293:7f31422e5200:0:000021] [] Runtime: call custom helper 'block' error: Expected one arguments but received 13
20:33:42 ..SSSS.  3540 / 14906 ( 23%)
20:33:44 .........................SSS......................S.....SSS  3599 / 14906 ( 24%)
20:33:45 SSSSSSSSSSSSSSSSSSSSSSSSS..................................  3658 / 14906 ( 24%)
20:33:46 ........[Mon Dec  4 20:33:45 2017] [hphp] [3293:7f31422e5200:0:000022] [] Runtime: call custom helper 'block' error: Expected one arguments but received 13
20:33:46 .[Mon Dec  4 20:33:46 2017] [hphp] [3293:7f31422e5200:0:000023] [] Runtime: call custom helper 'block' error: Expected one arguments but received 13
20:33:47 ..................SSSSSSSSSS......................  3717 / 14906 ( 24%)
20:33:48 ...........................................................  3776 / 14906 ( 25%)
20:33:51 ...........................................................  3835 / 14906 ( 25%)
20:33:51 [Mon Dec  4 20:33:50 2017] [hphp] [3293:7f31422e5200:0:000024] [] 
20:33:51 Fatal error: syntax error, unexpected '<', expecting $end in /home/jenkins/tmpfs/jenkins-0/lci_36DWzL on line 1

Which seems to come from Runtime::exch()

public static function exch($cx, $ch, $vars, &$options) {
    $args = $vars[0];
    $args[] = $options;
    $e = null;
    $r = true;

    try {
        $r = call_user_func_array($cx['helpers'][$ch], $args);
    } catch (\Exception $E) {
        $e = "Runtime: call custom helper '$ch' error: " . $E->getMessage();
    }

    if($e !== null) {
        static::err($cx, $e);
    }

    return $r;
}

Change 346351 abandoned by Reedy:
Update zordius/lightncandy v0.23 to v1.1.0

Reason:
Needs someone who actually has familiarity with the code to see this through

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

Change 346368 abandoned by Reedy:
Update zordius/lightncandy v0.23 to v1.1.0

Reason:
Needs someone who actually has familiarity with the code to see this through

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

Do the breaking changes impact Flow only? This seems pretty serious and I'm surprised this has been sitting here since 2015. Is there anything I can do to help?

Also FWIW Flow is using handlebars and Mustache is the standard supported template library. With that in mind I wonder if there is a solution where the composer dependency is local to Flow so at least core can be running the latest version.

Do the breaking changes impact Flow only? This seems pretty serious and I'm surprised this has been sitting here since 2015. Is there anything I can do to help?

I honestly don't know offhand, it's nearly 2 years since I poked at it. I don't think Minerva was probably part of the shared build in December 2017, so maybe not necessarily things being shown

There's other potential benefits like {T182723} down the line too

Also FWIW Flow is using handlebars and Mustache is the standard supported template library. With that in mind I wonder if there is a solution where the composer dependency is local to Flow so at least core can be running the latest version.

I'm not sure MW would support having two versions of a library around, however, as the older version is not namespaced, and the newer is... It might work in some way. Can't obviously have 2 different versions under the main vendor. But we don't have (apart from DonationInterface, but that's very much a snowflake) vendor folders under extensions in any other extension (Wikibase stopped a long time ago)


Certainly quite a lot of usages across MW Core

Class
    TemplateParser   
Found usages  (61 usages found)
    New instance creation  (39 usages found)
        mediawiki  (39 usages found)
            core  (1 usage found)
                img_auth.php  (1 usage found)
                    wfForbidden  (1 usage found)
                        218 $templateParser = new TemplateParser();
            core/includes  (1 usage found)
                NoLocalSettings.php  (1 usage found)
                    47 $templateParser = new TemplateParser();
            core/includes/changes  (2 usages found)
                ChannelFeed.php  (1 usage found)
                    ChannelFeed  (1 usage found)
                        __construct  (1 usage found)
                            44 $this->templateParser = new TemplateParser();
                EnhancedChangesList.php  (1 usage found)
                    EnhancedChangesList  (1 usage found)
                        __construct  (1 usage found)
                            69 $this->templateParser = new TemplateParser();
            core/includes/specials/pagers  (1 usage found)
                ContribsPager.php  (1 usage found)
                    ContribsPager  (1 usage found)
                        __construct  (1 usage found)
                            147 $this->templateParser = new TemplateParser();
            core/tests/phpunit/includes  (2 usages found)
                TemplateParserTest.php  (2 usages found)
                    TemplateParserTest  (2 usages found)
                        testEnableRecursivePartials  (1 usage found)
                            123 $tp = new TemplateParser( $this->templateDir );
                        testProcessTemplate  (1 usage found)
                            28 $tp = new TemplateParser( $this->templateDir );
            extensions/BlueSpiceEchoConnector/src/Formatter  (2 usages found)
                EchoHtmlDigestEmailFormatter.php  (1 usage found)
                    EchoHtmlDigestEmailFormatter  (1 usage found)
                        __construct  (1 usage found)
                            21 $this->templateParser = new \TemplateParser( $path );
                EchoHTMLEmailFormatter.php  (1 usage found)
                    EchoHTMLEmailFormatter  (1 usage found)
                        __construct  (1 usage found)
                            45 $this->templateParser = new \TemplateParser( $path );
            extensions/BlueSpiceExtendedSearch/src/Tag  (1 usage found)
                TagSearchHandler.php  (1 usage found)
                    TagSearchHandler  (1 usage found)
                        handle  (1 usage found)
                            46 $templateParser = new \TemplateParser( $this->config->get( 'TagSearchSearchFieldTemplatePath' ) );
            extensions/BlueSpiceFoundation/src  (1 usage found)
                LoadPlaceholderRegistry.php  (1 usage found)
                    LoadPlaceholderRegistry  (1 usage found)
                        getParsedTemplate  (1 usage found)
                            49 $templateParser = new TemplateParser( $path );
            extensions/BlueSpicePrivacy/src/Module  (1 usage found)
                Transparency.php  (1 usage found)
                    Transparency  (1 usage found)
                        getHTML  (1 usage found)
                            181 $templateParser = new \TemplateParser( dirname( dirname( __DIR__ ) ) . '/resources/templates' );
            extensions/Collection/includes  (2 usages found)
                CollectionHooks.php  (1 usage found)
                    CollectionHooks  (1 usage found)
                        renderBookCreatorBox  (1 usage found)
                            234 $templateParser = new TemplateParser( dirname( __DIR__ ) . '/templates' );
                MessageBoxHelper.php  (1 usage found)
                    MessageBoxHelper  (1 usage found)
                        renderWarningBoxes  (1 usage found)
                            60 $templateParser = new TemplateParser( __DIR__ . DIRECTORY_SEPARATOR . '..'
            extensions/Collection/includes/Specials  (1 usage found)
                SpecialRenderBook.php  (1 usage found)
                    SpecialRenderBook  (1 usage found)
                        execute  (1 usage found)
                            50 $templateParser = new TemplateParser( __DIR__ . '/templates' );
            extensions/Collection/templates  (1 usage found)
                CollectionPageTemplate.php  (1 usage found)
                    CollectionPageTemplate  (1 usage found)
                        getDownloadForm  (1 usage found)
                            57 $templateParser = new TemplateParser( __DIR__ );
            extensions/Collection/tests/phpunit/includes  (4 usages found)
                BookRendererTest.php  (4 usages found)
                    BookRendererTest  (4 usages found)
                        testfixTemplateData  (1 usage found)
                            30 $templateParser = new TemplateParser( __DIR__ . self::TEMPLATE_DIR );
                        testGetBookTemplateDataImagesGeneration  (1 usage found)
                            71 $templateParser = new TemplateParser( __DIR__ . self::TEMPLATE_DIR );
                        testGetBookTemplateDataOutlineGeneration  (1 usage found)
                            22 $templateParser = new TemplateParser( __DIR__ . self::TEMPLATE_DIR );
                        testRenderBook  (1 usage found)
                            93 $templateParser = new TemplateParser( __DIR__ . self::TEMPLATE_DIR );
            extensions/CongressLookup/includes  (1 usage found)
                SpecialSenateLookup.php  (1 usage found)
                    SpecialSenateLookup  (1 usage found)
                        execute  (1 usage found)
                            62 $templateParser = new TemplateParser( __DIR__ . '/templates' );
            extensions/Jade/includes  (1 usage found)
                JudgmentPageWikitextRenderer.php  (1 usage found)
                    JudgmentPageWikitextRenderer  (1 usage found)
                        __construct  (1 usage found)
                            46 $this->templateRenderer = new TemplateParser( $templatePath );
            extensions/MobileFrontend/includes  (2 usages found)
                ExtMobileFrontend.php  (1 usage found)
                    ExtMobileFrontend  (1 usage found)
                        getUserPageContent  (1 usage found)
                            159 $templateParser = new TemplateParser( __DIR__ . '/templates' );
                MobileUI.php  (1 usage found)
                    MobileUI  (1 usage found)
                        contentElement  (1 usage found)
                            68 $templateParser = new TemplateParser( __DIR__ . '/templates' );
            extensions/MobileFrontend/includes/specials  (1 usage found)
                SpecialMobileDiff.php  (1 usage found)
                    SpecialMobileDiff  (1 usage found)
                        getIntroHTML  (1 usage found)
                            260 $templateParser = new TemplateParser( __DIR__ );
            extensions/ORES/includes/Specials  (1 usage found)
                SpecialORESModels.php  (1 usage found)
                    SpecialORESModels  (1 usage found)
                        execute  (1 usage found)
                            49 $templateParser = new TemplateParser( dirname( __DIR__ ) . '/templates' );
            extensions/PageTriage/includes  (1 usage found)
                SpecialNewPagesFeed.php  (1 usage found)
                    SpecialNewPagesFeed  (1 usage found)
                        getListViewHtml  (1 usage found)
                            109 $templateParser = new TemplateParser( __DIR__ . '/templates' );
            extensions/Quiz/includes  (3 usages found)
                Question.php  (1 usage found)
                    Question  (1 usage found)
                        parseTextField  (1 usage found)
                            529 $templateParser = new TemplateParser( __DIR__ . '/../templates' );
                Quiz.php  (2 usages found)
                    Quiz  (2 usages found)
                        parseQuestion  (1 usage found)
                            366 $templateParser = new TemplateParser( __DIR__ . '/../templates' );
                        parseQuiz  (1 usage found)
                            208 $templateParser = new TemplateParser( __DIR__ . '/../templates' );
            extensions/Quiz/tests/phpunit  (1 usage found)
                QuizTest.php  (1 usage found)
                    QuizTest  (1 usage found)
                        testGetSettingsTable  (1 usage found)
                            172 $templateParser = new TemplateParser( __DIR__ . '/../../templates' );
            extensions/WikidataPageBanner/includes  (1 usage found)
                WikidataPageBannerFunctions.php  (1 usage found)
                    WikidataPageBannerFunctions  (1 usage found)
                        getBannerHtml  (1 usage found)
                            182 $templateParser = new TemplateParser( __DIR__ . '/../templates' );
            skins/MinervaNeue/includes/menu/User  (1 usage found)
                UserMenuDirector.php  (1 usage found)
                    UserMenuDirector  (1 usage found)
                        renderMenuData  (1 usage found)
                            57 $templateParser = new TemplateParser( __DIR__ . '/../../../components' );
            skins/MinervaNeue/includes/skins  (5 usages found)
                MinervaTemplate.php  (4 usages found)
                    MinervaTemplate  (4 usages found)
                        getHistoryLinkHtml  (1 usage found)
                            140 $templateParser = new TemplateParser( __DIR__ );
                        getMainMenuHtml  (1 usage found)
                            220 $templateParser = new TemplateParser( __DIR__ . '/../../resources/skins.minerva.scripts/menu/' );
                        getPageActionsHtml  (1 usage found)
                            106 $templateParser = new TemplateParser( __DIR__ . '/../../components' );
                        render  (1 usage found)
                            232 $templateParser = new TemplateParser( __DIR__ );
                SkinMinerva.php  (1 usage found)
                    SkinMinerva  (1 usage found)
                        prepareHeaderAndFooter  (1 usage found)
                            608 $templateParser = new TemplateParser( __DIR__ );
            skins/Vector/includes  (1 usage found)
                VectorTemplate.php  (1 usage found)
                    VectorTemplate  (1 usage found)
                        execute  (1 usage found)
                            166 $templates = new TemplateParser( __DIR__ . '/templates' );
    Usage in comments  (9 usages found)
        mediawiki  (9 usages found)
            core/includes/changes  (2 usages found)
                ChannelFeed.php  (1 usage found)
                    ChannelFeed  (1 usage found)
                        31 /** @var TemplateParser */
                EnhancedChangesList.php  (1 usage found)
                    EnhancedChangesList  (1 usage found)
                        39 * @var TemplateParser
            core/includes/specials/pagers  (1 usage found)
                ContribsPager.php  (1 usage found)
                    ContribsPager  (1 usage found)
                        97 * @var TemplateParser
            core/tests/phpunit/includes  (1 usage found)
                TemplateParserTest.php  (1 usage found)
                    5 * @covers TemplateParser
            extensions/BlueSpiceEchoConnector/src/Formatter  (1 usage found)
                EchoHTMLEmailFormatter.php  (1 usage found)
                    EchoHTMLEmailFormatter  (1 usage found)
                        27 * @var \TemplateParser
            extensions/Collection/includes  (3 usages found)
                BookRenderer.php  (2 usages found)
                    BookRenderer  (2 usages found)
                        17 /** @var TemplateParser */
                        21 * @param TemplateParser $templateParser
                BookRenderingMediator.php  (1 usage found)
                    BookRenderingMediator  (1 usage found)
                        36 /** @var TemplateParser */
            extensions/Quiz/includes  (1 usage found)
                Quiz.php  (1 usage found)
                    Quiz  (1 usage found)
                        154 * @param TemplateParser $templateParser
    Usage in extends clause  (1 usage found)
        mediawiki  (1 usage found)
            extensions/BlueSpiceFoundation/src  (1 usage found)
                TemplateParser.php  (1 usage found)
                    TemplateParser  (1 usage found)
                        13 class TemplateParser extends \TemplateParser implements ITemplateParser, MessageLocalizer {
    Usage in import statement  (10 usages found)
        mediawiki  (10 usages found)
            extensions/BlueSpiceFoundation/src  (1 usage found)
                LoadPlaceholderRegistry.php  (1 usage found)
                    5 use TemplateParser;
            extensions/Collection/includes  (3 usages found)
                BookRenderer.php  (1 usage found)
                    8 use TemplateParser;
                BookRenderingMediator.php  (1 usage found)
                    19 use TemplateParser;
                MessageBoxHelper.php  (1 usage found)
                    25 use TemplateParser;
            extensions/Collection/includes/Specials  (1 usage found)
                SpecialRenderBook.php  (1 usage found)
                    13 use TemplateParser;
            extensions/Collection/tests/phpunit/includes  (1 usage found)
                BookRendererTest.php  (1 usage found)
                    7 use TemplateParser;
            extensions/Jade/includes  (1 usage found)
                JudgmentPageWikitextRenderer.php  (1 usage found)
                    26 use TemplateParser;
            extensions/ORES/includes/Specials  (1 usage found)
                SpecialORESModels.php  (1 usage found)
                    7 use TemplateParser;
            extensions/PageTriage/includes  (1 usage found)
                SpecialNewPagesFeed.php  (1 usage found)
                    7 use TemplateParser;
            skins/MinervaNeue/includes/menu/User  (1 usage found)
                UserMenuDirector.php  (1 usage found)
                    23 use TemplateParser;
    Usage in type hinting  (2 usages found)
        mediawiki  (2 usages found)
            extensions/Collection/includes  (2 usages found)
                BookRenderer.php  (1 usage found)
                    BookRenderer  (1 usage found)
                        __construct  (1 usage found)
                            23 public function __construct( TemplateParser $templateParser ) {
                BookRenderingMediator.php  (1 usage found)
                    BookRenderingMediator  (1 usage found)
                        __construct  (1 usage found)
                            42 TemplateParser $templateParser

An amusing one to me was finding this in BlueSpice Foundation to just add helpers...

	/**
	 * Compile the Mustache code into PHP code using LightnCandy
	 * @param string $code Mustache code
	 * @return string PHP code (with '<?php')
	 * @throws RuntimeException
	 */
	protected function compile( $code ) {
		if ( !class_exists( 'LightnCandy' ) ) {
			throw new RuntimeException( 'LightnCandy class not defined' );
		}
		$helpers = $this->getCompileHelpers();
		return LightnCandy::compile( $code, [
			'flags' => $this->compileFlags,
			'basedir' => $this->templateDir,
			'fileext' => '.mustache',
			'helpers' => $helpers,
		] );
	}

	/**
	 *
	 * @return array
	 */
	protected function getCompileHelpers() {
		$helpers = [];
		if ( RequestContext::getMain() instanceof ResourceLoaderContext ) {
			return $helpers;
		}
		$helpers['_'] = function ( $msg ) {
			$msgKey = array_shift( $msg );
			return $this->msg( $msgKey, ...$msg )->plain();
		};
		$helpers['__'] = function ( $msg ) {
			$msgKey = array_shift( $msg );
			return $this->msg( $msgKey, ...$msg )->parse();
		};
		return $helpers;
	}

I guess first step would be to restore the upgrade and take a look at the test failures. To be honest I'm surprised to see direct usage of LightNCandy in this way. I thought TemplateParser was the only public class we support.

I know a little about Flow so hopefully I can do some of the upgrading there if needed but I'd like to understand if there's any Minerva problems.

Change 541680 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/vendor@master] Update zordius/lightncandy v0.23 to v1.2.4

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

Change 346368 restored by Reedy:
Update zordius/lightncandy v0.23 to v1.1.0

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

I guess first step would be to restore the upgrade and take a look at the test failures. To be honest I'm surprised to see direct usage of LightNCandy in this way. I thought TemplateParser was the only public class we support.

I know a little about Flow so hopefully I can do some of the upgrading there if needed but I'd like to understand if there's any Minerva problems.

New vendor and rebased core patches uploaded above...

Vendor failing due to what is basically a cyclic dependancy on it and core

A patch for Flow needs making... At a minimum, to use the namespaced classes

Targets
    Occurrences of 'LightnCandy' in directory /Users/reedy/PhpstormProjects/mediawiki/extensions/Flow
Found Occurrences  (11 usages found)
    Unclassified occurrence  (11 usages found)
        mediawiki  (11 usages found)
            extensions/Flow/includes  (7 usages found)
                TemplateHelper.php  (7 usages found)
                    11 use LightnCandy;
                    125 return LightnCandy::compile(
                    128 'flags' => LightnCandy::FLAG_ERROR_EXCEPTION
                    129 | LightnCandy::FLAG_EXTHELPER
                    130 | LightnCandy::FLAG_SPVARS
                    131 | LightnCandy::FLAG_HANDLEBARS
                    132 | LightnCandy::FLAG_RUNTIMEPARTIAL,
            extensions/Flow/tests/phpunit/integration/Handlebars  (2 usages found)
                FlowPostMetaActionsTest.php  (2 usages found)
                    6 use LightnCandy;
                    117 $renderer = LightnCandy::prepare( $phpCode );
            extensions/Flow/tests/phpunit/unit  (2 usages found)
                TemplateHelperTest.php  (2 usages found)
                    5 use LightnCandy;
                    45 $renderer = LightnCandy::prepare( $code );

Change 541681 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/extensions/Flow@master] Update zordius/lightncandy v0.23 to v1.2.4

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

This library is using extreme measures with regards to security and performance. It only barely got through our 2015 audit, with a lot of work on our end to integrate and contain it. I think if this were proposed as a new library today, I don't think we'd be as lenient.

In particular, I would really like if we can convince upstream to not be limited to storing executable code. But instead cache the template compilation output as a tokenised array (to iterate/map at runtime). Should be almost as fast (in the same ballpark), but bring it down several orders of magnitude in terms of operational concern and complexity. This would also allow removing most of our wrapping code.

It's probably not unwise to at least have Perf and Security re-audit it before landing.

Current failure on core from flow...

02:00:48 1) Flow\Tests\TemplateHelperTest::testIfCond
02:00:48 Exception: Custom helper not found: ifCond in {{#ifCond foo "or" bar}} !
02:00:48 
02:00:48 /workspace/src/vendor/zordius/lightncandy/src/LightnCandy.php:113
02:00:48 /workspace/src/vendor/zordius/lightncandy/src/LightnCandy.php:55
02:00:48 /workspace/src/extensions/Flow/includes/TemplateHelper.php:128
02:00:48 /workspace/src/extensions/Flow/tests/phpunit/unit/TemplateHelperTest.php:44
02:00:48 /workspace/src/tests/phpunit/MediaWikiUnitTestCase.php:101

This library is using extreme measures with regards to security and performance. It only barely got through our 2015 audit, with a lot of work on our end to integrate and contain it. I think if this were proposed as a new library today, I don't think we'd be as lenient.

Is using another more minimal mustache template library an optional? If so I'd suggest doing that and marking the lightncandy library as deprecated.
Supporting custom helpers such as ifCond was certainly out of scope when we put templating in core. My understanding was Mustache was chosen for the very fact it was minimal.

This library is using extreme measures with regards to security and performance. It only barely got through our 2015 audit, with a lot of work on our end to integrate and contain it. I think if this were proposed as a new library today, I don't think we'd be as lenient.

Is using another more minimal mustache template library an optional? If so I'd suggest doing that and marking the lightncandy library as deprecated.
Supporting custom helpers such as ifCond was certainly out of scope when we put templating in core. My understanding was Mustache was chosen for the very fact it was minimal.

It is certainly one way forward, especially if there's a "better" library out there. Of course, any new major library will need security and performance review (at least).

I don't know what else is out there, but lightncandy seems popular enough with over 1.2M installs.

But do bare in mind, MW 1.31 is an LTS, it is supported till June 2021. Similarly, 1.35 will be an LTS (due to be released in June 2020) and supported till June 2023. MW 1.34 due to be released in November 2019, will be supported until November 2020.

So this means that we will still be supporting Lightncandy in MW till at least June 2021 (ie 18 months from now), unless we backport the new library (and we don't really backport features generally) and patches to extensions as appropriate. Which will then potentially mean supporting any potential bug fixes, security fixes etc to MW and any Lightncandy dependant code

For cases where they want to keep using Lightncandy (for whatever reason, BlueSpice might be one of those), they can at least add lightncandy to their composer.json, update the wrapper calls (trivially copy code out of TemplateParser.php) and carry on for as long as they want.

While this can be a short term solution for Wikimedia Wikis, it is definitely not a long term one. I definitely don't want to get to the the point we have a migration half done, and end up with two Mustache/Handlebars type librarys in PHP to be supported...

Further to that, I doubt this will make MW 1.34, which is due to be released in the next 7 weeks. I state this because there's potentially things to rewrite (including potentially replacing features being used that the new library may have, such as the ifCond you mention), the libraries to review...

Which then means this might ship in 1.35 due to be released June 2020... And then supported till June 2023. For MW 1.35 this seems a feasible goal, but I don't think 1.34 is

Compared to other Mustache libs (for PHP), LightNCandy is actually quite good in terms of coding principles and is also dependency-free, which is a big bonus. It's maintainer is also fairly responsive, so I wouldn't want to abandon it unless we have no better choice.

I filed https://github.com/zordius/lightncandy/issues/322 to raise the "avoid storing executable code" issue.

Krinkle renamed this task from Update zordius/lightncandy to Upgrade zordius/lightncandy from 0.23 to 1.x.Oct 15 2019, 7:58 PM

Okay so it sounds like Flow is the only blocker to doing the upgrade?

it seems like we have several options

  • upgrade Flow
  • turn off Flow
  • limit old lightncandy to Flow

I'm guessing upgrade Flow is the preferred option here, but I'm not sure what we need to do to escalate this work. This seems like important maintenance work.

Unfortunately not;

The usages of the LightnCandy class is used by MW Core, Flow, DonationInterface and BlueSpice; the first few are minimal (for direct usages) - https://codesearch.wmflabs.org/search/?q=LightnCandy&i=nope&files=&repos=

See also a direct list, ignore the "usages found" in this paste which includes the vendored code

Class
    LightnCandy   
Found usages  (486 usages found)
    Class static member access  (440 usages found)
        mediawiki  (228 usages found)
            core/includes  (4 usages found)
                TemplateParser.php  (4 usages found)
                    TemplateParser  (4 usages found)
                        __construct  (1 usage found)
                            57 $this->compileFlags = LightnCandy::FLAG_ERROR_EXCEPTION | LightnCandy::FLAG_MUSTACHELOOKUP;
                        compile  (1 usage found)
                            188 return LightnCandy::compile(
                        enableRecursivePartials  (2 usages found)
                            66 $this->compileFlags |= LightnCandy::FLAG_RUNTIMEPARTIAL;
                            68 $this->compileFlags &= ~LightnCandy::FLAG_RUNTIMEPARTIAL;
            extensions/BlueSpiceFoundation/src  (1 usage found)
                TemplateParser.php  (1 usage found)
                    TemplateParser  (1 usage found)
                        compile  (1 usage found)
                            23 return LightnCandy::compile( $code, [
            extensions/DonationInterface/gateway_forms  (3 usages found)
                Mustache.php  (1 usage found)
                    Gateway_Form_Mustache  (1 usage found)
                        getForm  (1 usage found)
                            81 'options' => LightnCandy::FLAG_RUNTIMEPARTIAL,
                MustacheHelper.php  (2 usages found)
                    MustacheHelper  (2 usages found)
                        render  (2 usages found)
                            15 'flags' => LightnCandy::FLAG_ERROR_EXCEPTION | LightnCandy::FLAG_ADVARNAME,
                            32 $code = LightnCandy::compile( $template, $options );
            extensions/Flow/includes  (6 usages found)
                TemplateHelper.php  (6 usages found)
                    TemplateHelper  (6 usages found)
                        compile  (6 usages found)
                            125 return LightnCandy::compile(
                            128 'flags' => LightnCandy::FLAG_ERROR_EXCEPTION
                            129 | LightnCandy::FLAG_EXTHELPER
                            130 | LightnCandy::FLAG_SPVARS
                            131 | LightnCandy::FLAG_HANDLEBARS
                            132 | LightnCandy::FLAG_RUNTIMEPARTIAL,
            extensions/Flow/tests/phpunit/integration/Handlebars  (1 usage found)
                FlowPostMetaActionsTest.php  (1 usage found)
                    FlowPostMetaActionsTest  (1 usage found)
                        renderTemplate  (1 usage found)
                            117 $renderer = LightnCandy::prepare( $phpCode );
            extensions/Flow/tests/phpunit/unit  (1 usage found)
                TemplateHelperTest.php  (1 usage found)
                    TemplateHelperTest  (1 usage found)
                        testIfCond  (1 usage found)
                            45 $renderer = LightnCandy::prepare( $code );
    Usage in import statement  (4 usages found)
        mediawiki  (4 usages found)
            extensions/BlueSpiceFoundation/src  (1 usage found)
                TemplateParser.php  (1 usage found)
                    7 use LightnCandy;
            extensions/Flow/includes  (1 usage found)
                TemplateHelper.php  (1 usage found)
                    11 use LightnCandy;
            extensions/Flow/tests/phpunit/integration/Handlebars  (1 usage found)
                FlowPostMetaActionsTest.php  (1 usage found)
                    6 use LightnCandy;
            extensions/Flow/tests/phpunit/unit  (1 usage found)
                TemplateHelperTest.php  (1 usage found)
                    5 use LightnCandy;

Many more usages use the TemplateParser wrapper in MW core is well used in MW core and in the wild (not evaluated as to whether upgrading breaks any of these or not)

The code is pretty well embedded inside MW in one way or another. This (but is not limited) includes a handful of extensions including Collection, MinervaNeue, Vector (legacy skin), Jade, MobileFrontend, ORES, PageTriage, MediaWiki-extensions-Quiz and Notifications (Echo) as WMF deployed extensions

Usages of which need to be tested. Some might need no work to upgrade Lightncandy

Class
    TemplateParser   
Found usages  (78 usages found)
    New instance creation  (42 usages found)
        mediawiki  (42 usages found)
            core  (1 usage found)
                img_auth.php  (1 usage found)
                    wfForbidden  (1 usage found)
                        208 $templateParser = new TemplateParser();
            core/includes  (1 usage found)
                NoLocalSettings.php  (1 usage found)
                    47 $templateParser = new TemplateParser();
            core/includes/changes  (2 usages found)
                ChannelFeed.php  (1 usage found)
                    ChannelFeed  (1 usage found)
                        __construct  (1 usage found)
                            46 $this->templateParser = new TemplateParser();
                EnhancedChangesList.php  (1 usage found)
                    EnhancedChangesList  (1 usage found)
                        __construct  (1 usage found)
                            69 $this->templateParser = new TemplateParser();
            core/includes/specials/pagers  (1 usage found)
                ContribsPager.php  (1 usage found)
                    ContribsPager  (1 usage found)
                        __construct  (1 usage found)
                            147 $this->templateParser = new TemplateParser();
            core/tests/phpunit/includes  (2 usages found)
                TemplateParserTest.php  (2 usages found)
                    TemplateParserTest  (2 usages found)
                        testEnableRecursivePartials  (1 usage found)
                            123 $tp = new TemplateParser( $this->templateDir );
                        testProcessTemplate  (1 usage found)
                            28 $tp = new TemplateParser( $this->templateDir );
            extensions/BlueSpiceEchoConnector/src/Formatter  (2 usages found)
                EchoHtmlDigestEmailFormatter.php  (1 usage found)
                    EchoHtmlDigestEmailFormatter  (1 usage found)
                        __construct  (1 usage found)
                            21 $this->templateParser = new \TemplateParser( $path );
                EchoHTMLEmailFormatter.php  (1 usage found)
                    EchoHTMLEmailFormatter  (1 usage found)
                        __construct  (1 usage found)
                            45 $this->templateParser = new \TemplateParser( $path );
            extensions/BlueSpiceExtendedSearch/src/Tag  (1 usage found)
                TagSearchHandler.php  (1 usage found)
                    TagSearchHandler  (1 usage found)
                        handle  (1 usage found)
                            46 $templateParser = new \TemplateParser( $this->config->get( 'TagSearchSearchFieldTemplatePath' ) );
            extensions/BlueSpiceFoundation/src  (1 usage found)
                LoadPlaceholderRegistry.php  (1 usage found)
                    LoadPlaceholderRegistry  (1 usage found)
                        getParsedTemplate  (1 usage found)
                            49 $templateParser = new TemplateParser( $path );
            extensions/BlueSpicePrivacy/src/Module  (1 usage found)
                Transparency.php  (1 usage found)
                    Transparency  (1 usage found)
                        getHTML  (1 usage found)
                            181 $templateParser = new \TemplateParser( dirname( dirname( __DIR__ ) ) . '/resources/templates' );
            extensions/Collection/includes  (2 usages found)
                CollectionHooks.php  (1 usage found)
                    CollectionHooks  (1 usage found)
                        renderBookCreatorBox  (1 usage found)
                            234 $templateParser = new TemplateParser( dirname( __DIR__ ) . '/templates' );
                MessageBoxHelper.php  (1 usage found)
                    MessageBoxHelper  (1 usage found)
                        renderWarningBoxes  (1 usage found)
                            60 $templateParser = new TemplateParser( __DIR__ . DIRECTORY_SEPARATOR . '..'
            extensions/Collection/includes/Specials  (1 usage found)
                SpecialRenderBook.php  (1 usage found)
                    SpecialRenderBook  (1 usage found)
                        execute  (1 usage found)
                            50 $templateParser = new TemplateParser( __DIR__ . '/templates' );
            extensions/Collection/templates  (1 usage found)
                CollectionPageTemplate.php  (1 usage found)
                    CollectionPageTemplate  (1 usage found)
                        getDownloadForm  (1 usage found)
                            57 $templateParser = new TemplateParser( __DIR__ );
            extensions/Collection/tests/phpunit/includes  (4 usages found)
                BookRendererTest.php  (4 usages found)
                    BookRendererTest  (4 usages found)
                        testfixTemplateData  (1 usage found)
                            30 $templateParser = new TemplateParser( __DIR__ . self::TEMPLATE_DIR );
                        testGetBookTemplateDataImagesGeneration  (1 usage found)
                            71 $templateParser = new TemplateParser( __DIR__ . self::TEMPLATE_DIR );
                        testGetBookTemplateDataOutlineGeneration  (1 usage found)
                            22 $templateParser = new TemplateParser( __DIR__ . self::TEMPLATE_DIR );
                        testRenderBook  (1 usage found)
                            93 $templateParser = new TemplateParser( __DIR__ . self::TEMPLATE_DIR );
            extensions/CongressLookup/includes  (1 usage found)
                SpecialSenateLookup.php  (1 usage found)
                    SpecialSenateLookup  (1 usage found)
                        execute  (1 usage found)
                            62 $templateParser = new TemplateParser( __DIR__ . '/templates' );
            extensions/Echo/includes  (1 usage found)
                EchoHooks.php  (1 usage found)
                    EchoHooks  (1 usage found)
                        onSkinMinervaReplaceNotificationsBadge  (1 usage found)
                            999 $parser = new TemplateParser( __DIR__ . '/../modules/mobile' );
            extensions/Jade/includes  (1 usage found)
                JudgmentPageWikitextRenderer.php  (1 usage found)
                    JudgmentPageWikitextRenderer  (1 usage found)
                        __construct  (1 usage found)
                            46 $this->templateRenderer = new TemplateParser( $templatePath );
            extensions/MobileFrontend/includes  (2 usages found)
                ExtMobileFrontend.php  (1 usage found)
                    ExtMobileFrontend  (1 usage found)
                        getUserPageContent  (1 usage found)
                            159 $templateParser = new TemplateParser( __DIR__ . '/templates' );
                MobileUI.php  (1 usage found)
                    MobileUI  (1 usage found)
                        contentElement  (1 usage found)
                            68 $templateParser = new TemplateParser( __DIR__ . '/templates' );
            extensions/MobileFrontend/includes/specials  (1 usage found)
                SpecialMobileDiff.php  (1 usage found)
                    SpecialMobileDiff  (1 usage found)
                        getIntroHTML  (1 usage found)
                            265 $templateParser = new TemplateParser( __DIR__ );
            extensions/ORES/includes/Specials  (1 usage found)
                SpecialORESModels.php  (1 usage found)
                    SpecialORESModels  (1 usage found)
                        execute  (1 usage found)
                            49 $templateParser = new TemplateParser( dirname( __DIR__ ) . '/templates' );
            extensions/PageTriage/includes  (1 usage found)
                SpecialNewPagesFeed.php  (1 usage found)
                    SpecialNewPagesFeed  (1 usage found)
                        getListViewHtml  (1 usage found)
                            109 $templateParser = new TemplateParser( __DIR__ . '/templates' );
            extensions/Quiz/includes  (3 usages found)
                Question.php  (1 usage found)
                    Question  (1 usage found)
                        parseTextField  (1 usage found)
                            528 $templateParser = new TemplateParser( __DIR__ . '/../templates' );
                Quiz.php  (2 usages found)
                    Quiz  (2 usages found)
                        parseQuestion  (1 usage found)
                            366 $templateParser = new TemplateParser( __DIR__ . '/../templates' );
                        parseQuiz  (1 usage found)
                            208 $templateParser = new TemplateParser( __DIR__ . '/../templates' );
            extensions/Quiz/tests/phpunit  (1 usage found)
                QuizTest.php  (1 usage found)
                    QuizTest  (1 usage found)
                        testGetSettingsTable  (1 usage found)
                            160 $templateParser = new TemplateParser( __DIR__ . '/../../templates' );
            extensions/WikidataPageBanner/includes  (1 usage found)
                WikidataPageBannerFunctions.php  (1 usage found)
                    WikidataPageBannerFunctions  (1 usage found)
                        getBannerHtml  (1 usage found)
                            182 $templateParser = new TemplateParser( __DIR__ . '/../templates' );
            skins/BlueSpiceCalumma/src  (1 usage found)
                TemplateComponent.php  (1 usage found)
                    TemplateComponent  (1 usage found)
                        initTemplateParser  (1 usage found)
                            47 static::$templateParsers[$templatePath] = new \TemplateParser( $templatePath );
            skins/BlueSpiceCalumma/src/Controls  (1 usage found)
                TemplateControl.php  (1 usage found)
                    TemplateControl  (1 usage found)
                        getTemplateParser  (1 usage found)
                            49 return new TemplateParser(
            skins/BlueSpiceCalumma/src/Structure  (1 usage found)
                TemplateStructure.php  (1 usage found)
                    TemplateStructure  (1 usage found)
                        initTemplateParser  (1 usage found)
                            42 static::$templateParsers[$templatePath ] = new \TemplateParser( $templatePath );
            skins/MinervaNeue/includes/menu/User  (1 usage found)
                UserMenuDirector.php  (1 usage found)
                    UserMenuDirector  (1 usage found)
                        renderMenuData  (1 usage found)
                            58 $templateParser = new TemplateParser( __DIR__ . '/../../../components' );
            skins/MinervaNeue/includes/skins  (4 usages found)
                MinervaTemplate.php  (4 usages found)
                    MinervaTemplate  (4 usages found)
                        getHistoryLinkHtml  (1 usage found)
                            140 $templateParser = new TemplateParser( __DIR__ );
                        getMainMenuHtml  (1 usage found)
                            220 $templateParser = new TemplateParser( __DIR__ );
                        getPageActionsHtml  (1 usage found)
                            106 $templateParser = new TemplateParser( __DIR__ . '/../../components' );
                        render  (1 usage found)
                            232 $templateParser = new TemplateParser( __DIR__ );
            skins/Vector/includes  (1 usage found)
                VectorTemplate.php  (1 usage found)
                    VectorTemplate  (1 usage found)
                        execute  (1 usage found)
                            35 $templateParser = new TemplateParser( __DIR__ . '/templates' );
    Usage in comments  (18 usages found)
        mediawiki  (18 usages found)
            core/includes/changes  (2 usages found)
                ChannelFeed.php  (1 usage found)
                    ChannelFeed  (1 usage found)
                        31 /** @var TemplateParser */
                EnhancedChangesList.php  (1 usage found)
                    EnhancedChangesList  (1 usage found)
                        39 * @var TemplateParser
            core/includes/specials/pagers  (1 usage found)
                ContribsPager.php  (1 usage found)
                    ContribsPager  (1 usage found)
                        97 * @var TemplateParser
            core/tests/phpunit/includes  (1 usage found)
                TemplateParserTest.php  (1 usage found)
                    5 * @covers TemplateParser
            extensions/BlueSpiceEchoConnector/src/Formatter  (1 usage found)
                EchoHTMLEmailFormatter.php  (1 usage found)
                    EchoHTMLEmailFormatter  (1 usage found)
                        27 * @var \TemplateParser
            extensions/Collection/includes  (3 usages found)
                BookRenderer.php  (2 usages found)
                    BookRenderer  (2 usages found)
                        17 /** @var TemplateParser */
                        21 * @param TemplateParser $templateParser
                BookRenderingMediator.php  (1 usage found)
                    BookRenderingMediator  (1 usage found)
                        36 /** @var TemplateParser */
            extensions/Quiz/includes  (1 usage found)
                Quiz.php  (1 usage found)
                    Quiz  (1 usage found)
                        154 * @param TemplateParser $templateParser
            skins/BlueSpiceCalumma/src  (2 usages found)
                TemplateComponent.php  (2 usages found)
                    TemplateComponent  (2 usages found)
                        11 * @var \TemplateParser
                        37 * @var \TemplateParser[]
            skins/BlueSpiceCalumma/src/Controls  (1 usage found)
                TemplateControl.php  (1 usage found)
                    TemplateControl  (1 usage found)
                        46 * @return TemplateParser
            skins/BlueSpiceCalumma/src/Structure  (2 usages found)
                TemplateStructure.php  (2 usages found)
                    TemplateStructure  (2 usages found)
                        9 * @var \TemplateParser
                        32 * @var \TemplateParser[]
            skins/Vector/includes  (4 usages found)
                VectorTemplate.php  (4 usages found)
                    VectorTemplate  (4 usages found)
                        267 * @param TemplateParser $templateParser
                        319 * @param TemplateParser $templateParser
                        371 * @param TemplateParser $templateParser
                        456 * @param TemplateParser $templateParser
    Usage in extends clause  (1 usage found)
        mediawiki  (1 usage found)
            extensions/BlueSpiceFoundation/src  (1 usage found)
                TemplateParser.php  (1 usage found)
                    TemplateParser  (1 usage found)
                        13 class TemplateParser extends \TemplateParser implements ITemplateParser, MessageLocalizer {
    Usage in import statement  (11 usages found)
        mediawiki  (11 usages found)
            extensions/BlueSpiceFoundation/src  (1 usage found)
                LoadPlaceholderRegistry.php  (1 usage found)
                    5 use TemplateParser;
            extensions/Collection/includes  (3 usages found)
                BookRenderer.php  (1 usage found)
                    8 use TemplateParser;
                BookRenderingMediator.php  (1 usage found)
                    19 use TemplateParser;
                MessageBoxHelper.php  (1 usage found)
                    25 use TemplateParser;
            extensions/Collection/includes/Specials  (1 usage found)
                SpecialRenderBook.php  (1 usage found)
                    13 use TemplateParser;
            extensions/Collection/tests/phpunit/includes  (1 usage found)
                BookRendererTest.php  (1 usage found)
                    7 use TemplateParser;
            extensions/Jade/includes  (1 usage found)
                JudgmentPageWikitextRenderer.php  (1 usage found)
                    26 use TemplateParser;
            extensions/ORES/includes/Specials  (1 usage found)
                SpecialORESModels.php  (1 usage found)
                    7 use TemplateParser;
            extensions/PageTriage/includes  (1 usage found)
                SpecialNewPagesFeed.php  (1 usage found)
                    7 use TemplateParser;
            skins/BlueSpiceCalumma/src/Controls  (1 usage found)
                TemplateControl.php  (1 usage found)
                    6 use TemplateParser;
            skins/MinervaNeue/includes/menu/User  (1 usage found)
                UserMenuDirector.php  (1 usage found)
                    23 use TemplateParser;
    Usage in type hinting  (6 usages found)
        mediawiki  (6 usages found)
            extensions/Collection/includes  (2 usages found)
                BookRenderer.php  (1 usage found)
                    BookRenderer  (1 usage found)
                        __construct  (1 usage found)
                            23 public function __construct( TemplateParser $templateParser ) {
                BookRenderingMediator.php  (1 usage found)
                    BookRenderingMediator  (1 usage found)
                        __construct  (1 usage found)
                            42 TemplateParser $templateParser
            skins/Vector/includes  (4 usages found)
                VectorTemplate.php  (4 usages found)
                    VectorTemplate  (4 usages found)
                        renderNamespacesComponent  (1 usage found)
                            321 private function renderNamespacesComponent( TemplateParser $templateParser ) {
                        renderNavigation  (1 usage found)
                            270 protected function renderNavigation( TemplateParser $templateParser, array $elements ) {
                        renderSearchComponent  (1 usage found)
                            458 private function renderSearchComponent( TemplateParser $templateParser ) {
                        renderViewsComponent  (1 usage found)
                            373 private function renderViewsComponent( TemplateParser $templateParser ) {

Turning off Flow doesn't help. Upgrading Flow does help, but doesn't fix the other usages too. Limiting old lightncandy to flow... I dunno how you'd easily do that? Fork the library to rename the classes? Seems hacky. And even more so if we fix "most" of the usages, but leave some

I note Flow was only called out before as it caused/had test failures noticed as part of the gated extensions

Testing beyond that wasn't really done

@Krinkle, @Mooeypoo - I'm wondering if we could kill 2 birds with one stone here. On the one hand, we need some testing grounds for FAWG to try out the new JS framework that will be integrated into MediaWiki (which I imagine will include templating capabilities). On the other hand, we need to reduce our dependency on lightncandy/mustache in cases where we don't have resources to update and maintain those extensions for new versions of lightncandy. Perhaps we could beta test our new JS framework by migrating some of the old uses of mustache templates to the new framework. See T121947#5749594 for a list of potential targets.

Jdforrester-WMF assigned this task to Reedy.

Thanks to @Reedy's work and @Catrope's immense expertise, this is now done (albeit with a bumpy roll out to Beta Cluster due to object caching of compiled templates breaking things in a way not visible in local vagrant testing).

The uses of TemplateParser in core 'should' Just Work™ – as well as the StructuredDiscussions and core (enhanced Recent Changes) uses, I've quickly tested the Notifications (Echo), ORES, PageTriage, MobileFrontend, and Vector (legacy skin) use cases in Beta Cluster and all seems fine. DonationInterface will obviously need updating when they bump from 1.31 to 1.35 in a year's time. Please re-open if there are any issues found.

That's fantastic news. Thank you @Reedy, @Catrope and @Jdforrester-WMF. This was obviously a tricky one.