Page MenuHomePhabricator

Source wiki edit logic doesn't detect some failure cases
Closed, ResolvedPublic5 Estimated Story Points

Description

When importing a protected file as an unprivileged user (should become impossible after work in T233575), I was presented with a "mark source file" checkbox and chose to make the edit, but import proceeded without an error. No failures were recorded in the logs for either the source or target wiki, no failure metrics were incremented, but the edit was not made.

Acceptance criteria

  • Any variety of source wiki edit failure should be recorded in logs and metrics.

Event Timeline

Lena_WMDE set the point value for this task to 5.
Lena_WMDE subscribed.

First step: investigating what/how this fails.

Change 598686 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/FileImporter@master] Improve comments and PHPDoc documentation

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

I played around with this locally and found that I always get a proper error message when either the deletion or inserting the "Now Commons" template failed. The main issue I can see is that this error message is easy to miss. It's a yellow box below the green box that says the import was successful (which it was).

However, my test setup was not specifically for a write-protected source file. I think this is worth another test.

Change 598955 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/FileImporter@master] Fix incomplete error reporting on remote edit actions

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

I found the issue! \o/

Open question: Should we display the internal error message to the user? As of now, the messages are neutral:

  • "Editing the source wiki automatically was not possible."
  • "The file could not be deleted automatically on $1. Please return to [$2 the original file] and delete it manually."

It should be rare for a deletion to fail (maybe if the file was already deleted by another administrator). But edits can easily fail. However, the error message we get is most probably not localized, but English. Something like "You don't have the necessary rights …". Is this useful?

Possible TODOs:

  • Check the user's right to edit before giving them the option to do a remote edit. We currently don't check this, but assume all file descriptions can be edited by all users.
  • Display the error message. We can do this in addition, as there are other possible errors (e.g. a conflict).

Change 598955 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Fix incomplete error reporting on remote edit actions

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

Change 598686 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Improve comments and PHPDoc documentation

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

awight moved this task from Demo to Done on the WMDE-QWERTY-Sprint-2020-05-27 board.

Demonstrated.