Potential race condition between archive and replication
Current implementation of CNodeService.archive() does not appear to increment the serial version of the system metadata.
This implies that a race condition between calls of archive (either due to sync or directly by user) could be overwritten by updates from replication (other services in the future). Since the serial version is not updated by archive - the replication process may not recognize there has been an update from archive - and potentially overwrite the archive flag.
A possible short term solution for protecting the 'archive' flag data, would be to implement a 'business rule' that enforces that once SystemMetadata.archive is set to 'true' - that no subsequent updates are allowed to reset the archived flag to 'false'. This would prevent the race condition between updates from over-writing the 'archive' flag. This change will also PREVENT and archived document from being 'unarchived' in the future (even as requested by user?)
Further discussion is likely needed to determine the best layer to insert this type of business logic enforcement.