summaryrefslogtreecommitdiff
path: root/internal/storage/db_test.go
diff options
context:
space:
mode:
authorClaudomator Agent <agent@claudomator>2026-06-05 09:21:32 +0000
committerClaudomator Agent <agent@claudomator>2026-06-05 09:21:32 +0000
commit0eb0b79396663c4901597becc6857a4cd795c58e (patch)
tree3532c82aa3f7c6deeed03f143d1c360d7cf6cc47 /internal/storage/db_test.go
parentfa3ed5220a28f326d443726233c37e1a7df0ced5 (diff)
chore: remove stories/checker backend dead code
Remove the dead stories/checker backend tracked as design debt in CLAUDE.md: - Delete internal/api/stories.go, stories_test.go, elaborate.go - Delete internal/task/story.go, story_test.go - Remove story/checker columns from storage schema and all CRUD methods - Remove checkStoryCompletion, spawnCheckerTask, triggerStoryDeploy, createValidationTask, checkValidationResult, ShipStory, CheckStoryCompletion from executor; simplify handleRunResult - Remove story/checker fields from task.Task (StoryID, AcceptanceCriteria, CheckerForTaskID, CheckerReport) - Remove story routes and geminiBinPath from API server - Move claudeJSONResult/extractJSON from elaborate.go to validate.go - Rename ensureStoryBranch -> ensureBranch in ContainerRunner - Fix git identity in bare-repo tests; fix initial-branch to use main Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/storage/db_test.go')
-rw-r--r--internal/storage/db_test.go183
1 files changed, 0 insertions, 183 deletions
diff --git a/internal/storage/db_test.go b/internal/storage/db_test.go
index 4d744a4..09bbdfc 100644
--- a/internal/storage/db_test.go
+++ b/internal/storage/db_test.go
@@ -1256,187 +1256,4 @@ func TestUpdateProject(t *testing.T) {
}
}
-func TestCreateStory(t *testing.T) {
- db := testDB(t)
- st := &task.Story{
- ID: "story-1",
- Name: "My Story",
- Status: task.StoryPending,
- }
- if err := db.CreateStory(st); err != nil {
- t.Fatalf("CreateStory: %v", err)
- }
-}
-
-func TestGetStory(t *testing.T) {
- db := testDB(t)
- st := &task.Story{
- ID: "story-2",
- Name: "Get Story",
- ProjectID: "proj-1",
- Status: task.StoryPending,
- }
- if err := db.CreateStory(st); err != nil {
- t.Fatalf("CreateStory: %v", err)
- }
- got, err := db.GetStory("story-2")
- if err != nil {
- t.Fatalf("GetStory: %v", err)
- }
- if got.Name != "Get Story" {
- t.Errorf("Name: want 'Get Story', got %q", got.Name)
- }
- if got.ProjectID != "proj-1" {
- t.Errorf("ProjectID: want 'proj-1', got %q", got.ProjectID)
- }
- if got.Status != task.StoryPending {
- t.Errorf("Status: want PENDING, got %q", got.Status)
- }
-}
-
-func TestListStories(t *testing.T) {
- db := testDB(t)
- for _, name := range []string{"A", "B", "C"} {
- if err := db.CreateStory(&task.Story{ID: name, Name: name, Status: task.StoryPending}); err != nil {
- t.Fatalf("CreateStory %s: %v", name, err)
- }
- }
- stories, err := db.ListStories()
- if err != nil {
- t.Fatalf("ListStories: %v", err)
- }
- if len(stories) != 3 {
- t.Errorf("want 3 stories, got %d", len(stories))
- }
-}
-
-func TestUpdateStoryStatus(t *testing.T) {
- db := testDB(t)
- st := &task.Story{ID: "story-upd", Name: "Upd", Status: task.StoryPending}
- if err := db.CreateStory(st); err != nil {
- t.Fatalf("CreateStory: %v", err)
- }
- if err := db.UpdateStoryStatus("story-upd", task.StoryInProgress); err != nil {
- t.Fatalf("UpdateStoryStatus: %v", err)
- }
- got, _ := db.GetStory("story-upd")
- if got.Status != task.StoryInProgress {
- t.Errorf("Status: want IN_PROGRESS, got %q", got.Status)
- }
-}
-
-func TestListTasksByStory(t *testing.T) {
- db := testDB(t)
- now := time.Now().UTC()
-
- if err := db.CreateStory(&task.Story{ID: "story-tasks", Name: "S", Status: task.StoryPending}); err != nil {
- t.Fatalf("CreateStory: %v", err)
- }
-
- makeTask := func(id string) *task.Task {
- return &task.Task{
- ID: id,
- Name: id,
- StoryID: "story-tasks",
- Agent: task.AgentConfig{Type: "claude"},
- Priority: task.PriorityNormal,
- Tags: []string{},
- DependsOn: []string{},
- Retry: task.RetryConfig{MaxAttempts: 1},
- State: task.StatePending,
- CreatedAt: now,
- UpdatedAt: now,
- }
- }
-
- if err := db.CreateTask(makeTask("t1")); err != nil {
- t.Fatal(err)
- }
- if err := db.CreateTask(makeTask("t2")); err != nil {
- t.Fatal(err)
- }
-
- tasks, err := db.ListTasksByStory("story-tasks")
- if err != nil {
- t.Fatalf("ListTasksByStory: %v", err)
- }
- if len(tasks) != 2 {
- t.Errorf("want 2 tasks, got %d", len(tasks))
- }
- for _, tk := range tasks {
- if tk.StoryID != "story-tasks" {
- t.Errorf("task %s: StoryID want 'story-tasks', got %q", tk.ID, tk.StoryID)
- }
- }
-}
-
-func TestUpdateTaskCheckerReport(t *testing.T) {
- db := testDB(t)
- tk := &task.Task{
- ID: "cr-1", Name: "orig", RepositoryURL: "https://github.com/x/y",
- Agent: task.AgentConfig{Type: "claude", Instructions: "x"},
- Priority: task.PriorityNormal,
- Retry: task.RetryConfig{MaxAttempts: 1, Backoff: "linear"},
- Tags: []string{}, DependsOn: []string{},
- State: task.StatePending, CreatedAt: time.Now().UTC(), UpdatedAt: time.Now().UTC(),
- }
- if err := db.CreateTask(tk); err != nil {
- t.Fatalf("CreateTask: %v", err)
- }
- if err := db.UpdateTaskCheckerReport("cr-1", "Tests failed: missing endpoint"); err != nil {
- t.Fatalf("UpdateTaskCheckerReport: %v", err)
- }
- got, err := db.GetTask("cr-1")
- if err != nil {
- t.Fatalf("GetTask: %v", err)
- }
- if got.CheckerReport != "Tests failed: missing endpoint" {
- t.Errorf("expected checker report, got %q", got.CheckerReport)
- }
-}
-
-func TestGetCheckerTask(t *testing.T) {
- db := testDB(t)
- checked := &task.Task{
- ID: "chk-orig", Name: "orig", RepositoryURL: "https://github.com/x/y",
- Agent: task.AgentConfig{Type: "claude", Instructions: "x"},
- Priority: task.PriorityNormal,
- Retry: task.RetryConfig{MaxAttempts: 1, Backoff: "linear"},
- Tags: []string{}, DependsOn: []string{},
- State: task.StatePending, CreatedAt: time.Now().UTC(), UpdatedAt: time.Now().UTC(),
- }
- if err := db.CreateTask(checked); err != nil {
- t.Fatalf("CreateTask checked: %v", err)
- }
- checker := &task.Task{
- ID: "chk-checker", Name: "Check: orig", CheckerForTaskID: "chk-orig",
- RepositoryURL: "https://github.com/x/y",
- Agent: task.AgentConfig{Type: "claude", Instructions: "validate"},
- Priority: task.PriorityNormal,
- Retry: task.RetryConfig{MaxAttempts: 1, Backoff: "linear"},
- Tags: []string{}, DependsOn: []string{},
- State: task.StatePending, CreatedAt: time.Now().UTC(), UpdatedAt: time.Now().UTC(),
- }
- if err := db.CreateTask(checker); err != nil {
- t.Fatalf("CreateTask checker: %v", err)
- }
-
- // Should find the checker task.
- got, err := db.GetCheckerTask("chk-orig")
- if err != nil {
- t.Fatalf("GetCheckerTask: %v", err)
- }
- if got == nil || got.ID != "chk-checker" {
- t.Errorf("expected checker task ID chk-checker, got %v", got)
- }
-
- // Should return nil when no checker exists.
- none, err := db.GetCheckerTask("nonexistent")
- if err != nil {
- t.Fatalf("GetCheckerTask nonexistent: %v", err)
- }
- if none != nil {
- t.Errorf("expected nil for task with no checker, got %v", none)
- }
-}