Page MenuHomePhabricator

ContributionsSpecialPage/ContributionsPager introduction breaks CI
Closed, ResolvedPublic

Description

https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1028873/2
SpecialContributions__getForm__filtersHook::onSpecialContributions__getForm__filters() param type of $sp was WIDENED to ContributionsSpecialPage
same with SpecialContributionsBeforeMainOutputHook::onSpecialContributionsBeforeMainOutput()

https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1025467/5
ContribsPager__getQueryInfoHook::onContribsPager__getQueryInfo() param type of $pager was WIDENED to ContributionsPager, same with

  • ContribsPager__reallyDoQueryHook::onContribsPager__reallyDoQuery()
  • ContributionsLineEndingHook::onContributionsLineEnding()

These are breaking changes, e.g. preventing ORES merges
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/ORES/+/1029513

12:45:51 includes/Hooks/ContributionsHooksHandler.php:42 PhanParamSignatureMismatch Declaration of function onContribsPager__getQueryInfo(\MediaWiki\Pager\ContribsPager $pager, array &$query) : bool|void should be compatible with function onContribsPager__getQueryInfo(\MediaWiki\Pager\ContributionsPager $pager, array &$queryInfo) : bool|void defined in ../../includes/specials/Hook/ContribsPager__getQueryInfoHook.php:25 (Expected \MediaWiki\Pager\ContribsPager $pager to have the same type as \MediaWiki\Pager\ContributionsPager $pager or a supertype)
12:45:51 includes/Hooks/ContributionsHooksHandler.php:120 PhanParamSignatureMismatch Declaration of function onSpecialContributions__getForm__filters(\MediaWiki\Specials\SpecialContributions $page, array[] &$filters) : bool|void should be compatible with function onSpecialContributions__getForm__filters(\MediaWiki\SpecialPage\ContributionsSpecialPage $sp, array &$filters) : bool|void defined in ../../includes/specials/Hook/SpecialContributions__getForm__filtersHook.php:27 (Expected \MediaWiki\Specials\SpecialContributions $page to have the same type as \MediaWiki\SpecialPage\ContributionsSpecialPage $sp or a supertype)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
DannyS712 triaged this task as Unbreak Now! priority.Thu, May 9, 5:27 PM

Change #1029553 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/core@master] Revert "Add ContributionsPager, an abstract parent for ContribsPager"

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

Change #1029554 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/core@master] Revert "ContribsPager: Refactor getQueryInfo for extending"

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

Change #1029555 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/core@master] Revert "Make ContributionsSpecialPage parent for SpecialContributions"

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

Bah, yeah, I was wondering whether we should making the breaking change in the other direction (where CI passes fine but actually it's broken as hell). I don't think either approach is great, but this one seemed the less-bad.

Note that this is only a Phan warning. It's not a breaking change for the PHP code; it still works correctly. That's because the definitions of these hooks do not have PHP type annotations, only PHPDoc annotations, and I vaguely recall someone saying that this was done on purpose specifically to allow this kind of changes without them technically being breaking changes. (I even happen to have a patch pending that would take advantage of that to make a not-technically-breaking change: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/999129.)

Does anyone remember this less vaguely, or perhaps knows where it's written down?

Change #1029553 merged by jenkins-bot:

[mediawiki/core@master] Revert "Add ContributionsPager, an abstract parent for ContribsPager"

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

Change #1029554 merged by jenkins-bot:

[mediawiki/core@master] Revert "ContribsPager: Refactor getQueryInfo for extending"

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

Change #1029555 merged by jenkins-bot:

[mediawiki/core@master] Revert "Make ContributionsSpecialPage parent for SpecialContributions"

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

Note that this is only a Phan warning. It's not a breaking change for the PHP code; it still works correctly. That's because the definitions of these hooks do not have PHP type annotations, only PHPDoc annotations, and I vaguely recall someone saying that this was done on purpose specifically to allow this kind of changes without them technically being breaking changes. (I even happen to have a patch pending that would take advantage of that to make a not-technically-breaking change: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/999129.)

Does anyone remember this less vaguely, or perhaps knows where it's written down?

Maybe that is from T240307#6191788

Note that this is only a Phan warning. It's not a breaking change for the PHP code; it still works correctly. That's because the definitions of these hooks do not have PHP type annotations, only PHPDoc annotations, and I vaguely recall someone saying that this was done on purpose specifically to allow this kind of changes without them technically being breaking changes. (I even happen to have a patch pending that would take advantage of that to make a not-technically-breaking change: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/999129.)

Does anyone remember this less vaguely, or perhaps knows where it's written down?

Maybe that is from T240307#6191788

Thanks, that comment from @daniel may be what I remembered! I think that lends some credence to the idea of making changes like the ones in this task. Maybe we'll hear from the man himself what he thinks these days, also being the main author of the stable interface policy. ;)

I had a look at all the hook handlers for the SpecialContributions and ContribsPager hooks. Most of them use @inheritDoc or document a SpecialPage or IContextSource, but a few need updating.

SpecialContributions hooks

ContributionsBeforeMainOutput:

ContributionsToolLinks:

  • No updates needed

SpecialContributions__getForm__filters:

ContribsPager hooks

ContribsPager__reallyDoQuery:

ContribsPager__getQueryInfo:

SpecialContributions__formatRow__flags:

  • Doesn't pass the page

ContributionsLineEnding:

  • No updates needed

There are also some non-WMF extensions that would need updating:

I think these can be beyond the scope of this task, but we do need to make sure we update the change notes in T363358: Create extendable parent classes for special pages showing contributions lists.

Change #1030911 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/extensions/ORES@master] ContributionsHooksHandler: Inherit documentation from interfaces

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

Change #1030912 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/extensions/Flow@master] Hooks.php: Fix documentation for contribution pages hook handlers

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

Change #1030913 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/extensions/Flow@master] Hooks.php: Prepare for contributions refactor

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

Change #1030945 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/extensions/GrowthExperiments@master] HomepageHooks: Inherit documentation for contributions hook

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

Change #1030911 merged by jenkins-bot:

[mediawiki/extensions/ORES@master] ContributionsHooksHandler: Inherit documentation from interfaces

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

Change #1030912 merged by jenkins-bot:

[mediawiki/extensions/Flow@master] Hooks.php: Fix documentation for contribution pages hook handlers

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

Change #1030913 merged by jenkins-bot:

[mediawiki/extensions/Flow@master] Hooks.php: Prepare for contributions refactor

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

Change #1030945 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] HomepageHooks: Inherit documentation for contributions hook

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