Function applyReplicationStep

Apply one decoded replication step to an editable store.

bool applyReplicationStep(
  OsmStore store,
  scope ref const(ReplicationCheckpoint) checkpoint,
  scope ref const(ReplicationFeed) feed,
  scope ref const(ReplicationState) candidate,
  scope ref const(OsmChangeDocument) document,
  out ReplicationApplyResult result,
  out ReplicationApplyStatus status
) @safe;

The complete document is validated/staged before any store mutation. Object chains are evaluated by OSM version, not XML action-group order. Local M18 conflicts are previewed before reconcileAuthoritative is called; therefore a localConflict result leaves the store and checkpoint unchanged.

Same-sequence replay succeeds as a no-op. Stale/gapped sequences fail explicitly. A successfully applied next sequence advances only the returned checkpoint; durable persistence remains the caller's responsibility.