some refactoring and tests for syncable-history-server