claudeSink wrote every raw transcript into brain/wiki/claude-sessions/facts/ (BM25-indexed), duplicating what ai-sessions' curated summaries already cover and out-ranking them in search (177,818 vs 45,335 BM25 weight on the same query, per ai-sessions#10 investigation). Raw dumps now land in brain/archive/claude-sessions/<host>/ — kept for deep lookups, never indexed, never deleted. Refs: ai-sessions#10
39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
// 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)")
|
|
}
|