Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge: complete rewrite #301

Merged
merged 12 commits into from
Feb 22, 2022
Merged

Merge: complete rewrite #301

merged 12 commits into from
Feb 22, 2022

Conversation

le-jeu
Copy link
Member

@le-jeu le-jeu commented Dec 8, 2021

This PR splits the merge feature from the operation model.
The merge feature follow a rebase mechanism using the common ancestor of the operations to be merged.
We always have a master copy (server), the follower (local) and the ancestor origin that was saved in local data at last fetch.
The merge is structured in 4 steps:

  1. masterChange: difference between master and origin (what's new on the server)
    followerChange: difference between follower and origin (what did I changed or fb event changed)
  2. followerChange - masterChange: compute what are the local changes that are not on master
    conflict may arise: we change smth that is not on master anymore, we change something both on master and follower etc
  3. if there are conflicts (that we don't want to solve automatically), the user needs to choose for every conflicts between the master and follower version
  4. apply on master what was previously computed and uses the resolved conflicts at step 3

The merge dialog is reworked to match the step 3.

operation.changes() is simplified to return a boolean instead of the computed changes.

@le-jeu le-jeu changed the base branch from master to dev December 8, 2021 20:29
@le-jeu le-jeu force-pushed the merge_zone branch 3 times, most recently from 0f40358 to bb428b8 Compare January 14, 2022 18:35
@le-jeu le-jeu added the In Testing fix is in the code, waiting on verificaiton label Jan 14, 2022
@le-jeu le-jeu marked this pull request as ready for review February 5, 2022 15:09
@le-jeu le-jeu self-assigned this Feb 5, 2022
@le-jeu le-jeu added this to the 0.21 milestone Feb 5, 2022
@le-jeu le-jeu removed their assignment Feb 5, 2022
@le-jeu le-jeu force-pushed the merge_zone branch 2 times, most recently from af3dc23 to f6a2151 Compare February 8, 2022 20:49
@le-jeu le-jeu changed the title Merge: complete rewrite WIP Merge: complete rewrite Feb 20, 2022
Copy link
Member

@cloudkucooland cloudkucooland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I'm able to follow, this looks good. I'm still slow at reading typescript and I don't know these codepaths well, but nothing jumped out at me as being wrong.

type: "edition",
props: computeDiff(origin, current, [
"type",
/*"portalId",*/ // unlikely because we don't swap marker yet
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we'd added (or were planning on adding) maker swap

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"yet", also what swaping marker does has to be defined first,
preserving the link ID on anchor swap allow to track anchor and resolve situation where one moved an anchor while another assigned it
imo, marker don't need this refinement and can change ID on swap

}
return this.localchanged;
}

mergeZones(op: WasabeeOp) {
const ids = new Set();
const ids = new Map<ZoneID, WasabeeZone>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes!

@le-jeu le-jeu merged commit 2f7d1f8 into wasabee-project:dev Feb 22, 2022
@le-jeu le-jeu mentioned this pull request Mar 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
In Testing fix is in the code, waiting on verificaiton
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants