diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-04-04 09:36:56 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-04-04 09:36:56 +0000 |
| commit | 70e90275c0a08649c314cae5280521bcd29272e6 (patch) | |
| tree | 9da0ed0e7e47b070948f6fe968905bf1b000a899 /internal/api/stories_test.go | |
| parent | 5437d2982c2eb0650ca06fa8c45c59188c983eb8 (diff) | |
feat: acceptance_criteria per story task in elaboration and approval
Add AcceptanceCriteria field to elaboratedStoryTask struct, update
buildStoryElaboratePrompt schema and rules, pass the value through
handleApproveStory into task.Task, and add a test verifying the
field is persisted on approved story tasks.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/api/stories_test.go')
| -rw-r--r-- | internal/api/stories_test.go | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/internal/api/stories_test.go b/internal/api/stories_test.go index 342840b..f43ad86 100644 --- a/internal/api/stories_test.go +++ b/internal/api/stories_test.go @@ -258,6 +258,55 @@ func TestHandleStoryApprove_SetsRepositoryURL(t *testing.T) { } } +func TestApproveStory_AcceptanceCriteriaStored(t *testing.T) { + srv, store := testServer(t) + + proj := &task.Project{ + ID: "ac-proj", Name: "test", RemoteURL: "https://github.com/x/y", + Type: "web", DeployScript: "", + } + store.CreateProject(proj) + + body := `{ + "name": "AC Story", + "branch_name": "story/ac-test", + "project_id": "ac-proj", + "tasks": [ + { + "name": "Add feature", + "instructions": "implement the thing", + "acceptance_criteria": "run go test ./... and verify all pass", + "subtasks": [] + } + ], + "validation": {"type": "test", "steps": [], "success_criteria": "tests pass"} + }` + req := httptest.NewRequest("POST", "/api/stories/approve", strings.NewReader(body)) + req.Header.Set("Content-Type", "application/json") + w := httptest.NewRecorder() + srv.mux.ServeHTTP(w, req) + + if w.Code != http.StatusCreated { + t.Fatalf("expected 201, got %d: %s", w.Code, w.Body.String()) + } + + var resp struct { + TaskIDs []string `json:"task_ids"` + } + json.NewDecoder(w.Body).Decode(&resp) + if len(resp.TaskIDs) == 0 { + t.Fatal("expected task_ids in response") + } + + tk, err := store.GetTask(resp.TaskIDs[0]) + if err != nil { + t.Fatalf("GetTask: %v", err) + } + if tk.AcceptanceCriteria != "run go test ./... and verify all pass" { + t.Errorf("expected acceptance criteria stored on task, got %q", tk.AcceptanceCriteria) + } +} + func TestHandleStoryDeploymentStatus(t *testing.T) { srv, store := testServer(t) |
