Page MenuHomePhabricator

Section-level images: Placeholder gets saved in wikitext on rejection
Closed, ResolvedPublicBUG REPORT

Description

example diff
(it includes another change too - a Parsoid bug?)

Event Timeline

Change 932341 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[mediawiki/extensions/GrowthExperiments@master] Section images: Placeholder should serialize to empty string

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

We should probably do a safety check in the VE presave handler to make sure the wikitext is unchanged on rejection.

We should probably do a safety check in the VE presave handler to make sure the wikitext is unchanged on rejection.

Yeah I think we need to do this. The patch fixes the issue, but I noticed that I still had contents to the article saved after clicking "No":

image.png (340×2 px, 136 KB)

Change 932341 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Section images: Placeholder should serialize to empty string

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

Change 932280 had a related patch set uploaded (by Urbanecm; author: Gergő Tisza):

[mediawiki/extensions/GrowthExperiments@wmf/1.41.0-wmf.13] Section images: Placeholder should serialize to empty string

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

I noticed that I still had contents to the article saved after clicking "No"

I can think of three underlying causes:

  1. This is a Parsoid roundtripping bug (either within Parsoid proper, or a side effect of the RESTBase deprecation - AIUI RESTBase played some role in Parsoid being able to roundtrip slightly syntactically incorrect wikitext without changing it). That means it will affect all structured task types, and both accepts and rejections (and probably normal VE edits too). There isn't any great option to deal with it - we can use VisualEditorApiVisualEditorEditPreSave to emit an error and block the save, but that's a poor user experience. It's probably something for another team (API? Content Transform? Editing?) to look into.
  2. We are doing something wrong in our VisualEditor integration that breaks Parsoid's roundtripping. (Maybe we are losing some supplemental information, or maybe VE would detect via its transaction history that there aren't any changes and avoid doing a proper save, and we are breaking that.) Could be something that didn't matter before the RESTBase deprecation. Might or might not be limited to section images. Fixable if we figure out what's happening.
  3. The image placeholder is somehow perturbing wikitext roundtripping. Either dmRecommendedImagePlaceholderNode is doing something wrong, or it's just unavoidable. If there is no easier fix, we can always just remove the image placeholder in AddSectionImageArticleTarget.saveWithoutShowingDialog.

Change 932280 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@wmf/1.41.0-wmf.13] Section images: Placeholder should serialize to empty string

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

Mentioned in SAL (#wikimedia-operations) [2023-06-23T14:20:48Z] <urbanecm@deploy1002> Started scap: Backport for [[gerrit:932280|Section images: Placeholder should serialize to empty string (T340170)]]

Mentioned in SAL (#wikimedia-operations) [2023-06-23T14:27:44Z] <urbanecm@deploy1002> Finished scap: Backport for [[gerrit:932280|Section images: Placeholder should serialize to empty string (T340170)]] (duration: 06m 56s)

Moving to QA, but we want to keep an eye out for rejected suggestions resulting in real edits due to dirty diffs - filed as T340235: Section-level images: Check for dirty diffs.

Aklapper renamed this task from Section-level images: Placeholder gets saved in wiktext on rejection to Section-level images: Placeholder gets saved in wikitext on rejection.Jun 25 2023, 9:16 AM
Etonkovidova subscribed.

Checked all three Structured tasks in beta - rejected add links, article image, and section level article images are not saved as edits.

Added a note to T340532: Structured tasks should never make an edit when the user rejects the recommendation - I was able to make "Link suggestions feature: 0 links added. " edit on cswiki beta cluster (not reproducible.