spotify / spotify/confidence-resolver
Go local provider should recover after initial CDN state fetch failure
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16
- Forks
- 14
- Avg merge
- 2d 7m
- Merged PRs (30d)
- 40
Description
Problem
The Go local provider performs one CDN state fetch in Init(). A failure returns an initialization error before the state polling goroutine is started. The HTTP client has a 30 second timeout, so startup can block for that duration and the provider cannot recover automatically when the CDN becomes available.
Intended behavior
Match the Java local provider startup behavior:
- Initialization should complete without waiting indefinitely for CDN state.
- The provider should remain not ready while no valid state is available.
- Flag evaluations should return the caller supplied default with a provider-not-ready error.
- Start state polling even when the initial fetch fails.
- Retry every 1 second while no valid state has been loaded.
- After a successful fetch, initialize the resolver, transition to ready, and use the configured normal polling interval.
- Shutdown must cancel in-flight requests and retry goroutines.
- Once state has been loaded, continue serving the last good state during later CDN failures.
Acceptance criteria
- A startup CDN outage does not permanently fail provider initialization.
- Recovery happens automatically without recreating the provider.
- Tests cover timeout, repeated retry, recovery, default-value evaluation while not ready, and clean shutdown.
- The existing 30 second HTTP request timeout remains configurable through the existing transport hooks or an explicit provider option.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Go local provider's Init method, state polling goroutine, HTTP client, and shutdown path; compare startup and retry behavior with the Java local provider. Run the existing provider tests first, then add coverage for timeout, repeated retries, recovery, not-ready default evaluation, and clean shutdown. Done means startup survives CDN failure, retries every second until valid state arrives, and later failures preserve the last good state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100