
Why CSP matters II: How do I know sync works? - muraiki
http://reaktor.com/blog/why-csp-matters-ii-how-do-i-know-sync-works/
======
marknadal
For anybody who found this interesting, make sure to read his earlier article
(which he links to) here: [http://reaktor.com/blog/why-csp-matters-i-keeping-
things-in-...](http://reaktor.com/blog/why-csp-matters-i-keeping-things-in-
sync/) . It sets up the problem which he then answers in this post.

We've been having a similar issue, where we want to make sure our data syncs
correctly. One of our contributors built this ToDoMVC app
[http://todos.loqali.com/](http://todos.loqali.com/) (which basically also
works for a grocery list app as well), but how do you know it synced
correctly? Or more importantly, how do you prove it?

The article is great at addressing this with clojure and and CSP. But it would
be nice if we had a generic testing framework (like Jasmine, Mocha, etc. are)
for doing this. That is why one of my employees is working on
[https://github.com/gundb/panic](https://github.com/gundb/panic) (in
development! not working yet!). So far it has been specific to our project,
but this next iteration he is splitting it out and making it generic to any
project.

You write your test, it gets deployed on a bunch of clients/peers, and then
the test coordinator (panic) aggregates the results and confirms if everything
ran correctly or not. The cool thing is since your test is deployed across a
bunch of peers, you can have the test assert that client1 received an update
from client2 - if that never fulfills, then it is considered a "fail". If
however, a non-deterministic network hiccup occurs (versus a simulated one in
the test), the whole test suite should bail and force you to re-run so you
don't get flawed results.

This is really important because it tails off of the work of Kyle Kingsbury (
[https://aphyr.com/](https://aphyr.com/) ) who has sent shockwaves through the
database industry with his Call Me Maybe Jepsen series. You want to verify
that the system works correctly (and as it claims). So I hope to see more
articles like this, as well as more work in this direction. We need tools
(like what we are doing with panic) that make this easy and accessible for all
developers.

