test(server): bind workspace in contradiction hook fixture (#266)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user