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("/tmp/x") { 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) } }