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:
+1
-1
@@ -31,4 +31,4 @@ internal class CycleExtractor(
|
||||
|
||||
return canonicalize(cycles)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -6,4 +6,4 @@ import com.correx.core.transitions.graph.TransitionEdge
|
||||
data class DetectedCycle(
|
||||
val nodes: List<StageId>,
|
||||
val edges: List<TransitionEdge>
|
||||
)
|
||||
)
|
||||
|
||||
+1
-1
@@ -18,4 +18,4 @@ internal class DeterministicAdjacencyBuilder {
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -33,4 +33,4 @@ internal object CycleCanonicalizer {
|
||||
}
|
||||
.sortedBy { it.nodes.first().value }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -10,4 +10,4 @@ data class EvaluationContext(
|
||||
val currentStage: StageId,
|
||||
val artifacts: Map<ArtifactId, ArtifactState> = emptyMap(),
|
||||
val variables: Map<String, String> = emptyMap(),
|
||||
)
|
||||
)
|
||||
|
||||
+1
-1
@@ -7,4 +7,4 @@ fun interface TransitionConditionEvaluator {
|
||||
condition: TransitionCondition,
|
||||
context: EvaluationContext
|
||||
): Boolean
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -9,4 +9,4 @@ sealed interface StageExecutionResult {
|
||||
val reason: String,
|
||||
val retryable: Boolean,
|
||||
) : StageExecutionResult
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ interface StageExecutor {
|
||||
fun execute(
|
||||
request: StageExecutionRequest
|
||||
): StageExecutionResult
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,4 +12,4 @@ internal fun WorkflowGraph.sortedTransitions(): List<TransitionEdge> =
|
||||
{ it.id.value },
|
||||
{ it.to.value }
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ import com.correx.core.transitions.evaluation.EvaluationContext
|
||||
|
||||
fun interface TransitionCondition {
|
||||
fun evaluate(context: EvaluationContext): Boolean
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -8,4 +8,4 @@ data class TransitionEdge(
|
||||
val from: StageId,
|
||||
val to: StageId,
|
||||
val condition: TransitionCondition
|
||||
)
|
||||
)
|
||||
|
||||
@@ -10,6 +10,7 @@ data class WorkflowGraph(
|
||||
) {
|
||||
val stageIds: Set<StageId> get() = stages.keys
|
||||
init {
|
||||
require(id.isNotBlank()) { "workflow id must not be blank" }
|
||||
require(start in stages) { "start stage must exist in stages" }
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -44,4 +44,4 @@ class DefaultStageExecutionEventMapper : StageExecutionEventMapper {
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -9,4 +9,4 @@ interface StageExecutionEventMapper {
|
||||
request: StageExecutionRequest,
|
||||
result: StageExecutionResult
|
||||
): List<EventPayload>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,4 +12,4 @@ sealed interface CyclePolicy {
|
||||
data class Approval(
|
||||
val timeoutMs: Long
|
||||
) : CyclePolicy
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@ package com.correx.core.transitions.policy
|
||||
data class CyclePolicyBinding(
|
||||
val cycle: CycleSignature,
|
||||
val policy: CyclePolicy
|
||||
)
|
||||
)
|
||||
|
||||
+1
-1
@@ -9,4 +9,4 @@ class CyclePolicyResolver(
|
||||
.firstOrNull { it.cycle == signature }
|
||||
?.policy
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -20,4 +20,4 @@ class PolicyValidation {
|
||||
|
||||
return errors
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -32,4 +32,4 @@ class DefaultTransitionResolver(
|
||||
}
|
||||
return TransitionDecision.Stay
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -17,4 +17,4 @@ sealed interface TransitionDecision {
|
||||
) : TransitionDecision
|
||||
|
||||
data object NoMatch : TransitionDecision
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,4 +7,4 @@ object TransitionOrdering {
|
||||
compareBy<TransitionEdge> { it.from.value }
|
||||
.thenBy { it.id.value }
|
||||
.thenBy { it.to.value }
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -8,4 +8,4 @@ interface TransitionResolver {
|
||||
graph: WorkflowGraph,
|
||||
context: EvaluationContext
|
||||
): TransitionDecision
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@ package com.correx.core.transitions.state
|
||||
internal enum class VisitState {
|
||||
VISITING,
|
||||
VISITED
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user