feat(transitions): tasks_ready predicate for execution loop
New TasksReady condition driven by EvaluationContext.readyTaskCount, fed at resolve time via a kernel-declared ReadyTaskCounter interface implemented in apps/server over TaskService (keeps core:kernel decoupled from core:tasks). Loops a graph while ready>0, exits at 0.
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
package com.correx.core.transitions.conditions
|
||||
|
||||
import com.correx.core.transitions.evaluation.EvaluationContext
|
||||
import com.correx.core.transitions.graph.TransitionCondition
|
||||
|
||||
/** True while the session's project still has tasks ready to claim — the execution loop's gate. */
|
||||
object TasksReady : TransitionCondition {
|
||||
override fun evaluate(context: EvaluationContext) = context.readyTaskCount > 0
|
||||
}
|
||||
+1
@@ -11,4 +11,5 @@ data class EvaluationContext(
|
||||
val artifacts: Map<ArtifactId, ArtifactState> = emptyMap(),
|
||||
val variables: Map<String, String> = emptyMap(),
|
||||
val artifactContent: Map<ArtifactId, String> = emptyMap(),
|
||||
val readyTaskCount: Int = 0,
|
||||
)
|
||||
|
||||
+12
@@ -30,6 +30,18 @@ class TransitionConditionTest {
|
||||
assertTrue(AlwaysTrue.evaluate(baseContext))
|
||||
}
|
||||
|
||||
// TasksReady
|
||||
|
||||
@Test
|
||||
fun `TasksReady true when ready count positive`() {
|
||||
assertTrue(TasksReady.evaluate(baseContext.copy(readyTaskCount = 1)))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `TasksReady false when no ready tasks`() {
|
||||
assertFalse(TasksReady.evaluate(baseContext))
|
||||
}
|
||||
|
||||
// ArtifactPresent
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user