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
@@ -19,7 +19,7 @@ class DefaultTransitionResolverTest {
private val evaluator = object : TransitionConditionEvaluator {
override fun evaluate(
condition: TransitionCondition,
context: EvaluationContext
context: EvaluationContext,
): Boolean {
return condition.evaluate(context)
}
@@ -36,20 +36,20 @@ class DefaultTransitionResolverTest {
id = "t1",
from = "stage-a",
to = "stage-b",
condition = alwaysTrue()
)
condition = alwaysTrue(),
),
),
stages = setOf("stage-a", "stage-b")
stages = setOf("stage-a", "stage-b"),
)
val result = resolver.resolve(
graph = graph,
context = context(currentStage = "stage-b")
context = context(currentStage = "stage-b"),
)
assertEquals(
TransitionDecision.NoMatch,
result
result,
)
}
@@ -62,19 +62,19 @@ class DefaultTransitionResolverTest {
id = "t1",
from = "stage-a",
to = "stage-b",
condition = alwaysFalse()
)
)
condition = alwaysFalse(),
),
),
)
val result = resolver.resolve(
graph = graph,
context = context(currentStage = "stage-a")
context = context(currentStage = "stage-a"),
)
assertEquals(
TransitionDecision.Stay,
result
result,
)
}
@@ -87,26 +87,26 @@ class DefaultTransitionResolverTest {
id = "t1",
from = "stage-a",
to = "stage-b",
condition = alwaysTrue()
)
)
condition = alwaysTrue(),
),
),
)
val result = resolver.resolve(
graph = graph,
context = context(currentStage = "stage-a")
context = context(currentStage = "stage-a"),
)
val move = assertInstanceOf<TransitionDecision.Move>(result)
assertEquals(
TransitionId("t1"),
move.transitionId
move.transitionId,
)
assertEquals(
StageId("stage-b"),
move.to
move.to,
)
}
@@ -119,32 +119,32 @@ class DefaultTransitionResolverTest {
id = "t2",
from = "stage-a",
to = "stage-c",
condition = alwaysTrue()
condition = alwaysTrue(),
),
edge(
id = "t1",
from = "stage-a",
to = "stage-b",
condition = alwaysTrue()
)
)
condition = alwaysTrue(),
),
),
)
val result = resolver.resolve(
graph = graph,
context = context(currentStage = "stage-a")
context = context(currentStage = "stage-a"),
)
val move = assertInstanceOf<TransitionDecision.Move>(result)
assertEquals(
TransitionId("t1"),
move.transitionId
move.transitionId,
)
assertEquals(
StageId("stage-b"),
move.to
move.to,
)
}
@@ -157,27 +157,27 @@ class DefaultTransitionResolverTest {
id = "t1",
from = "stage-x",
to = "stage-y",
condition = alwaysTrue()
condition = alwaysTrue(),
),
edge(
id = "t2",
from = "stage-a",
to = "stage-b",
condition = alwaysTrue()
)
)
condition = alwaysTrue(),
),
),
)
val result = resolver.resolve(
graph = graph,
context = context(currentStage = "stage-a")
context = context(currentStage = "stage-a"),
)
val move = assertInstanceOf<TransitionDecision.Move>(result)
assertEquals(
TransitionId("t2"),
move.transitionId
move.transitionId,
)
}
@@ -185,24 +185,25 @@ class DefaultTransitionResolverTest {
id: String,
from: String,
to: String,
condition: TransitionCondition
condition: TransitionCondition,
): TransitionEdge {
return TransitionEdge(
id = TransitionId(id),
from = StageId(from),
to = StageId(to),
condition = condition
condition = condition,
)
}
private fun graph(
start: String,
transitions: Set<TransitionEdge>,
stages: Set<String> = transitions.flatMap { listOf(it.from.value, it.to.value) }.toSet()
stages: Set<String> = transitions.flatMap { listOf(it.from.value, it.to.value) }.toSet(),
) = WorkflowGraph(
id = "workflow-test",
start = StageId(start),
stages = stages.associate { StageId(it) to StageConfig() },
transitions = transitions
transitions = transitions,
)
private fun context(
@@ -222,4 +223,4 @@ class DefaultTransitionResolverTest {
@Suppress("UnusedPrivateMember")
private fun alwaysFalse() =
TransitionCondition { false }
}
}
@@ -69,4 +69,4 @@ class TransitionEventSerializationTest {
assertEquals(event, deserialized)
}
}
}