Skip to content
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

Merged
merged 17 commits into from
May 7, 2024

Conversation

vahidlazio
Copy link
Contributor

No description provided.

@vahidlazio vahidlazio marked this pull request as ready for review April 29, 2024 16:05
@nicklasl
Copy link
Member

nicklasl commented May 2, 2024

When we merge this we need to include that it is a breaking change.

@nicklasl nicklasl changed the title refactor: split the confidence module to a new module refactor!: split the confidence module to a new module May 2, 2024
@@ -10,7 +10,8 @@
"extra-files": [
Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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")

Copy link
Member

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.


val providerVersion = project.extra["version"].toString()

object Versions {
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

exactly.

Copy link
Member

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?

Copy link
Contributor Author

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")),
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

Comment on lines +53 to +58
if(confidence.isStorageEmpty()) {
confidence.fetchAndActivate()
} else {
confidence.activate()
confidence.asyncFetch()
}
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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() {
Copy link
Member

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?

Copy link
Contributor Author

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")),
Copy link
Member

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.

Comment on lines +53 to +58
if(confidence.isStorageEmpty()) {
confidence.fetchAndActivate()
} else {
confidence.activate()
confidence.asyncFetch()
}
Copy link
Member

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
Copy link
Member

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.

Copy link
Contributor Author

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.


val providerVersion = project.extra["version"].toString()

object Versions {
Copy link
Member

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?

pom {
name.set("Confidence SDK Android")
description.set("Android SDK for Confidence")
url.set("https://github.com/spotify/confidence-openfeature-provider-kotlin")
Copy link
Member

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.

Copy link
Contributor Author

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"
Copy link
Member

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)?

Copy link
Contributor Author

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?

Copy link
Member

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

Copy link
Contributor Author

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.

fabriziodemaria
fabriziodemaria previously approved these changes May 7, 2024
@vahidlazio
Copy link
Contributor Author

@fabriziodemaria I added awaitReconciliation function + an extension named awaitPutContext. I think that fixes the issue.

@vahidlazio vahidlazio merged commit ebe2733 into main May 7, 2024
2 checks passed
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