Page MenuHomePhabricator

Split separate concepts off from large TemplateDataBlob class
Closed, ResolvedPublic8 Estimated Story Points

Description

As of January 2022 the TemplateDataBlob class is 1001 lines long. Buried in there are at least 4 different concept:

  • The actual data
  • Validation
  • Normalization
  • HTML formatting
  • As well as some utility code

Some of the benefits of splitting these into separate smaller services:

  • Code is much easier to read
  • Things can be tested separately in smaller and faster unit tests
  • Validation can be skipped when the input is known to be valid. This is currently not possible. Validation is done over and over again every time the API is used.

Patch-For-Review:

Event Timeline

thiemowmde set the point value for this task to 8.

Change 759454 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/TemplateData@master] Simplify language handling in API code

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

Change 759455 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/TemplateData@master] Replace duplicate getData\u2026() signature with a single one

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

Change 759462 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/TemplateData@master] Split and streamline HTML formatter code

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

Change 749695 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/TemplateData@master] Move getRawParams helper method to ApiTemplateData class

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

Change 749747 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/TemplateData@master] Split validation and normalization into separate services

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

Change 759462 merged by jenkins-bot:

[mediawiki/extensions/TemplateData@master] Split and streamline HTML formatter code

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

Change 749695 merged by jenkins-bot:

[mediawiki/extensions/TemplateData@master] Move getRawParams helper method to ApiTemplateData class

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

Change 759455 abandoned by Thiemo Kreuz (WMDE):

[mediawiki/extensions/TemplateData@master] Replace duplicate getData\u2026() signature with a single one

Reason:

Originally my goal was to get rid of the deep clone altogether. But this got lost very early. I might try again later.

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

Change 764729 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/TemplateData@master] Remove unreachable validation step

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

Change 764729 merged by jenkins-bot:

[mediawiki/extensions/TemplateData@master] Remove unreachable validation step

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

Change 814109 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/TemplateData@master] Split parameter validation off as separate methods

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

Change 814112 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/TemplateData@master] Extract named isValidCustomFormatString() method

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

Change 814109 merged by jenkins-bot:

[mediawiki/extensions/TemplateData@master] Split parameter validation off as separate methods

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

Change 814112 merged by jenkins-bot:

[mediawiki/extensions/TemplateData@master] Extract named isValidCustomFormatString() method

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

Change 749747 merged by jenkins-bot:

[mediawiki/extensions/TemplateData@master] Split validation and normalization into separate services

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

Change 759454 abandoned by Thiemo Kreuz (WMDE):

[mediawiki/extensions/TemplateData@master] Simplify language handling in API code

Reason:

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