Given a list of offline ride operation records, merge them into the minimal sync payload to send when connectivity returns. Each record is a JSON string with fields ride_id, seq, op, and optional data. Operations for the same ride_id must be applied in ascending seq. Return a list of merged operations sorted by ride_id, where redundant updates are collapsed and invalidated rides are removed.
def merge_ride_sync_operations(records):