Skip to content

Conversation

@typotter
Copy link
Collaborator

@typotter typotter commented Jan 21, 2026

Configuration Source Extraction part 3/5 - Add Configuration HTTP Client Interface

🥞 Configuration Refactor Stacked Pull Requests 🥞

🔲 Make HTTP client injectable via constructor (#207)
🔲 Integrate default HTTP client implementation (#206)
👉 Add configuration HTTP client interface (this PR)
✅ Add flagsSnapshotId field to Configuration (#208)
✅ Extract DTO interfaces for downstream SDK extensibility (#197)
⬇️ feature/v4 (trunk)

Motivation and Context

Building on the DTO interface extraction (#197) and the flagsSnapshotId field addition (#208), we need to provide an interface for configuration fetching that allows downstream SDKs to:

  1. Use platform-specific HTTP clients and deserialization: Android's HttpUrlConnection, Ktor, custom networking libraries
  2. Manage their own connection pooling: Control thread pools, connection limits, timeouts
  3. Implement custom retry logic: Exponential backoff, circuit breakers, custom error handling
  4. Add platform-specific features: Certificate pinning, custom SSL contexts, proxy configuration
  5. Avoid OkHttp dependency: Not all platforms want/need OkHttp bundled

The current tight coupling to EppoHttpClient (OkHttp-based) prevents this flexibility.

Description

Extract IEppoConfigurationHttpClient interface and supporting request/response classes to enable pluggable HTTP client implementations.

New Classes Added

  1. IEppoConfigurationHttpClient - Interface for HTTP configuration fetching

    • Sync/async methods for flags and bandits
    • Returns generic ConfigurationResponse<T> wrapper
  2. ConfigurationRequest - Request data class

    • URL, API key, SDK name/version, previous ETag
  3. ConfigurationResponse<T> - Generic response wrapper

    • Payload (flags or bandits), ETag, status code, error message
    • Static factories: Flags.success(), Bandits.notModified(), etc.
    • Convenience methods: isSuccess(), isNotModified(), isError()
  4. ConfigurationRequestFactory - Factory for creating requests

    • Encapsulates URL/API key configuration
    • Creates flag/bandit-specific requests

Tests Added

  • ConfigurationRequestTest (4 tests) - Request creation and validation
  • ConfigurationResponseTest (18 tests) - Response factory methods, status checks
  • ConfigurationRequestFactoryTest (8 tests) - Request factory behavior

Total: 30 new tests ensuring robust API contracts.

How has this been documented?

  • Comprehensive Javadoc on all classes and methods
  • Clear API contracts in interface documentation
  • Test coverage demonstrates usage patterns

How has this been tested?

  • 30 new unit tests covering all new classes
  • All existing tests pass (no functional changes yet - integration in next PR)

Breaking Changes

None. This PR only adds new classes without modifying existing behavior.

Dependencies

Depends on: PR #208 (typo/etag-in-configuration)
Blocks: PRs #206, #207

@typotter typotter changed the base branch from feature/v4 to typo/dto-interface-extraction January 21, 2026 16:53
@typotter typotter force-pushed the typo/flag-source-interface branch 3 times, most recently from f989187 to 92d52f7 Compare January 21, 2026 17:02
import cloud.eppo.api.IFlagConfigResponse;
import java.util.concurrent.CompletableFuture;

public interface IEppoConfigurationHttpClient {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Nullable param to be added to init and constructor for EppoClient
  • Default implementation will use OkHttp & sdk-specific json parsing util.
  • Implementations are responsible for network requests and parsing responses.


public interface IEppoConfigurationHttpClient {

<T extends IFlagConfigResponse> ConfigurationResponse<IFlagConfigResponse> fetchFlagConfiguration(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IFlagConfigResponse and IBanditParametersResponse are interfaces all the way down

@typotter typotter requested a review from aarsilv January 21, 2026 17:08
@typotter typotter changed the title [demo] Configuration Http Client extensibility Configuration Source Extraction part 2/4 - Add Configuration HTTP Client Interface Jan 23, 2026
@typotter typotter changed the title Configuration Source Extraction part 2/4 - Add Configuration HTTP Client Interface Configuration Source Extraction part 2/3 - Add Configuration HTTP Client Interface Jan 23, 2026
@typotter typotter changed the title Configuration Source Extraction part 2/3 - Add Configuration HTTP Client Interface Configuration Source Extraction part 2/4 - Add Configuration HTTP Client Interface Jan 23, 2026
@typotter typotter changed the base branch from typo/dto-interface-extraction to typo/etag-in-configuration January 23, 2026 19:47
@typotter typotter changed the title Configuration Source Extraction part 2/4 - Add Configuration HTTP Client Interface Configuration Source Extraction part 3/5 - Add Configuration HTTP Client Interface Jan 23, 2026
@typotter typotter marked this pull request as ready for review January 23, 2026 20:10
@typotter typotter force-pushed the typo/flag-source-interface branch from 32638b2 to 5644864 Compare January 23, 2026 21:51
@typotter typotter force-pushed the typo/flag-source-interface branch from f8eeae5 to fac2c9e Compare January 23, 2026 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants