chore(damn): detekt, build, tests, formatting

fixed detekt issues where possible.
fixed disttar failing build because tools is added twice in the server module.
added workflowId where required.
fixed some tests not being recognized because of runBlocking without explicit return type.
formatting + imports.
This commit is contained in:
2026-05-22 00:10:05 +04:00
parent 2c459da009
commit f827685ed0
185 changed files with 1134 additions and 832 deletions
@@ -13,4 +13,4 @@ data class StoredEvent(
val metadata: EventMetadata,
val sequence: Long,
val payload: EventPayload
)
)
@@ -15,4 +15,4 @@ data class EventMetadata(
val schemaVersion: Int,
val causationId: CausationId?,
val correlationId: CorrelationId?
)
)
@@ -3,4 +3,4 @@ package com.correx.core.events.events
import kotlinx.serialization.Serializable
@Serializable
sealed interface EventPayload
sealed interface EventPayload
@@ -60,4 +60,4 @@ data class ModelUnloadedEvent(
val providerId: ProviderId,
val sessionId: SessionId,
val cancellationReason: String? = null, // serialized label, not the sealed class
) : EventPayload
) : EventPayload
@@ -8,6 +8,7 @@ import kotlinx.serialization.Serializable
@Serializable
data class WorkflowStartedEvent(
val sessionId: SessionId,
val workflowId: String,
val startStageId: StageId,
val retryPolicy: RetryPolicy? = null,
) : EventPayload
@@ -17,6 +18,7 @@ data class WorkflowCompletedEvent(
val sessionId: SessionId,
val terminalStageId: StageId,
val totalStages: Int,
val workflowId: String,
) : EventPayload
@Serializable
@@ -47,4 +49,4 @@ data class RetryAttemptedEvent(
val attemptNumber: Int,
val maxAttempts: Int,
val failureReason: String,
) : EventPayload
) : EventPayload
@@ -5,4 +5,4 @@ import com.correx.core.events.events.EventPayload
interface EventSerializer {
fun serialize(payload: EventPayload): String
fun deserialize(raw: String): EventPayload
}
}
@@ -12,4 +12,4 @@ class JsonEventSerializer(
override fun deserialize(raw: String): EventPayload =
json.decodeFromString(EventPayload.serializer(), raw)
}
}
@@ -33,10 +33,10 @@ import com.correx.core.events.events.SessionFailedEvent
import com.correx.core.events.events.SessionPausedEvent
import com.correx.core.events.events.SessionResumedEvent
import com.correx.core.events.events.SessionStartedEvent
import com.correx.core.events.events.SteeringNoteAddedEvent
import com.correx.core.events.events.StageCompletedEvent
import com.correx.core.events.events.StageFailedEvent
import com.correx.core.events.events.StageStartedEvent
import com.correx.core.events.events.SteeringNoteAddedEvent
import com.correx.core.events.events.ToolExecutionCompletedEvent
import com.correx.core.events.events.ToolExecutionFailedEvent
import com.correx.core.events.events.ToolExecutionRejectedEvent
@@ -106,4 +106,4 @@ val eventModule = SerializersModule {
val eventJson = Json {
serializersModule = eventModule
}
}
@@ -47,4 +47,4 @@ interface EventStore {
* Intended for batch jobs (e.g. CAS liveness scans). Implementations should stream lazily.
*/
fun allEvents(): Sequence<StoredEvent>
}
}
@@ -39,4 +39,4 @@ typealias ToolInvocationId = TypeId
// Inference
typealias InferenceRequestId = TypeId
typealias ProviderId = TypeId
typealias ProviderId = TypeId
@@ -8,4 +8,4 @@ data class TokenUsage(
val completionTokens: Int,
) {
val totalTokens: Int get() = promptTokens + completionTokens
}
}
@@ -11,4 +11,4 @@ class DefaultStateBuilder<S>(
projection.apply(state, event)
}
}
}
}
@@ -7,4 +7,4 @@ interface Projection<S> {
fun initial(): S
fun apply(state: S, event: StoredEvent): S
}
}
@@ -4,4 +4,4 @@ import com.correx.core.events.events.StoredEvent
interface StateBuilder<S> {
fun build(events: List<StoredEvent>): S
}
}
@@ -16,4 +16,4 @@ class DefaultEventReplayer<S>(
return DefaultStateBuilder(projection)
.build(events)
}
}
}
@@ -4,4 +4,4 @@ import com.correx.core.events.types.SessionId
interface EventReplayer<S> {
fun rebuild(sessionId: SessionId): S
}
}
@@ -11,4 +11,4 @@ value class TypeId(val value: String) {
}
override fun toString(): String = value
}
}