Skip to content

chore: allow setting the wrapper sdk version & source id for open feature support #226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 30, 2025

Conversation

duyhungtnn
Copy link
Collaborator

@duyhungtnn duyhungtnn commented May 7, 2025

This PR supports explicitly setting the wrapper SDK version and source ID across the SDK.

Key Changes

  • Added sourceId and sdkVersion parameters to API client, event creator, and configuration methods (no longer hardcoded).
  • Rename SourceID to SourceId
  • Extended the SourceId enum with new IDs.
  • SourceId is now scoped as internal and no longer public. This will not introduce breaking changes, as it’s not used in any public interfaces.
  • Remove mock module. Use mock data directly in the test module.

@duyhungtnn duyhungtnn changed the title feat: allow set the proxy SourceId feat: allow set the wrapper SDK version & SourceID May 9, 2025
@duyhungtnn duyhungtnn requested a review from Copilot May 9, 2025 15:18
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for explicitly setting the wrapper SDK version and source ID across the SDK. Key changes include:

  • Propagating the new sourceId and sdkVersion parameters in API client, event creation, configuration, and dependency injection.
  • Updating tests and helper functions to validate and exercise the new parameters.
  • Extending the SourceID enum with additional values for various platforms.

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
bucketeer/src/test/kotlin/io/bucketeer/sdk/android/internal/remote/ApiClientImplTest.kt Updated tests to pass new sourceId and sdkVersion values.
bucketeer/src/test/kotlin/io/bucketeer/sdk/android/internal/event/EventInteractorTest.kt Added sourceId and sdkVersion parameters in event interactor instantiation.
bucketeer/src/test/kotlin/io/bucketeer/sdk/android/internal/event/EventCreatorsKtTest.kt Updated event creator test cases with new parameter assertions.
bucketeer/src/test/kotlin/io/bucketeer/sdk/android/internal/event/BKTExceptionToEventDataMetricEventTest.kt Modified expected sourceId and sdkVersion in metric event tests.
bucketeer/src/test/kotlin/io/bucketeer/sdk/android/TestHelpers.kt Injected new sourceId and sdkVersion in test helper functions.
bucketeer/src/test/kotlin/io/bucketeer/sdk/android/LoggerHolderTest.kt Added a call to LoggerHolder.clearLoggers in the test to avoid concurrency issues.
bucketeer/src/test/kotlin/io/bucketeer/sdk/android/BKTConfigTest.kt Introduced tests validating the wrapper SDK source ID and version behavior.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/internal/remote/ApiClientImpl.kt Updated the API client to accept and propagate the new parameters.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/internal/model/request/GetEvaluationsRequest.kt Removed default values and required passing sourceId and sdkVersion explicitly.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/internal/model/SourceID.kt Extended SourceID with additional platform values.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/internal/logger.kt Added a clearLoggers() method to allow cleanup of registered loggers.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/internal/event/EventInteractor.kt Propagated new parameters into event creation functions.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/internal/event/EventCreators.kt Updated all event creation functions to require sourceId and sdkVersion.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/internal/di/InteractorModule.kt Updated dependency injection to include sourceId and sdkVersion.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/internal/di/DataModule.kt Injected sourceId and sdkVersion from configuration into the data module.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/internal/di/Component.kt Updated component injection to pass sourceId and sdkVersion.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/BKTConfig.kt Extended the configuration and builder to support the new wrapper SDK properties.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/BKTClient.kt Added a call to LoggerHolder.clearLoggers() upon client destroy.

@duyhungtnn duyhungtnn requested a review from Copilot May 9, 2025 16:43
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces the ability to set the wrapper SDK version and sourceId throughout the SDK, updating both production and test code. Key changes include:

  • Adding sourceId and sdkVersion parameters to API client, event creator, and configuration methods.
  • Updating tests to supply the new sourceId and sdkVersion values.
  • Extending the SourceID enum with new identifiers and adjusting the dependency injection setup accordingly.

Reviewed Changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
bucketeer/src/test/kotlin/io/bucketeer/sdk/android/internal/remote/ApiClientImplTest.kt Updated tests to verify API calls with new sourceId and sdkVersion parameters.
bucketeer/src/test/kotlin/io/bucketeer/sdk/android/internal/event/EventInteractorTest.kt Refactored event tests to use config-based sourceId and sdkVersion.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/BKTConfig.kt Modified configuration builder to incorporate wrapper SDK parameters and resolve sourceId/sdVersion.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/internal/model/SourceID.kt Extended the SourceID enum with additional values for new SDK integrations.
Other files across the codebase Adjusted constructors, DI modules, and event creators to handle the new parameters.

@duyhungtnn duyhungtnn marked this pull request as ready for review May 10, 2025 14:46
@duyhungtnn duyhungtnn requested a review from cre8ivejp May 10, 2025 17:07
@duyhungtnn
Copy link
Collaborator Author

@cre8ivejp please help me to take a look

@duyhungtnn duyhungtnn requested a review from Copilot May 12, 2025 03:55
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces configurable wrapper SDK version and source ID functionality by adding sourceId and sdkVersion parameters to API client, event creation, and configuration methods. It also extends the internal SourceID enum with new entries and fixes a memory leak in LoggerHolder.

Reviewed Changes

Copilot reviewed 35 out of 35 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/internal/remote/ApiClientImpl.kt Updated API calls to pass sourceId and sdkVersion.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/internal/remote/ApiClient.kt Changed interface visibility to internal.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/internal/model/request/RegisterEventsRequest.kt Made sourceId and sdkVersion required parameters.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/internal/model/request/GetEvaluationsRequest.kt Made sourceId and sdkVersion required parameters.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/internal/model/jsonadapter/SourceIDAdapter.kt Changed class visibility to internal.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/internal/model/SourceID.kt Extended the SourceID enum with additional wrapper IDs.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/internal/logger.kt Added clearLoggers() to clear registered log handlers.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/internal/event/EventInteractor.kt Updated event creation calls to include sourceId and sdkVersion.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/internal/event/EventCreators.kt Updated event creator functions to replace hardcoded sourceId and sdkVersion.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/internal/di/* Updated dependency injection modules to pass sourceId and sdkVersion.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/BKTConfig.kt Revised configuration builder with options for wrapperSdkSourceId and wrapperSdkVersion, with resolution logic.
bucketeer/src/main/kotlin/io/bucketeer/sdk/android/BKTClient.kt Ensured loggers are cleared during client destroy.
bucketeer/src/androidTest/kotlin/io/bucketeer/sdk/android/e2e/* Added tests verifying events correctly include the new sourceId and sdkVersion properties.
bucketeer/build.gradle Removed an unused test dependency.
Comments suppressed due to low confidence (1)

bucketeer/src/main/kotlin/io/bucketeer/sdk/android/BKTConfig.kt:150

  • [nitpick] It may be beneficial to add a more detailed documentation comment for the resolveSourceIdAndSdkVersion, resolveSdkSourceId, and resolveSdkVersion functions to clarify the resolution policy for unsupported wrapper SDK source IDs.
val (sourceId, sdkVersion) = resolveSourceIdAndSdkVersion(...

feat: allow set the proxy SourceId

chore: typo correct

fix: lint fail

feat: add SDK version support to the config

chore: added comment about wrapperSDKVersion

feat: allow set the wrapper SDK version & SourceID
@duyhungtnn duyhungtnn force-pushed the feat/proxy-source-id branch from 0cfe6e1 to 8452ec9 Compare May 14, 2025 06:51
@duyhungtnn duyhungtnn marked this pull request as ready for review May 14, 2025 07:00
@duyhungtnn
Copy link
Collaborator Author

@cre8ivejp its ready, please help me to take a look

@duyhungtnn duyhungtnn self-assigned this May 14, 2025
OPEN_FEATURE_SWIFT(101),
OPEN_FEATURE_JAVASCRIPT(102),
OPEN_FEATURE_GO(103),
OPEN_FEATURE_NODEJS(104),
Copy link
Member

Choose a reason for hiding this comment

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

We changed this. Please update the android PR, too.

Suggested change
OPEN_FEATURE_NODEJS(104),
OPEN_FEATURE_NODE(104),

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@@ -1,6 +1,6 @@
package io.bucketeer.sdk.android.internal.model

enum class SourceID(
internal enum class SourceID(
Copy link
Member

Choose a reason for hiding this comment

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

I know that Go uses ID for naming convention, but for Kotlin too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no, I don't think so. But it was like that a long time ago and I kept it as is.
As its internal enum. Let's me change it to Id

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated 587f618

@duyhungtnn duyhungtnn requested a review from cre8ivejp May 14, 2025 10:16
@duyhungtnn duyhungtnn changed the title feat: allow set the wrapper SDK version & SourceID feat: allow set the wrapper SDK version & SourceId May 14, 2025
@duyhungtnn duyhungtnn marked this pull request as draft May 26, 2025 08:23
Copy link
Member

@cre8ivejp cre8ivejp left a comment

Choose a reason for hiding this comment

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

Thank you!

@cre8ivejp cre8ivejp changed the title feat: allow set the wrapper SDK version & SourceId chore: allow setting the wrapper sdk version & source id for open feature support May 30, 2025
@cre8ivejp cre8ivejp marked this pull request as ready for review May 30, 2025 08:04
@cre8ivejp cre8ivejp merged commit 7c02cc0 into main May 30, 2025
5 checks passed
@cre8ivejp cre8ivejp deleted the feat/proxy-source-id branch May 30, 2025 08:04
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.

3 participants