From 8e40f044457586b58b79fb02e66c568ec35d83ac Mon Sep 17 00:00:00 2001 From: Jeffrey Smith Date: Fri, 27 Mar 2026 13:06:40 +0000 Subject: [PATCH] Delete dead test helpers and rename vestigial test paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove seed_helpers.go (SeedTestMessage, SeedTestMessages, SeedTestCursor — all unused, channel/message features gutted) - Rename channel- prefixed test paths to test- in storage tests Co-Authored-By: Claude Opus 4.6 (1M context) --- server/database/seed_helpers.go | 62 --------------------------------- server/storage/pvc_test.go | 8 ++--- server/storage/s3_test.go | 10 +++--- 3 files changed, 9 insertions(+), 71 deletions(-) delete mode 100644 server/database/seed_helpers.go diff --git a/server/database/seed_helpers.go b/server/database/seed_helpers.go deleted file mode 100644 index 599f105..0000000 --- a/server/database/seed_helpers.go +++ /dev/null @@ -1,62 +0,0 @@ -package database - -import ( - "strings" - "testing" -) - -// ── Additional Test Seed Helpers (v0.15.0) ── - -// SeedTestMessage creates a single message in a channel and returns the message ID. -func SeedTestMessage(t *testing.T, channelID, parentID, role, content string) string { - t.Helper() - var id string - var parentPtr *string - if parentID != "" { - parentPtr = &parentID - } - err := DB.QueryRow(` - INSERT INTO messages (channel_id, parent_id, role, content, sibling_index) - VALUES ($1, $2, $3, $4, 0) - RETURNING id - `, channelID, parentPtr, role, content).Scan(&id) - if err != nil { - t.Fatalf("SeedTestMessage: %v", err) - } - return id -} - -// SeedTestMessages creates a linear chain of alternating user/assistant messages. -// Returns all message IDs in order. The first message has no parent. -func SeedTestMessages(t *testing.T, channelID string, count int, contentSize int) []string { - t.Helper() - content := strings.Repeat("x", contentSize) - ids := make([]string, 0, count) - - parentID := "" - for i := 0; i < count; i++ { - role := "user" - if i%2 == 1 { - role = "assistant" - } - id := SeedTestMessage(t, channelID, parentID, role, content) - ids = append(ids, id) - parentID = id - } - - return ids -} - -// SeedTestCursor sets the active leaf for a user in a channel. -func SeedTestCursor(t *testing.T, channelID, userID, leafID string) { - t.Helper() - _, err := DB.Exec(` - INSERT INTO channel_cursors (channel_id, user_id, active_leaf_id) - VALUES ($1, $2, $3) - ON CONFLICT (channel_id, user_id) - DO UPDATE SET active_leaf_id = $3, updated_at = NOW() - `, channelID, userID, leafID) - if err != nil { - t.Fatalf("SeedTestCursor: %v", err) - } -} diff --git a/server/storage/pvc_test.go b/server/storage/pvc_test.go index e854306..999a3a8 100644 --- a/server/storage/pvc_test.go +++ b/server/storage/pvc_test.go @@ -24,7 +24,7 @@ func TestPVC_PutGetRoundTrip(t *testing.T) { ctx := context.Background() data := []byte("hello, storage world") - key := "files/channel-1/att-1_test.txt" + key := "files/test-1/att-1_test.txt" // Put err := s.Put(ctx, key, bytes.NewReader(data), int64(len(data)), "text/plain") @@ -129,18 +129,18 @@ func TestPVC_DeletePrefix(t *testing.T) { ctx := context.Background() // Create several files under a channel prefix - prefix := "files/channel-abc/" + prefix := "files/test-abc/" for _, name := range []string{"a.txt", "b.png", "c.pdf"} { key := prefix + name _ = s.Put(ctx, key, bytes.NewReader([]byte("x")), 1, "text/plain") } // Also create a file in a different channel - other := "files/channel-other/keep.txt" + other := "files/test-other/keep.txt" _ = s.Put(ctx, other, bytes.NewReader([]byte("y")), 1, "text/plain") // Delete the channel prefix - err := s.DeletePrefix(ctx, "files/channel-abc") + err := s.DeletePrefix(ctx, "files/test-abc") if err != nil { t.Fatalf("DeletePrefix: %v", err) } diff --git a/server/storage/s3_test.go b/server/storage/s3_test.go index 26b4065..7c228b3 100644 --- a/server/storage/s3_test.go +++ b/server/storage/s3_test.go @@ -78,7 +78,7 @@ func TestS3_KeyValidation(t *testing.T) { good := []string{ "files/ch/f.txt", - "files/channel-1/att-abc_test.pdf", + "files/test-1/att-abc_test.pdf", "processing/abc123/status.json", } for _, key := range good { @@ -145,7 +145,7 @@ func TestS3_Integration_PutGetRoundTrip(t *testing.T) { ctx := context.Background() data := []byte("hello, S3 storage world") - key := "files/channel-1/att-1_test.txt" + key := "files/test-1/att-1_test.txt" err := s.Put(ctx, key, bytes.NewReader(data), int64(len(data)), "text/plain") if err != nil { @@ -214,16 +214,16 @@ func TestS3_Integration_DeletePrefix(t *testing.T) { s := testS3Store(t) ctx := context.Background() - prefix := "files/channel-abc/" + prefix := "files/test-abc/" for _, name := range []string{"a.txt", "b.png", "c.pdf"} { key := prefix + name _ = s.Put(ctx, key, bytes.NewReader([]byte("x")), 1, "text/plain") } - other := "files/channel-other/keep.txt" + other := "files/test-other/keep.txt" _ = s.Put(ctx, other, bytes.NewReader([]byte("y")), 1, "text/plain") - err := s.DeletePrefix(ctx, "files/channel-abc") + err := s.DeletePrefix(ctx, "files/test-abc") if err != nil { t.Fatalf("DeletePrefix: %v", err) }