feat(kernel): RepoKnowledgeRetriever port + relevance-retrieved repo context with recency fallback
This commit is contained in:
@@ -10,8 +10,10 @@ import com.correx.core.events.types.ArtifactId
|
||||
import com.correx.core.events.types.SessionId
|
||||
import com.correx.core.events.types.StageId
|
||||
import com.correx.core.events.types.TransitionId
|
||||
import com.correx.core.events.events.RepoKnowledgeHit
|
||||
import com.correx.core.kernel.orchestration.buildArtifactKindVocabularyEntry
|
||||
import com.correx.core.kernel.orchestration.buildProjectProfileEntry
|
||||
import com.correx.core.kernel.orchestration.buildRelevantFilesEntry
|
||||
import com.correx.core.kernel.orchestration.buildRetryFeedbackEntry
|
||||
import com.correx.core.kernel.orchestration.criticArtifactIds
|
||||
import com.correx.core.sessions.BoundProjectProfile
|
||||
@@ -109,6 +111,20 @@ class ContextFeedbackTest {
|
||||
assertTrue(entry.content.contains("report (llm-emitted)"), "content should flag llm-emitted: ${entry.content}")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `buildRelevantFilesEntry produces L3 system entry with Relevant files header`() {
|
||||
val hits = listOf(
|
||||
RepoKnowledgeHit(path = "src/Parser.kt", text = "src/Parser.kt: Parser, Lexer", score = 0.9f),
|
||||
RepoKnowledgeHit(path = "src/Main.kt", text = "src/Main.kt: main", score = 0.7f),
|
||||
)
|
||||
val entry = buildRelevantFilesEntry(hits)
|
||||
assertEquals(ContextLayer.L3, entry.layer)
|
||||
assertEquals(EntryRole.SYSTEM, entry.role)
|
||||
assertEquals("relevantFiles", entry.sourceType)
|
||||
assertTrue(entry.content.startsWith("## Relevant files"), "content: ${entry.content}")
|
||||
assertTrue(entry.content.contains("src/Parser.kt"), "content: ${entry.content}")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `no refinement events yields empty set`() {
|
||||
assertTrue(criticArtifactIds(emptyList(), graphWith(), StageId("implement")).isEmpty())
|
||||
|
||||
Reference in New Issue
Block a user