Page MenuHomePhabricator

Avoid use of APIEditBeforeSave hook to return precise error messages in the API, as it's possible with EditFilterMergedContent since 1.25
Closed, ResolvedPublic

Description

We should avoid using the APIEditBeforeSave hook to return precise error messages in the API. It only provides the page text as submitted by the API user, which is different from the actual page text to be saved in case of section edits and automerged edit conflicts. The EditFilterMergedContent hook allows doing this since MW 1.25 (09a5febb7b024c0b6585141bb05cba13a642f3eb / https://gerrit.wikimedia.org/r/#/c/177747/).

Example fix, for AbuseFilter: https://gerrit.wikimedia.org/r/#/c/282100/

Extensions currently using the APIEditBeforeSave hook:

  • AbuseFilter
  • ConfirmEdit
  • SpamBlacklist
  • ProofreadPage

Details

Event Timeline

matmarex created this task.Jun 14 2016, 5:35 PM
Restricted Application added subscribers: Zppix, Florian, Aklapper. · View Herald TranscriptJun 14 2016, 5:35 PM
matmarex triaged this task as Medium priority.

Change 294728 had a related patch set uploaded (by Bartosz Dziewoński):
Remove backwards-compatibility code using APIEditBeforeSave hook

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

Change 294730 had a related patch set uploaded (by Bartosz Dziewoński):
Remove backwards-compatibility code using APIEditBeforeSave hook

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

matmarex updated the task description. (Show Details)Jun 16 2016, 3:58 PM
Jdforrester-WMF updated the task description. (Show Details)
Jdforrester-WMF updated the task description. (Show Details)

Change 294730 merged by jenkins-bot:
Remove backwards-compatibility code using APIEditBeforeSave hook

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

Change 294728 merged by jenkins-bot:
Remove backwards-compatibility code using APIEditBeforeSave hook

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

Change 295717 had a related patch set uploaded (by Jforrester):
Hooks: Replace deprecated APIEditBeforeSave with EditFilterMergedContent

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

Change 295717 merged by jenkins-bot:
Hooks: Replace deprecated APIEditBeforeSave with EditFilterMergedContent

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

Change 295738 had a related patch set uploaded (by Anomie):
Remove backwards-compatibility code using APIEditBeforeSave hook

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

Change 295733 had a related patch set uploaded (by Jforrester):
Actually mark the APIEditBeforeSave hook as deprecated

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

Change 295738 merged by jenkins-bot:
Use EditFilterMergedContent instead of APIEditBeforeSave hook

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

I am not sure if APIEditBeforeSave should really be considered generally deprecated. It might still make sense to use that hook specifically to extend the action=edit API. I don't really care much either way, though.

Change 295732 had a related patch set uploaded (by Jforrester):
Mark the APIEditBeforeSave hook as deprecated

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

Change 295733 abandoned by Jforrester:
Actually mark the APIEditBeforeSave hook as deprecated

Reason:
Merged into parent per Anomie.

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

Change 295732 merged by jenkins-bot:
Mark the APIEditBeforeSave hook as deprecated

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

Jdforrester-WMF closed this task as Resolved.Jun 24 2016, 8:47 PM

Thanks for the help @Anomie @Jdforrester-WMF! I really did not expect this to get resolved in a couple days, much less for someone else to do half the work for me :)

Dangling tech debt at people is a good way to get things done. ;-)