share / share/sharedb

Transfomation side ("left", "right")

Open
#200 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
6.5k
Forks
456
Avg merge
1d 5h
Merged PRs (30d)
5

Description

Hey,

I have been working on a new document type. But I found something which is a little bit odd. It might be an issue or I need some clarification or explanation for it. I hope you can help me out.
So I had an issue that the server transformed some messages differently than the clients and I think I tracked it down to 2 classes. The first one is the file ot.js line 143 – 147. Here the transform method will be called with op.op, appliedop and side = left. For me that means the side “pointer” points on the operation that has not been executed yet. Basically it’s still pending.

  try {
      op.op = type.transform(op.op, appliedOp.op, 'left');
    } catch (err) {
      return err;
    }

On the other side there is the client, which also has to call the transform method, but here the pointer points the other way around, see file doc.js, line 479 – 488. The transform in line 484 and 485 will be executed with client.op, server.op and left. If I compare it to the ot.js file, I would say that the client.op has not been executed yet. In my opinion the client.op has been executed, since it is on the client right? I assume that the client is not sending an operation to the server and then waiting for a response. I assume that the client will execute the changes locally and then send it to the server. In case that there is a transformation needed, the client should call (client.op, server.op, “right”) since the client.op would be the applied one (if you compare it to the ot.js), right?

if (client.type.transformX) {
  var result = client.type.transformX(client.op, server.op);
  client.op = result[0];
  server.op = result[1];
} else {
  var clientOp = client.type.transform(client.op, server.op, 'left');
  var serverOp = client.type.transform(server.op, client.op, 'right');
  client.op = clientOp;
  server.op = serverOp;
}

It would be great if you could tell me if I am on the wrong way or if that is an issue. The order is in my protocol essential and cannot be executed the other way around.
Best Regards,
Dom

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the transform calls in ot.js lines 143–147 and doc.js lines 479–488, then compare how the server and client interpret the left and right sides. Determine whether the side arguments are consistent for the protocol's operation order; done means the behavior is clarified or corrected with coverage for the affected transformation paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.