Classify auth/network errors and validate OFREP construction#139
Merged
Conversation
This was referenced May 13, 2026
2f53550 to
ba38ac2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #123 (typed
Unauthorized/Unreachableerrors) and #122 (OFREP construction validation) — workstream A3 + A4 of the 1.0-readiness plan.A4 — typed auth/network errors
FeatureFlagError:Unauthorized(reason: String)— operator-actionable signal that the remote provider rejected the request (HTTP 401/403 or analogous). Distinguishes a misconfigured SDK key from a generic provider error.Unreachable(cause: Throwable)— network-layer failure (DNS, connection refused, no route). Distinct from a slow response (ProviderError(TimeoutException)) or an HTTP-level rejection.FeatureFlagError.classify(t: Throwable)— single classifier used wherever the library wraps an underlying Throwable from a provider. RecognisesUnknownHostException,ConnectException,NoRouteToHostException, and matches common HTTP auth exception classes / messages (401,403,Unauthorized,Forbidden). Everything else falls back toProviderError(t)with the cause preserved.ProviderError(_)call sites inFeatureFlagsLiveroute throughclassifynow. No code path was lost —ProviderErrorremains the fallback.isProviderErrorandtoErrorCodeupdated for the new cases.A3 — OFREP construction validation
OFREPProvider:make(baseUrl: String): IO[FeatureFlagError.InvalidConfiguration, OfrepProvider]make(options: OfrepProviderOptions): IO[FeatureFlagError.InvalidConfiguration, OfrepProvider]layer(baseUrl: String): ZLayer[Any, FeatureFlagError.InvalidConfiguration, OfrepProvider]layer(options: OfrepProviderOptions): ZLayer[Any, FeatureFlagError.InvalidConfiguration, OfrepProvider]http/https, non-empty host.apply(),apply(baseUrl),fromOptions) kept for backwards compatibility but annotated@deprecatedso callers migrate over time.makeProvidertest helper, so the recommended API is also the one exercised in CI.Closes #122
Closes #123