Page MenuHomePhabricator

GrowthExperiments: Less_Exception_Parser: File `resources/lib/ooui/wikimedia-ui-base.less` not found
Closed, ResolvedPublicBUG REPORT

Description

What is the problem?

Since yesterday, I am seeing a lot of exceptions in the beta logs of the form:

2021-11-24 11:10:35 [f58cdbd09cdba94246333700] deployment-mwmaint02 testwiki 1.38.0-alpha exception ERROR: [f58cdbd09cdba94246333700] [no req]   Less_Exception_Parser: File `resources/lib/ooui/wikimedia-ui-base.less` not found. in BaseModule.less {"exception_url":"[no req]","reqId":"f58cdbd09cdba94246333700","caught_by":"other"} 
[Exception Less_Exception_Parser] (/srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Parser.php:2668) File `resources/lib/ooui/wikimedia-ui-base.less` not found. in BaseModule.less
  #0 /srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Parser.php(446): Less_Parser->Error(string)
  #1 /srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Tree/Import.php(265): Less_Parser->parseFile(string, string, boolean)
  #2 /srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Tree/Import.php(190): Less_Tree_Import->ParseImport(string, string, Less_Environment)
  #3 /srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Tree/Ruleset.php(239): Less_Tree_Import->compile(Less_Environment)
  #4 /srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Tree/Ruleset.php(227): Less_Tree_Ruleset->evalImports(Less_Environment)
  #5 /srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Tree/Ruleset.php(69): Less_Tree_Ruleset->PrepareRuleset(Less_Environment)
  #6 /srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Parser.php(190): Less_Tree_Ruleset->compile(Less_Environment)
  #7 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderFileModule.php(1170): Less_Parser->getCss()
  #8 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderFileModule.php(1038): ResourceLoaderFileModule->compileLessString(string, string, DerivativeResourceLoaderContext)
  #9 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderFileModule.php(1014): ResourceLoaderFileModule->processStyle(string, string, string, DerivativeResourceLoaderContext)
  #10 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderFileModule.php(991): ResourceLoaderFileModule->readStyleFile(string, DerivativeResourceLoaderContext)
  #11 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderFileModule.php(420): ResourceLoaderFileModule->readStyleFiles(array, DerivativeResourceLoaderContext)
  #12 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderModule.php(796): ResourceLoaderFileModule->getStyles(DerivativeResourceLoaderContext)
  #13 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderModule.php(747): ResourceLoaderModule->buildContent(DerivativeResourceLoaderContext)
  #14 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoader.php(1139): ResourceLoaderModule->getModuleContent(DerivativeResourceLoaderContext)
  #15 /srv/mediawiki/php-master/extensions/WikimediaMaintenance/blameStartupRegistry.php(137): ResourceLoader->makeModuleResponse(DerivativeResourceLoaderContext, array)
  #16 /srv/mediawiki/php-master/maintenance/doMaintenance.php(108): BlameStartupRegistry->execute()
  #17 /srv/mediawiki/php-master/extensions/WikimediaMaintenance/blameStartupRegistry.php(332): require_once(string)
  #18 /srv/mediawiki/multiversion/MWScript.php(116): require_once(string)
  #19 {main}

It should be noted that this does not just affect the BaseModule.less file, it occurs for loads of other files including:

File `resources/lib/ooui/wikimedia-ui-base.less` not found. in campaign.less
File `resources/lib/ooui/wikimedia-ui-base.less` not found. in ve.ui.CodeMirror.init.less

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Krinkle added a subscriber: Krinkle.

This appears to be due to an invalid import in GrowthExperiments/modules/ext.growthExperiments.MentorDashboard/BaseModule.less:

@import 'resources/lib/ooui/wikimedia-ui-base.less';

The only supported imports are from the exposed mediawiki.less directory and any overlay/override from the skins theme directory.

This appears to work by accident from (some?) web server contexts due to $IP being the current working directory in those cases, but it's nonetheless a private file that isn't exposed for direct importing in this way.

Krinkle moved this task from Limbo to Watching on the Performance-Team (Radar) board.

Tentatively blocking train as I'd expect blameStartupRegistry.php to fail in production in the same way.

kostajh added subscribers: Urbanecm_WMF, kostajh.

cc @Urbanecm_WMF, looks like this particular code was added in rEGREc49129b46b5e: Mentor dashboard: Add subheader style. Although, we have this @import 'resources/lib/ooui/wikimedia-ui-base.less'; statement all over our LESS files.

Change 742113 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/GrowthExperiments@master] Use local copy of wikimedia ui less variables

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

Change 742116 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/GrowthExperiments@master] Use local ui less variables in all styles

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

cc @Urbanecm_WMF, looks like this particular code was added in rEGREc49129b46b5e: Mentor dashboard: Add subheader style. Although, we have this @import 'resources/lib/ooui/wikimedia-ui-base.less'; statement all over our LESS files.

I have pushed a possible patch for this. The problem was somehow mentioned in T295183: LESS variables and Import OOUI base styles mechanism. We would like to take steps forward to improve the current status of our styles imports. But as @kostajh says it is used all over our code base. I changed all the imports on this second patch, still doing some manual testing since it affects many files. All the imports have been changed in a single patch.

Change 742120 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/GrowthExperiments@master] Use local copy of wikimedia ui less variables

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

Change 742116 abandoned by Sergio Gimeno:

[mediawiki/extensions/GrowthExperiments@master] Use local ui less variables in all styles

Reason:

squashed in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/GrowthExperiments/+/742120

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

Change 742113 abandoned by Sergio Gimeno:

[mediawiki/extensions/GrowthExperiments@master] Use local copy of wikimedia ui less variables

Reason:

squashed in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/GrowthExperiments/+/742120

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

Change 742120 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Use ForeignResourceManager to download wikimedia-ui-base.less

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

@Sgs Even after this change, I am seeing on beta:

2021-11-29 14:43:58 [319306f2d6453ce850098d42] deployment-mwmaint02 zhwiki 1.38.0-alpha exception ERROR: [319306f2d6453ce850098d42] [no req]   Less_Exception_Parser: File `resources/lib/ooui/wikimedia-ui-base.less` not found. in ve.ui.CodeMirror.init.less {"exception_url":"[no req]","reqId":"319306f2d6453ce850098d42","caught_by":"other"} 
[Exception Less_Exception_Parser] (/srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Parser.php:2668) File `resources/lib/ooui/wikimedia-ui-base.less` not found. in ve.ui.CodeMirror.init.less
  #0 /srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Parser.php(446): Less_Parser->Error(string)
  #1 /srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Tree/Import.php(265): Less_Parser->parseFile(string, string, boolean)
  #2 /srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Tree/Import.php(190): Less_Tree_Import->ParseImport(string, string, Less_Environment)
  #3 /srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Tree/Ruleset.php(239): Less_Tree_Import->compile(Less_Environment)
  #4 /srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Tree/Ruleset.php(227): Less_Tree_Ruleset->evalImports(Less_Environment)
  #5 /srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Tree/Ruleset.php(69): Less_Tree_Ruleset->PrepareRuleset(Less_Environment)
  #6 /srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Parser.php(190): Less_Tree_Ruleset->compile(Less_Environment)
  #7 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderFileModule.php(1170): Less_Parser->getCss()
  #8 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderFileModule.php(1038): ResourceLoaderFileModule->compileLessString(string, string, DerivativeResourceLoaderContext)
  #9 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderFileModule.php(1014): ResourceLoaderFileModule->processStyle(string, string, string, DerivativeResourceLoaderContext)
  #10 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderFileModule.php(991): ResourceLoaderFileModule->readStyleFile(string, DerivativeResourceLoaderContext)
  #11 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderFileModule.php(420): ResourceLoaderFileModule->readStyleFiles(array, DerivativeResourceLoaderContext)
  #12 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderModule.php(796): ResourceLoaderFileModule->getStyles(DerivativeResourceLoaderContext)
  #13 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderModule.php(747): ResourceLoaderModule->buildContent(DerivativeResourceLoaderContext)
  #14 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoader.php(1139): ResourceLoaderModule->getModuleContent(DerivativeResourceLoaderContext)
  #15 /srv/mediawiki/php-master/extensions/WikimediaMaintenance/blameStartupRegistry.php(137): ResourceLoader->makeModuleResponse(DerivativeResourceLoaderContext, array)
  #16 /srv/mediawiki/php-master/maintenance/doMaintenance.php(108): BlameStartupRegistry->execute()
  #17 /srv/mediawiki/php-master/extensions/WikimediaMaintenance/blameStartupRegistry.php(332): require_once(string)
  #18 /srv/mediawiki/multiversion/MWScript.php(116): require_once(string)
  #19 {main}

Is this a different bug? In VE perhaps?

@Sgs Even after this change, I am seeing on beta:

2021-11-29 14:43:58 [319306f2d6453ce850098d42] deployment-mwmaint02 zhwiki 1.38.0-alpha exception ERROR: [319306f2d6453ce850098d42] [no req]   Less_Exception_Parser: File `resources/lib/ooui/wikimedia-ui-base.less` not found. in ve.ui.CodeMirror.init.less {"exception_url":"[no req]","reqId":"319306f2d6453ce850098d42","caught_by":"other"} 
[Exception Less_Exception_Parser] (/srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Parser.php:2668) File `resources/lib/ooui/wikimedia-ui-base.less` not found. in ve.ui.CodeMirror.init.less
  #0 /srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Parser.php(446): Less_Parser->Error(string)
  #1 /srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Tree/Import.php(265): Less_Parser->parseFile(string, string, boolean)
  #2 /srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Tree/Import.php(190): Less_Tree_Import->ParseImport(string, string, Less_Environment)
  #3 /srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Tree/Ruleset.php(239): Less_Tree_Import->compile(Less_Environment)
  #4 /srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Tree/Ruleset.php(227): Less_Tree_Ruleset->evalImports(Less_Environment)
  #5 /srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Tree/Ruleset.php(69): Less_Tree_Ruleset->PrepareRuleset(Less_Environment)
  #6 /srv/mediawiki/php-master/vendor/wikimedia/less.php/lib/Less/Parser.php(190): Less_Tree_Ruleset->compile(Less_Environment)
  #7 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderFileModule.php(1170): Less_Parser->getCss()
  #8 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderFileModule.php(1038): ResourceLoaderFileModule->compileLessString(string, string, DerivativeResourceLoaderContext)
  #9 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderFileModule.php(1014): ResourceLoaderFileModule->processStyle(string, string, string, DerivativeResourceLoaderContext)
  #10 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderFileModule.php(991): ResourceLoaderFileModule->readStyleFile(string, DerivativeResourceLoaderContext)
  #11 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderFileModule.php(420): ResourceLoaderFileModule->readStyleFiles(array, DerivativeResourceLoaderContext)
  #12 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderModule.php(796): ResourceLoaderFileModule->getStyles(DerivativeResourceLoaderContext)
  #13 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderModule.php(747): ResourceLoaderModule->buildContent(DerivativeResourceLoaderContext)
  #14 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoader.php(1139): ResourceLoaderModule->getModuleContent(DerivativeResourceLoaderContext)
  #15 /srv/mediawiki/php-master/extensions/WikimediaMaintenance/blameStartupRegistry.php(137): ResourceLoader->makeModuleResponse(DerivativeResourceLoaderContext, array)
  #16 /srv/mediawiki/php-master/maintenance/doMaintenance.php(108): BlameStartupRegistry->execute()
  #17 /srv/mediawiki/php-master/extensions/WikimediaMaintenance/blameStartupRegistry.php(332): require_once(string)
  #18 /srv/mediawiki/multiversion/MWScript.php(116): require_once(string)
  #19 {main}

Is this a different bug? In VE perhaps?

@dom_walden that looks like an issue with MediaWiki-extensions-CodeMirror, as the Less_Exception_Parser: File resources/lib/ooui/wikimedia-ui-base.less` not found. in ve.ui.CodeMirror.init.less` message is about that extension and not GrowthExperiments. I think a new task for that extension would make sense.

kostajh renamed this task from Less_Exception_Parser: File `resources/lib/ooui/wikimedia-ui-base.less` not found to GrowthExperiments: Less_Exception_Parser: File `resources/lib/ooui/wikimedia-ui-base.less` not found.Nov 29 2021, 2:50 PM

Thanks for the quick fix.

In the short-mid term these can probably be replaced with mediawiki.skin.variables (T112747, T265941) which has as the posterchild use case something that looks a lot like what GrowthExperiments needed. Be sure to reach out to Volker if you have any questions or are unsure of which variables to use or might need additional ones to be standardised within core in skin-agnostic way.