test(server): bind workspace in contradiction hook fixture (#266)

This commit is contained in:
kami
2026-07-21 02:13:05 +04:00
parent a2bf976a13
commit 119f59d637
@@ -15,6 +15,7 @@ import com.correx.core.events.events.EventMetadata
import com.correx.core.events.events.EventPayload
import com.correx.core.events.events.NewEvent
import com.correx.core.events.events.PossibleContradictionFlaggedEvent
import com.correx.core.events.events.SessionWorkspaceBoundEvent
import com.correx.core.events.stores.EventStore
import com.correx.core.events.types.ArtifactId
import com.correx.core.events.types.EventId
@@ -120,6 +121,11 @@ class ArchitectContradictionHookTest {
score = score,
)
private fun bindWorkspace(es: EventStore) = append(
es,
SessionWorkspaceBoundEvent(session, workspaceRoot = "/repo", allowedPaths = listOf("/repo")),
)
private fun flagsIn(es: EventStore): List<PossibleContradictionFlaggedEvent> =
es.read(session).map { it.payload }.filterIsInstance<PossibleContradictionFlaggedEvent>()
@@ -219,6 +225,7 @@ class ArchitectContradictionHookTest {
val es = InMemoryEventStore()
val designJson = """{"approach":"Use Postgres for the event store.","components":["db.kt"]}"""
val artifacts = MapArtifactStore(mapOf(contentHash.value to designJson.toByteArray()))
bindWorkspace(es)
// ArtifactContentStored precedes ArtifactCreated for the same artifactId (inference-time).
append(es, ArtifactContentStoredEvent(designArtifact, contentHash, session, architectStage))
val created = ArtifactCreatedEvent(designArtifact, session, architectStage, schemaVersion = 1)
@@ -247,6 +254,7 @@ class ArchitectContradictionHookTest {
val es = InMemoryEventStore()
val designJson = """{"approach":"Use Postgres for the event store.","components":["db.kt"]}"""
val artifacts = MapArtifactStore(mapOf(contentHash.value to designJson.toByteArray()))
bindWorkspace(es)
append(es, ArtifactContentStoredEvent(designArtifact, contentHash, session, architectStage))
val created = ArtifactCreatedEvent(designArtifact, session, architectStage, schemaVersion = 1)
append(es, created)