feat(events,server): ExecutionPlanRejectedEvent — freestyle compile failure visible in log
Both silent-failure branches in FreestyleDriver.lockAndRun now emit ExecutionPlanRejectedEvent (source=compile or missing_content) before returning, satisfying invariant #1. Event registered in eventModule for correct polymorphic serialization.
This commit is contained in:
@@ -20,3 +20,17 @@ data class ExecutionPlanLockedEvent(
|
||||
val stageIds: List<String>,
|
||||
val startStageId: String,
|
||||
) : EventPayload
|
||||
|
||||
/**
|
||||
* The architect's execution_plan could not become the phase-2 graph: content missing,
|
||||
* compile/validation failure, or operator rejection at the plan-review gate. Terminal for
|
||||
* the freestyle run unless re-planned; recorded so replay explains why phase 2 never ran.
|
||||
*/
|
||||
@Serializable
|
||||
@SerialName("ExecutionPlanRejected")
|
||||
data class ExecutionPlanRejectedEvent(
|
||||
val sessionId: SessionId,
|
||||
val reason: String,
|
||||
/** "compile" | "missing_content" | "operator" */
|
||||
val source: String,
|
||||
) : EventPayload
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.correx.core.events.events.SessionWorkspaceBoundEvent
|
||||
import com.correx.core.events.events.ContextTruncatedEvent
|
||||
import com.correx.core.events.events.EventPayload
|
||||
import com.correx.core.events.events.ExecutionPlanLockedEvent
|
||||
import com.correx.core.events.events.ExecutionPlanRejectedEvent
|
||||
import com.correx.core.events.events.JournalCompactedEvent
|
||||
import com.correx.core.events.events.FileWrittenEvent
|
||||
import com.correx.core.events.events.L3MemoryRetrievedEvent
|
||||
@@ -102,6 +103,7 @@ val eventModule = SerializersModule {
|
||||
subclass(L3MemoryRetrievedEvent::class)
|
||||
subclass(ContextTruncatedEvent::class)
|
||||
subclass(ExecutionPlanLockedEvent::class)
|
||||
subclass(ExecutionPlanRejectedEvent::class)
|
||||
subclass(JournalCompactedEvent::class)
|
||||
}
|
||||
}
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.correx.core.events.serialization
|
||||
|
||||
import com.correx.core.events.events.EventPayload
|
||||
import com.correx.core.events.events.ExecutionPlanRejectedEvent
|
||||
import com.correx.core.events.types.SessionId
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class ExecutionPlanRejectedEventSerializationTest {
|
||||
|
||||
@Test
|
||||
fun `ExecutionPlanRejectedEvent round-trips as polymorphic EventPayload`() {
|
||||
val sample: EventPayload = ExecutionPlanRejectedEvent(
|
||||
sessionId = SessionId("s"),
|
||||
reason = "plan failed to compile: Unknown artifact kind",
|
||||
source = "compile",
|
||||
)
|
||||
val encoded = eventJson.encodeToString(EventPayload.serializer(), sample)
|
||||
assertTrue(encoded.contains("\"type\":\"ExecutionPlanRejected\""), "SerialName must be present: $encoded")
|
||||
val decoded = eventJson.decodeFromString(EventPayload.serializer(), encoded)
|
||||
assertEquals(sample, decoded)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user