Fasting begins at true dawn (fajr al-sadiq), not at sunrise. The interval between true dawn and sunrise is already within the fasting day.
Eating before sunrise does not preserve the fast if true dawn had already begun. Sunrise is the wrong boundary for the start of fasting.