/**
 * Reconcile gap detection: if the oldest entry in a reconcile fetch is newer
 * than the newest already-persisted entry for that provider, the ring wrapped
 * past our tail and we have a gap.
 */
export function detectGap(
  oldestReconcileTs: string | null,
  newestPersistedTs: string | null,
): boolean {
  if (!oldestReconcileTs || !newestPersistedTs) return false;
  return new Date(oldestReconcileTs) > new Date(newestPersistedTs);
}
