Reproduction on StackBlitz. (Click "Add Todo" multiple times quickly.)
If I attempt to call collection.utils.writeInsert while a previous transaction is still in progress the commit will fail with a duplicate key error and then the transaction fails to rollback. This happens both when called within an onInsert function and outside of it.
In this case I'm testing out a scenario where I avoid an expensive refetch, but modify the local db directly, similar to this example.