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

Fixes #150 — Consistent conflicts resolution strategies. #152

Merged
merged 1 commit into from
Sep 14, 2015

Conversation

n1k0
Copy link
Contributor

@n1k0 n1k0 commented Sep 8, 2015

Refs #150 - WiP, do not merge yet.

  • Fix incoming conflicts resolution according to selected strategy
  • Fix outgoing conflicts resolution according to selected strategy
  • Ensure conflicting scenarios are exhaustively covered by integration tests
  • Expose a new resolved property to the sync result object
  • Update documentation
  • Update sync flow diagram
  • Generate dist files

@n1k0 n1k0 force-pushed the 150-consistent-sync-strategies branch 2 times, most recently from 57a53b1 to 931726d Compare September 9, 2015 14:32
expect(() => transformer.encode()).to.Throw(Error, "Not implemented.");
expect(() => transformer.decode()).to.Throw(Error, "Not implemented.");
});
});
Copy link
Contributor

Choose a reason for hiding this comment

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

choucroute?

Copy link
Member

Choose a reason for hiding this comment

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

cassoulet !

Copy link
Contributor Author

Choose a reason for hiding this comment

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

choucroute?

cassoulet !

Both are fine, though this was for improving code coverage only :)

@n1k0 n1k0 changed the title [WiP] Consistent incoming conflicts resolution strategies. Fixes #150 — Consistent conflicts resolution strategies. Sep 9, 2015
@n1k0 n1k0 force-pushed the 150-consistent-sync-strategies branch from 9d8cc09 to 8e9670b Compare September 11, 2015 08:08
@n1k0
Copy link
Contributor Author

n1k0 commented Sep 11, 2015

r=? @Natim

});
});

it("should not have an ok status", () => {
Copy link
Member

Choose a reason for hiding this comment

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

should have an ok status ?

@n1k0
Copy link
Contributor Author

n1k0 commented Sep 14, 2015

Then what happens in case options.resolved is set and there is another conflict?

Well, we've just called _handleConflicts in the previous promise step, so it's very unlikely (read impossible) that conflicts remain when checking for this option with an automatic resolution strategy set.

@n1k0 n1k0 force-pushed the 150-consistent-sync-strategies branch from a7d558c to 15a03ff Compare September 14, 2015 06:59
@leplatrem
Copy link
Contributor

I would r+

Regarding the tests @Natim mentions, I would say they are covered by functional tests. At first, I also thought there was a need to re-sync and check the server state... But after digging a bit, I realized both strategies lead to a consistent state with the server :) Since this is the result of some code that is already being unit tested, I would say we're fine here!


If conflicts occured, they're listed in the `conflicts` property; they must be resolved locally and `sync()` called again.
When using `Kinto.syncStrategy.MANUAL` and conflicts occur, they're listed in the `conflicts` property; they must be resolved locally and `sync()` called again.
Copy link
Member

Choose a reason for hiding this comment

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

nit: consider "When using [...], if conflicts occurs, they're [...]".

@almet
Copy link
Member

almet commented Sep 14, 2015

Interestingly, on a second read, the code looks clear to me (it wasn't the case the first time I read. The schema helped a lot to bring context, thanks).

The changes looks good to me. I would go for a merge (with my few nits addressed).

@n1k0 n1k0 force-pushed the 150-consistent-sync-strategies branch 2 times, most recently from 5ce8ffa to 8b73c8e Compare September 14, 2015 09:31
@n1k0 n1k0 force-pushed the 150-consistent-sync-strategies branch from 8b73c8e to 741b24e Compare September 14, 2015 10:50
n1k0 added a commit that referenced this pull request Sep 14, 2015
Fixes #150 — Consistent conflicts resolution strategies.
@n1k0 n1k0 merged commit 8900071 into master Sep 14, 2015
@n1k0 n1k0 deleted the 150-consistent-sync-strategies branch September 14, 2015 11:17
@Natim
Copy link
Member

Natim commented Sep 16, 2015

we've just called _handleConflicts in the previous promise step, so it's very unlikely (read impossible) that conflicts remain when checking for this option with an automatic resolution strategy set.

Well, if client 1 published something and client 2 is fast enough to update that record in between the first and the second call to pullChanges, then it could end up in another conflict.

@n1k0 n1k0 mentioned this pull request Sep 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants