// ingestion/cmd/server/main_test.go package main import ( "context" "log/slog" "os" "path/filepath" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/mathiasbq/hyperguild/ingestion/internal/claudewatcher" ) func TestClaudeSink_IngestWritesToNonIndexedArchiveNotWiki(t *testing.T) { dir := t.TempDir() sink := &claudeSink{brainDir: dir, logger: slog.New(slog.NewTextHandler(os.Stderr, nil))} err := sink.Ingest(context.Background(), claudewatcher.Batch{ Host: "koala", FilePath: "/host-home-claude/projects/-home-mathias-dev/abc.jsonl", SessionID: "abc", ProjectID: "-home-mathias-dev", Turns: []claudewatcher.Turn{ {Type: "assistant", Content: "did a thing"}, }, }) require.NoError(t, err) got, err := os.ReadFile(filepath.Join(dir, "archive", "claude-sessions", "koala", "session-koala-abc.md")) require.NoError(t, err, "raw session dump must land in the non-indexed archive") assert.Contains(t, string(got), "did a thing") _, err = os.Stat(filepath.Join(dir, "wiki", "claude-sessions")) assert.True(t, os.IsNotExist(err), "raw transcripts must never land under wiki/ (ai-sessions#10 — BM25 pollution)") }