Page MenuHomePhabricator

Provide a way to compact multiple transactions into one
Closed, ResolvedPublic40 Estimated Story Points

Description

VisualEditor uses arrays of consecutive transactions in various places (for instance ve.dm.Document#completeHistory , an ordered list of every transaction ever applied or reverted). It would be useful for many purposes to be able to compact multiple consecutive transactions into a single transasction: e.g. auto-saving; undo/redo; rebasing conflicting edits; and reducing memory footprint.

The "squashed" transaction will have the same effect on a document as applying the original transactions in turn, but it need not include certain "transient" changes such as an insertion that is then reverted. As such, it can have a lower memory footprint than the original transaction list (but note it may cause rebase conflicts where the original transaction list would not have). Note the following important properties:

  • Squashing the entire document history (from an initial empty document) results in a single insertion that is equivalent to the current document's linmod.
  • Squashing the entire history of an edit session (on a pre-existing document) gives an intent-preserving diff (as opposed to the heuristic diff you get by comparing the start and end states).
  • Squashing an insertion followed by a removal results in the content being removed entirely from the transaction.
  • Rebasing over the squashed transaction, if it does not cause conflicts, will give the same result as rebasing over the original transaction list.

It would be most useful to squash "in-place", i.e. squash( tx1, tx2 ) modifies tx1 by incorporating tx2. That way, new transactions can be squashed consecutively onto an existing (large) transaction as the editing session proceeds, without large amounts of copying. (New-object semantics can be achieved where useful by squashing tx2 onto a clone of tx1).

Event Timeline

Change 413428 had a related patch set uploaded (by Divec; owner: Divec):
[VisualEditor/VisualEditor@master] WIP: Change#squash: Compact multiple transactions into one

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

Esanders set the point value for this task to 40.Feb 28 2018, 12:41 PM

Squashing exacerbates T188709 , which hitherto was only bothering us in a few rare-ish edge cases.

Change 445076 had a related patch set uploaded (by Divec; owner: Divec):
[VisualEditor/VisualEditor@master] WIP: Squash Changes to use fewer transactions

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

Change 413428 abandoned by Divec:
WIP: Change#squash: Compact multiple transactions into one

Reason:
Abandon in favour of Id61c89c03bb2d44c575e1a4fb25145432723f808

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

Change 445612 had a related patch set uploaded (by Divec; owner: Divec):
[VisualEditor/VisualEditor@master] WIP: More test cases for squashing

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

Change 445076 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] Squash Changes to use fewer transactions

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

Change 446218 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (8d0ab0587)

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

Change 446218 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (8d0ab0587)

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

Deskana triaged this task as Medium priority.

Change 413428 restored by Divec:
WIP: Change#squash: Compact multiple transactions into one

Reason:
Patch set I267d334b0c063dfea2c86700542868d805fc0837 makes this feasible.

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

Change 413428 had a related patch set uploaded (by Divec; owner: Divec):
[VisualEditor/VisualEditor@master] Change#squash: Compact multiple transactions into one

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

Change 413428 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] Change#squash: Compact multiple transactions into one

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

Change 520500 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (dc0e4650e)

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

Change 520500 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (75510a515)

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