-
Notifications
You must be signed in to change notification settings - Fork 1
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
refactor!: split the confidence module to a new module #136
Conversation
When we merge this we need to include that it is a breaking change. |
@@ -10,7 +10,8 @@ | |||
"extra-files": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should figure out how to make Release please release confidence
vs provider
independently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means splitting into two packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can take this later though
@@ -1,5 +1,7 @@ | |||
import org.gradle.api.initialization.resolve.RepositoriesMode | |||
|
|||
include(":confidence") | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rootProject.name
in this file needs update.
confidence/build.gradle.kts
Outdated
|
||
val providerVersion = project.extra["version"].toString() | ||
|
||
object Versions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we want to keep these versions set in the project gradle file to share them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exactly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we leaving that to a separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes.
app.applicationContext, | ||
clientSecret, | ||
initialContext = mapOf("targeting_key" to ConfidenceValue.String("a98a4291-53b0-49d9-bae8-73d3f5da2070")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would love for us to move away from targeting_key
. Do we keep it for the flag rules in the backend expect it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. i think backend works without targeting key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, the backend doesn't require it, could be that the flag used in this example app requires that to be set though.
if(confidence.isStorageEmpty()) { | ||
confidence.fetchAndActivate() | ||
} else { | ||
confidence.activate() | ||
confidence.asyncFetch() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This signals to me that it would be nice to have an "entry function" for our users to perhaps pass a strategy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually think having control like this is simpler rather than understanding another concept like initializationStrategy, I believe most of the users will only use async fetch or activateAndFetch only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a total confidence onboarding I feel this is overkill and would like to have something simpler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, for sure, i would go only with fetchAndActivate.
} | ||
} | ||
|
||
fun activate() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a time when we do not want to activate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think no but confidence object is dumb. I prefer these actions to be explicit and set by the user and be mentioned in the user guide.
app.applicationContext, | ||
clientSecret, | ||
initialContext = mapOf("targeting_key" to ConfidenceValue.String("a98a4291-53b0-49d9-bae8-73d3f5da2070")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, the backend doesn't require it, could be that the flag used in this example app requires that to be set though.
if(confidence.isStorageEmpty()) { | ||
confidence.fetchAndActivate() | ||
} else { | ||
confidence.activate() | ||
confidence.asyncFetch() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a total confidence onboarding I feel this is overkill and would like to have something simpler.
@@ -0,0 +1,100 @@ | |||
package com.spotify.confidence.openfeature |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be in openfeature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we also have a integration test in OF which means we are also going to need the same fake.
confidence/build.gradle.kts
Outdated
|
||
val providerVersion = project.extra["version"].toString() | ||
|
||
object Versions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we leaving that to a separate PR?
confidence/build.gradle.kts
Outdated
pom { | ||
name.set("Confidence SDK Android") | ||
description.set("Android SDK for Confidence") | ||
url.set("https://github.com/spotify/confidence-openfeature-provider-kotlin") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update this and below links to the new repo name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I open a new PR to address changes regarding the change of repo name.
@@ -19,41 +20,69 @@ import kotlinx.coroutines.flow.drop | |||
import kotlinx.coroutines.launch | |||
import okhttp3.OkHttpClient | |||
|
|||
internal const val SDK_ID = "SDK_ID_KOTLIN_PROVIDER" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have a new SDK id for the Confidence SDK?
Also, how do we support both (one for provider and one for stand-alone SDK)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't. provider internally uses the confidence lib, so basically we have confidence. we can however send some metadata for the sdk which can be specified which environment user is using the confidence lib. it can be OF provider etc. wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use SDK_ID_KOTLIN_CONFIDENCE
(ref). I agree also on keeping SDK_ID_KOTLIN_PROVIDER
if it's used in the OF env
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to SDK_ID_KOTLIN_CONFIDENCE
, however this sdkmetadata is internal to confidence, users from public api shouldn't be able to set if from the outside. we can have a metadata of the environment in which confidence is used to send alongside with the id and version to the backend.
confidence/src/main/java/com/spotify/confidence/RemoteFlagResolver.kt
Outdated
Show resolved
Hide resolved
confidence/src/main/java/com/spotify/confidence/cache/FileDiskStorage.kt
Outdated
Show resolved
Hide resolved
Provider/src/main/java/com/spotify/confidence/openfeature/ConfidenceFeatureProvider.kt
Show resolved
Hide resolved
@fabriziodemaria I added |
No description provided.