feat(kernel): retried stages receive explicit failure feedback; default retry backoff 1s
This commit is contained in:
+2
-2
@@ -28,9 +28,9 @@ class RetryPolicyTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `backoffMs defaults to zero`() {
|
||||
fun `backoffMs defaults to one second`() {
|
||||
val policy = RetryPolicy(maxAttempts = 1)
|
||||
assertEquals(0L, policy.backoffMs)
|
||||
assertEquals(1_000L, policy.backoffMs)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,13 +1,47 @@
|
||||
import com.correx.core.context.model.ContextLayer
|
||||
import com.correx.core.context.model.EntryRole
|
||||
import com.correx.core.events.events.RetryAttemptedEvent
|
||||
import com.correx.core.events.types.SessionId
|
||||
import com.correx.core.events.types.StageId
|
||||
import com.correx.core.kernel.orchestration.buildProjectProfileEntry
|
||||
import com.correx.core.kernel.orchestration.buildRetryFeedbackEntry
|
||||
import com.correx.core.sessions.BoundProjectProfile
|
||||
import com.correx.testing.fixtures.EventFixtures.stored
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Assertions.assertNull
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class ContextFeedbackTest {
|
||||
|
||||
@Test
|
||||
fun `no retry events yields null`() {
|
||||
assertNull(buildRetryFeedbackEntry(emptyList(), StageId("impl")))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `latest retry event for the stage becomes a labeled L1 system entry`() {
|
||||
val events = listOf(
|
||||
stored(payload = RetryAttemptedEvent(SessionId("s"), StageId("impl"), 1, 3, "old reason")),
|
||||
stored(payload = RetryAttemptedEvent(SessionId("s"), StageId("other"), 1, 3, "other stage")),
|
||||
stored(payload = RetryAttemptedEvent(SessionId("s"), StageId("impl"), 2, 3, "tests failed: NPE in FooTest")),
|
||||
)
|
||||
val entry = buildRetryFeedbackEntry(events, StageId("impl"))!!
|
||||
assertEquals("retryFeedback", entry.sourceType)
|
||||
assertEquals(ContextLayer.L1, entry.layer)
|
||||
assertEquals(EntryRole.SYSTEM, entry.role)
|
||||
assertTrue(entry.content.contains("Attempt 2 of 3"), "content: ${entry.content}")
|
||||
assertTrue(entry.content.contains("tests failed: NPE in FooTest"), "content: ${entry.content}")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `retry entry for other stage is not returned for queried stage`() {
|
||||
val events = listOf(
|
||||
stored(payload = RetryAttemptedEvent(SessionId("s"), StageId("other"), 1, 3, "reason")),
|
||||
)
|
||||
assertNull(buildRetryFeedbackEntry(events, StageId("impl")))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `project profile renders as single L0 entry`() {
|
||||
val entry = buildProjectProfileEntry(
|
||||
|
||||
Reference in New Issue
Block a user