feat(server,kernel): bind ProjectProfile per session and inject as L0 context
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import com.correx.core.context.model.ContextLayer
|
||||
import com.correx.core.context.model.EntryRole
|
||||
import com.correx.core.kernel.orchestration.buildProjectProfileEntry
|
||||
import com.correx.core.sessions.BoundProjectProfile
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class ContextFeedbackTest {
|
||||
|
||||
@Test
|
||||
fun `project profile renders as single L0 entry`() {
|
||||
val entry = buildProjectProfileEntry(
|
||||
BoundProjectProfile(
|
||||
about = "Event-sourced kernel",
|
||||
conventions = listOf("no bare try-catch"),
|
||||
commands = mapOf("test" to "./gradlew check"),
|
||||
),
|
||||
)
|
||||
assertEquals(ContextLayer.L0, entry.layer)
|
||||
assertEquals(EntryRole.SYSTEM, entry.role)
|
||||
assertTrue(entry.content.startsWith("## Project profile"), "content: ${entry.content}")
|
||||
assertTrue(entry.content.contains("- no bare try-catch"), "content: ${entry.content}")
|
||||
assertTrue(entry.content.contains("test: ./gradlew check"), "content: ${entry.content}")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `project profile with only about renders without conventions or commands sections`() {
|
||||
val entry = buildProjectProfileEntry(
|
||||
BoundProjectProfile(
|
||||
about = "Simple project",
|
||||
conventions = emptyList(),
|
||||
commands = emptyMap(),
|
||||
),
|
||||
)
|
||||
assertTrue(entry.content.contains("Simple project"), "content: ${entry.content}")
|
||||
assertTrue(!entry.content.contains("### Conventions"), "should not contain Conventions: ${entry.content}")
|
||||
assertTrue(!entry.content.contains("### Commands"), "should not contain Commands: ${entry.content}")
|
||||
assertEquals("projectProfile", entry.sourceType)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user