Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = false
insert_final_newline = true
max_line_length = 100
tab_width = 4
ij_continuation_indent_size = 8
Expand Down
2 changes: 1 addition & 1 deletion Confidence/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ kover {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ enum class ResolveReason {
RESOLVE_REASON_FLAG_ARCHIVED,
DEFAULT,
ERROR
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -417,4 +417,4 @@ object ConfidenceFactory {
suspend fun Confidence.awaitPutContext(context: Map<String, ConfidenceValue>) {
putContext(context)
awaitReconciliation()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ interface Contextual : ConfidenceContextProvider {
* @param keys keys of the context to be removed.
*/
fun removeContext(keys: Collection<String>)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,4 @@ private fun PackageInfo.getVersionCodeAsString(): String =
} else {
@Suppress("DEPRECATION")
this.versionCode.toString()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ class ConfidenceError {
) : Error(message)

class InvalidContextInMessage : Error("Field 'context' is not allowed in event's data")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@ private data class FlagKey(
)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ internal val minBatchSizeFlushPolicy = object : FlushPolicy {
override fun shouldFlush(): Boolean {
return size > 4
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ sealed interface ConfidenceValue {
}

fun ConfidenceValue.Struct.toNetworkJson() =
Json.encodeToString(NetworkConfidenceValueSerializer, this)
Json.encodeToString(NetworkConfidenceValueSerializer, this)
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ enum class LoggingLevel {
WARN, // 2
ERROR, // 3
NONE // 4
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ internal interface FlushPolicy {
fun reset()
fun hit(event: EngineEvent)
fun shouldFlush(): Boolean
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,4 @@ internal class EventSenderEngineImpl(
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ internal class EventSenderUploaderImpl(
companion object {
const val BASE_URL = "https://events.confidence.dev/v1/events:publish"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@ internal class EventStorageImpl(
}
}

internal fun File.walkFiles() = walk().filter { !it.isDirectory }
internal fun File.walkFiles() = walk().filter { !it.isDirectory }
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ data class FlagResolution(
sealed class Result<out T> {
data class Success<T>(val data: T) : Result<T>()
data class Failure(val error: Throwable = Throwable()) : Result<Nothing>()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ class InMemoryCache : ProviderCache {
}

override fun get(): FlagResolution? = this.flagResolution
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ internal object ManualFlushPolicy : FlushPolicy {
}

override fun shouldFlush(): Boolean = flushRequested
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ internal object NetworkConfidenceValueSerializer : KSerializer<ConfidenceValue>
)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ internal class PayloadMergerImpl : PayloadMerger {
}
return message + (mapOf("context" to ConfidenceValue.Struct(context)))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ sealed interface Update {
interface Producer {
fun stop()
fun updates(): Flow<Update>
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ private data class ResolveFlagsRequest(
val clientSecret: String,
val apply: Boolean,
val sdk: Sdk
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ internal object VisitorUtil {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ class EventProcessor<INPUT, BatchProcessInputs, DATA>(
writeRequestChannel.send(input)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package com.spotify.confidence.apply

interface FlagApplier {
fun apply(flagName: String, resolveToken: String)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,4 @@ private fun putIfAbsent(map: MutableMap<String, ApplyInstance>?, key: String, va
if (!map.containsKey(key)) {
map[key] = value
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ interface DiskStorage {
fun clear()
fun writeApplyData(applyData: Map<String, MutableMap<String, ApplyInstance>>)
fun readApplyData(): MutableMap<String, MutableMap<String, ApplyInstance>>
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ internal class FileDiskStorage internal constructor(
)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ interface Clock {
timeZone = TimeZone.getTimeZone("UTC")
}.time
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ internal class ContinuationCallback(
call.cancel()
} catch (_: Throwable) {}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import com.spotify.confidence.Result

interface FlagApplierClient {
suspend fun apply(flags: List<AppliedFlag>, resolveToken: String): Result<Unit>
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ internal class FlagApplierClientImpl : FlagApplierClient {

return result
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ sealed class ResolveResponse {
data class SdkMetadata(val sdkId: String, val sdkVersion: String)

typealias ConfidenceValueMap =
Map<String, @Serializable(ConfidenceValueSerializer::class) ConfidenceValue>
Map<String, @Serializable(ConfidenceValueSerializer::class) ConfidenceValue>
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ internal data class ApplyFlagsRequest(
val clientSecret: String,
val resolveToken: String,
val sdk: Sdk
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,4 @@ internal object DateSerializer : KSerializer<Date> {
dateFormatter.parse(this)
?: throw IllegalArgumentException("unable to parse $this")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@ class ConfidenceContextualTests {
eventSender.removeContext("screen")
Assert.assertTrue(!eventSender.getContext().containsKey("screen"))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1169,4 +1169,4 @@ private const val cacheFileData = "{\n" +
" \"eventStatus\": \"CREATED\"\n" +
" }\n" +
" }\n" +
"}\n"
"}\n"
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ class ConfidenceIntegrationTests {
Assert.assertEquals(ResolveReason.RESOLVE_REASON_MATCH, intDetails.reason)
Assert.assertNotNull(intDetails.variant)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ class ConfidenceProducerIntegrationTest {

confidence.stop()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -818,4 +818,4 @@ internal class ConfidenceRemoteClientTests {

assertTrue(result is Result.Failure)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ class DateSerializersTest {
val deserializedDate = Json.decodeFromString(com.spotify.confidence.serializers.DateTimeSerializer, serializedDate)
Assert.assertTrue(deserializedDate == now)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ internal open class DebugLoggerFake : DebugLogger {
}

data class Msg(val message: String, val isWarning: Boolean, val throwable: Throwable?)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,4 @@ class DebugLoggerImplTest {
noneLogger.logMessage("Error msg", throwable = Error("my error"))
verify(inverse = true) { Log.e("Confidence", "Error msg: my error") }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,4 @@ class DebugLoggerIntegrationTest {
decodedJson
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -353,4 +353,4 @@ class EventSenderIntegrationTest {
Assert.assertEquals(1, uploader.requests.size)
Assert.assertEquals(2, uploader.requests[0].events.size)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,4 @@ class FileDiskStorageTest {
val result = diskStorage.read()
Assert.assertEquals(FlagResolution.EMPTY, result)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,4 @@ internal class FlagResolveNetworkIntegrationTest {
assertEquals(ConfidenceValue.Integer(400), struct.map["int_property"])
assertEquals(ConfidenceValue.Null, struct.map["bool_property"])
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@ internal class InMemorySharedPreferences : SharedPreferences {
override fun unregisterOnSharedPreferenceChangeListener(p0: SharedPreferences.OnSharedPreferenceChangeListener?) {
TODO("Not yet implemented")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ class PayloadMergerTest {
)
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@ class StorageFileCacheTests {
region = ConfidenceRegion.EUROPE,
debugLogger = debugLogger
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ class FakeDiskStorage() : DiskStorage {
override fun readApplyData(): MutableMap<String, MutableMap<String, ApplyInstance>> {
return emptyMap<String, MutableMap<String, ApplyInstance>>().toMutableMap()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ class FakeEventSenderEngine() : EventSenderEngine {

override fun stop() {
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ class FakeFlagApplierClient : FlagApplierClient {
override suspend fun apply(flags: List<AppliedFlag>, resolveToken: String): Result<Unit> {
TODO("Not yet implemented")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class FakeFlagResolver : FlagResolver {
override suspend fun resolve(flags: List<String>, context: Map<String, ConfidenceValue>): Result<FlagResolution> {
TODO("Not yet implemented")
}
}
}
2 changes: 1 addition & 1 deletion Provider/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,4 @@ kover {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,4 @@ fun EvaluationContext.toConfidenceContext(): ConfidenceValue.Struct {
map["targeting_key"] = ConfidenceValue.String(getTargetingKey())
map.putAll(asMap().mapValues { it.value.toConfidenceValue() })
return ConfidenceValue.Struct(map)
}
}
Loading
Loading