# Spec: Startup retry, custom stations, and equalizer persistence ## Requirement: Startup radio loading resilience The system MUST retry initial Radio Browser station loading with bounded attempts and host rotation before exposing a startup connection error. ### Scenario: transient startup failure recovers - GIVEN the first radio API request fails due to a transient connection error - WHEN the app initializes `EstadoRadio` - THEN the system MUST retry using an eligible host - AND popular/tending stations SHALL be populated when a later attempt succeeds - AND no final startup error SHALL remain visible ### Scenario: startup failures are exhausted - GIVEN all configured retry attempts fail - WHEN initial station loading completes - THEN the system MUST stop retrying automatically - AND it MUST expose a user-visible connection error - AND the manual retry action MUST still call station loading again ## Requirement: Custom stations in the main listing The system MUST include stations added in Settings in the main station listing and MUST allow them to be marked/unmarked as favorites through the same favorite flow as API stations. ### Scenario: added custom station appears on home - GIVEN a user saves a valid custom station in Settings - WHEN the main listing is rendered without a genre filter - THEN the custom station MUST be visible in the listing - AND selecting it MUST start playback through the normal `EstadoRadio.reproducir` path ### Scenario: custom station can be favorited - GIVEN a custom station is visible in the main listing - WHEN the user taps its favorite action - THEN the station MUST be persisted in favorites - AND the Favorites screen SHALL show it after favorite state reloads ## Requirement: Main equalizer persistence The system MUST persist the main equalizer preset/graph and MUST load it during state initialization before the first playback-specific EQ decision. ### Scenario: main EQ restores after restart - GIVEN the user configures the main EQ to a non-flat graph - WHEN the app state is recreated - THEN `EstadoRadio.presetEcualizador` MUST expose the saved graph - AND the native audio equalizer SHALL receive it when the EQ becomes available ### Scenario: EQ state persists even when native EQ is unavailable - GIVEN the platform has no available native equalizer at startup - WHEN persisted EQ settings are loaded - THEN Provider state MUST still expose the saved EQ graph - AND no persistence data SHALL be discarded ## Requirement: Favorite station equalizer mode The system MUST let each favorite station either use the main equalizer or use its own saved equalizer. If own EQ exists for a station, playback MUST respect it. ### Scenario: favorite station own EQ is applied - GIVEN a favorite station has its own saved EQ graph - WHEN the user plays that station - THEN the system MUST apply the station EQ graph - AND it MUST expose that graph as the current EQ in state ### Scenario: favorite station falls back to main EQ - GIVEN a favorite station has no own EQ enabled - AND the main EQ is configured - WHEN the user plays that station - THEN the system MUST apply the main EQ graph ### Scenario: disabling own EQ restores main behavior - GIVEN a favorite station has own EQ enabled - WHEN the user switches that station to use main EQ - THEN the station-specific EQ entry MUST be removed or ignored - AND future playback of that station MUST use the current main EQ ## Requirement: Test-first implementation The implementation MUST add failing tests for each scenario before production behavior is changed. ### Scenario: strict TDD guardrail - GIVEN this change is implemented - WHEN an implementation task begins - THEN the corresponding test MUST be written first - AND verification MUST use `flutter test`, never `flutter build`