OT: NoOperation and "no delta" should be used carefully. #4097
Labels
package:engine
resolution:invalid
This issue is invalid (e.g. reports a non-existent bug or a by-design behavior).
type:bug
This issue reports a buggy (incorrect) behavior.
(Follow-up to: ckeditor/ckeditor5-engine#977)
Long story short:
NoOperation
(and no delta, that is aDelta
that has just one or moreNoOperation
s) are dangerous when it comes to OT. We should never change transformed operation toNoOperation
and transformed delta to "no delta".Since, at the entry point (
model.Document#transformDeltas
), it is assumed that "incoming" deltas are always stronger (whether they come from undo or collaborative editing), we need to check all algorithms if they may returnNoOperation
/ "no delta" whencontext.isStrong == true
.Then, we have to check if it is safe to have
NoOperation
as a result at all during operation. From what I've been thinking about it, it should be safe, but maybe there are some complicated cases when it is harmful.Also we need to check whether it is safe to have some deltas with
NoOperation
instead ofMoveOperation
.Here is an explanation why this change is important. You may read it to have a better understanding of the issue. Consider two following case that might happen in collaborative editing:
bold
totrue
. Then they change it tofalse
.bold
.bold
totrue
". Since both operations are same, User B's operation might be changes toNoOperation
. But then we lose all the context. In next operation, User A "reverts" his change, but User B's operation is already aNoOperation
and we have no way to get it back to "changebold
totrue
".It's plain that we cannot change transformed operation to
NoOperation
because we are losing information this way. Above example is simple but there might be other cases that went unnoticed.The text was updated successfully, but these errors were encountered: