This is quite hard to figure out, but about 6-7% of the time on .NET tests a race condition in LiteCore is triggered in the way that shared keys are persisted to the database. Without adding additional logging this was causing weird behavior due to silent errors and failure but what is happening is the following.
1. Race on shared keys causes the keyString() method to mistakenly return null due to "unknown key"
2. The JSON Encoder is fine with encoding a number as a key into a JSON document
3. This gets transmitted to the other side via passive pusher to active puller
4. The Fleece encode fails due to invalid keys (integers) being present
5. The document is skipped due to this error and an innocuous document ended callback with a 0 error code is sent
This took a long time to diagnose since it manifested as failure to call conflict resolvers (which makes sense since the document never gets properly saved). This most likely happened during the DBWorker refactor.