Page MenuHomePhabricator

ApiFlowUndoEditTopicSummary uses incorrect module name
Closed, ResolvedPublic

Description

The paraminfo for flow+undo-edit-topic-summary uses the same name as that for flow+edit-topic-summary but with different content:

The paraminfo for [[https://en.wikipedia.org/w/api.php?action=paraminfo&modules=flow|action=paraminfo&modules=flow]] lists both modules and [[https://en.wikipedia.org/w/api.php?action=paraminfo&modules=flow+edit-topic-summary|action=paraminfo&modules=flow+edit-topic-summary]] also shows the data for flow+edit-topic-summary but [[https://en.wikipedia.org/w/api.php?action=paraminfo&modules=flow+undo-edit-topic-summary|action=paraminfo&modules=flow+undo-edit-topic-summary]] uses actually flow+edit-topic-summary as path and edit-topic-summary as name. I'm not sure if StructuredDiscussions is simply configured wrongly but I'd prefer if the API itself recognizes that the name/path is inconsistent (which is why I added it).

For Pywikibot this will be hard to recover from. I guess if it doesn't get modules which it requested, it will discard the data (at least the ambiguous) and request each separately to make sure it can assign names.

Event Timeline

XZise created this task.Jul 10 2015, 12:25 PM
XZise raised the priority of this task from to Needs Triage.
XZise updated the task description. (Show Details)
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Anomie renamed this task from Inconsistent paraminfo for flow+undo-edit-topic-summary to ApiFlowUndoEditTopicSummary uses incorrect module name.Jul 10 2015, 12:53 PM
Anomie moved this task from Unsorted to Non-core-API stuff on the MediaWiki-API board.
Anomie set Security to None.
Anomie added a subscriber: Anomie.Jul 10 2015, 12:57 PM

The simple fix would be to fix ApiFlowUndoEditTopicSummary::__construct() to pass the correct name to the parent class.

A more robust fix would be to actually use the $name parameter being passed in from ApiModuleManager, in ApiFlowUndoEditTopicSummary and any other classes that are doing the same sort of thing.

XZise added a comment.Jul 10 2015, 1:22 PM

Yes a more solid for any module which might have typos would be appreciated. Sure it's possible to fix that specific solution but I dread the next situation where this happens. And I'm not sure if it's possible to have some unit tests for extensions which do some sanity checks like that.

Change 224066 had a related patch set uploaded (by Matthias Mullie):
Use correct module name for ApiFlowUndoEditTopicSummary

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

Change 224066 merged by jenkins-bot:
Use correct module name for ApiFlowUndoEditTopicSummary

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

Checked in beta.
e.g. Request URL:http://en.wikipedia.beta.wmflabs.org/w/index.php?title=Topic:Sjqj08n7njbnz2az&action=undo-edit-topic-summary&topicsummary_startId=skuk7j7reza63kob&topicsummary_endId=skuk7yosjii5f97v

title:Topic:Sjqj08n7njbnz2az
action:undo-edit-topic-summary
topicsummary_startId:skuk7j7reza63kob
topicsummary_endId:skuk7yosjii5f97v

for edit-topic-summary:

Request URL:http://en.wikipedia.beta.wmflabs.org/w/api.php

action:flow
format:json
submodule:edit-topic-summary
page:Topic:Skukjz2ha0eprdp4
etsprev_revision:skul7dip1sz90ufs
etssummary:Summary223
etsformat:wikitext
token:18ebd5666c48d6ce6962fbcdbd28678655

DannyH closed this task as Resolved.Jul 10 2015, 11:46 PM
DannyH added a subscriber: DannyH.
XZise added a comment.Jul 11 2015, 9:24 AM

Granted I don't really know how the API internally works and the original issue has been fixed, I'd appreciate if this can't happen anymore. For example the name/path returned in ParamInfo are always the module's name. Somewhere the module has been added as undo-edit-topic-summary and that should be returned there and I don't see any reason why a module should be able to change that afterwards.

jayvdb moved this task from Backlog to Flow on the Pywikibot-Flow board.Aug 7 2015, 12:13 PM