Page MenuHomePhabricator

Paste check evaluates individual annotation-ranges by length, not the total size of the paste
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Edit with VE with paste check enabled
  • Paste in some content that will trigger paste check that's overall long enough to trigger paste check, but that includes a paragraph/heading that's less than 50 characters long, for example the description of this task.

What happens?:

The part of the content that's less than 50 characters long is excluded from the check, although the parts around it are triggered:

CleanShot 2026-01-15 at 10.31.50@2x.png (2,496×598 px, 244 KB)

What should have happened instead?:

Probably the overall length of the entire pasted content should be what the length requirement is evaluated against. This would, however, have the side effect that a user pasting something and then editing it post-paste in ways that break up the content would no longer resolve the check.

Event Timeline

Potential resolutions:

  1. the total length of the pasted content (from a given paste) is what matters; this will make it so that the user splitting that content up themself so that there are no longer any runs of 50+ characters will no longer stop the paste check from being shown
  2. a paste with *any* remaining range of content with sufficient length should trigger every remaining bit of that content to be shown for the check
  3. adjacent pasted content between paragraphs (/headings/etc) should be merged for purposes of content-length calculation
  4. any-of-the-above but all content in-between pasted ranges is counted as part of the paste for removal/highlighting purposes; this would clean up any edits that the user had made to the content
  5. this is fine actually

Note that any resolution which results in the paste check offering to remove content that's heavily intermingled with non-paste content is going make the "remove it" option have undesirable behavior. This is most likely with options 1 or 2.

  1. this is fine actually

Given that the "remove" button only removes the long runs, and not all the pasted content, I would suggest this does need fixing.

If the user heavily edits the text after pasting and then resolve the check in some way - this will probably lead to some strange behaviour but I don't think we should optimise for this edge case.

I think we should do at least (1) and optionally (3). Note that currently pastes are already merged by their event ID, so (3) would be asking us to split up pastes when they are edited, which also seems fine (as long the fragments are still highlighted based on their original paste length).

We do merge them into a single action, but unfortunately that's after we apply our isRangeValid and length-checks to each individual run of the paste annotation. As I was thinking of it, (3) would leave the single-action bit alone, but would relocate the config-checks to somewhere after we've built up the by-id mapping.

We might need to think about what "remove" should actually do if we make modified content more likely to be included, because the current experience is that we strip out all the pasted characters and leave anything the user has added themselves. (Which is very weird to see.)

Change #1248031 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/extensions/VisualEditor@master] PasteCheck: Filter based on combined range length, not individual ones

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

Yes - although "remove" is already broken with complex pastes, e.g. if I paste in structure like a list or a table, that doesn't get removed, just the list item contents.

Change #1248031 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] PasteCheck: Filter based on combined range length, not individual ones

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