fix(validation): resolve F-007 artifact validator CAS-hash conflation

ArtifactPayloadValidator passed the logical slot name into the
content-hash-keyed CAS store, crashing every workflow with a typed
produces slot. Validator now reads payloads from a content map threaded
through ValidationContext (populated from the orchestrator's per-session
artifact cache across all stages) and no longer depends on ArtifactStore.

Also records the slot->CAS-hash mapping as a new ArtifactContentStoredEvent
(registered for serialization), emitted at both CAS write sites, so
artifact content is recoverable from CAS by hash after a cold start.
This commit is contained in:
2026-06-08 17:26:34 +04:00
parent 3f59faaa08
commit d518400b5f
7 changed files with 206 additions and 13 deletions
@@ -30,3 +30,12 @@ data class ArtifactCreatedEvent(
val stageId: StageId,
val schemaVersion: Int,
) : EventPayload
@Serializable
@SerialName("ArtifactContentStored")
data class ArtifactContentStoredEvent(
val artifactId: ArtifactId,
val contentHash: ArtifactId, // CAS content hash returned by ArtifactStore.put(...)
val sessionId: SessionId,
val stageId: StageId,
) : EventPayload
@@ -4,6 +4,7 @@ import com.correx.core.events.events.ApprovalDecisionResolvedEvent
import com.correx.core.events.events.ApprovalGrantCreatedEvent
import com.correx.core.events.events.ApprovalGrantExpiredEvent
import com.correx.core.events.events.ApprovalRequestedEvent
import com.correx.core.events.events.ArtifactContentStoredEvent
import com.correx.core.events.events.ArtifactCreatedEvent
import com.correx.core.events.events.ArtifactValidatedEvent
import com.correx.core.events.events.ArtifactValidatingEvent
@@ -70,6 +71,7 @@ val eventModule = SerializersModule {
subclass(ApprovalDecisionResolvedEvent::class)
subclass(ApprovalGrantCreatedEvent::class)
subclass(ApprovalGrantExpiredEvent::class)
subclass(ArtifactContentStoredEvent::class)
subclass(ArtifactCreatedEvent::class)
subclass(ArtifactValidatingEvent::class)
subclass(ArtifactValidatedEvent::class)