Page MenuHomePhabricator

Run validation on charts before render
Closed, ResolvedPublic3 Estimated Story Points

Description

Acceptance Criteria

  • Page renders with error box displays when invalid charts are encountered (T389125, T389126)
  • Add appropriate error tracking category if applicable
  • Integration test that confirms page can render with error

Sign off

  • Review tracking category behaviour.
  • Ensure fix solves T389126
  • Ensure fix solves T389125

Event Timeline

Change #1130720 had a related patch set uploaded (by Aude; author: Aude):

[mediawiki/extensions/Chart@master] WIP - Handle invalid json data pages in chart parser function

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

JCDataContent::getLocalizedData does a validation check and may return null if the data is invalid.

We are missing a check for this (null value) for both tabular data content and chart definition content.

https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/JsonConfig/+/refs/heads/master/includes/JCDataContent.php#94

Also, there is an overall lack of tests in the Chart extension. I can add tests for these specific cases but it would be good to add more test coverage in general in the extension.

Change #1132000 had a related patch set uploaded (by Aude; author: Aude):

[mediawiki/extensions/Chart@master] Handle invalid json data pages in chart parser function

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

Change #1132000 merged by jenkins-bot:

[mediawiki/extensions/Chart@master] Handle invalid json data pages in chart parser function [bugfix only]

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

Change #1133573 had a related patch set uploaded (by Aude; author: Aude):

[mediawiki/extensions/Chart@master] Add tests for charts with invalid tabular data

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

Change #1130720 abandoned by Aude:

[mediawiki/extensions/Chart@master] Handle invalid json data pages in chart parser function

Reason:

Replaced by 1133573 for the tests

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

Let's break out the testing into a separate task (maybe as part of T390103) so that we can move forward with signing off on the fix.

This seems to have fixed T389126, although I'm not sure why the page renders with "⧼chart-error-invalid-source-content⧽".

From https://commons.wikimedia.beta.wmflabs.org/w/index.php?title=Data:Break.chart:

image.png (219×969 px, 25 KB)

It doesn't seem to fix T389125 though, I'm still getting a MediaWiki internal error at https://commons.wikimedia.beta.wmflabs.org/wiki/Data:1993_Canadian_federal_election_localized.chart.

Change #1133573 abandoned by Aude:

[mediawiki/extensions/Chart@master] Add tests for charts with invalid tabular data

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