chore: checkpoint uncommitted work before session store fix
Pre-existing work-in-progress in the tree: karakeep, snippets, skills-health and redaction ingesters, the opencode.db session sweep, gossip and metrics changes. Checkpointed as-is so the adapter fix in the next commit stays reviewable on its own.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package ingest
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBuildSummary(t *testing.T) {
|
||||
if got := buildSummary(nil); got != "" {
|
||||
t.Fatalf("empty summary=%q", got)
|
||||
}
|
||||
|
||||
got := buildSummary([]string{"first prompt", "assistant: reply"})
|
||||
if !strings.HasPrefix(got, "first prompt") || !strings.Contains(got, "reply") {
|
||||
t.Fatalf("unexpected summary: %q", got)
|
||||
}
|
||||
|
||||
// Transcript is bounded well under the cap plus the leading prompt.
|
||||
long := strings.Repeat("x", transcriptCap*2)
|
||||
got = buildSummary([]string{"p", long})
|
||||
if len(got) > transcriptCap+300 {
|
||||
t.Fatalf("summary not capped: %d bytes", len(got))
|
||||
}
|
||||
}
|
||||
|
||||
func TestToolEchoFiltered(t *testing.T) {
|
||||
if !isToolEcho("Called the Read tool with the following input: {}") {
|
||||
t.Fatal("tool echo not detected")
|
||||
}
|
||||
if !isToolEcho("<path>/tmp/x</path>") {
|
||||
t.Fatal("path echo not detected")
|
||||
}
|
||||
if isToolEcho("review repo, start with @AGENTS.md") {
|
||||
t.Fatal("real prompt wrongly filtered")
|
||||
}
|
||||
}
|
||||
|
||||
func TestShortID(t *testing.T) {
|
||||
if got := shortID("ses_38703c295ffeIjbbaYM2Xh6GvK"); got != "38703c29" {
|
||||
t.Fatalf("shortID=%q", got)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user