diff options
| author | Claudomator Agent <agent@claudomator.local> | 2026-03-26 09:28:17 +0000 |
|---|---|---|
| committer | Claudomator Agent <agent@claudomator.local> | 2026-03-26 09:28:17 +0000 |
| commit | f66fde80bf5759faa75d3c294e99abbb75dd2cdf (patch) | |
| tree | 8e25d577d1916bdf53f052c36e6c49ba2956b199 /internal/executor/executor_test.go | |
| parent | a13ec6aa94550bce5caaee6bc01e690cabb5d4dc (diff) | |
update createValidationTask to list named acceptance criteria in instructionsstory/acceptance-criteria
Replace raw ValidationJSON in validation task instructions with a
formatted per-criterion checklist when acceptance_criteria entries are
present. Falls back to the raw JSON blob when AcceptanceCriteria is
empty. Adds TestCreateValidationTask_InstructionsIncludeNamedCriteria.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/executor/executor_test.go')
| -rw-r--r-- | internal/executor/executor_test.go | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/internal/executor/executor_test.go b/internal/executor/executor_test.go index ad496e7..933f303 100644 --- a/internal/executor/executor_test.go +++ b/internal/executor/executor_test.go @@ -2027,6 +2027,67 @@ func TestPool_DependsOn_NoDeadlock(t *testing.T) { } } +func TestCreateValidationTask_InstructionsIncludeNamedCriteria(t *testing.T) { + store := testStore(t) + runner := &mockRunner{} + runners := map[string]Runner{"claude": runner} + logger := slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelError})) + pool := NewPool(2, runners, store, logger) + + now := time.Now().UTC() + story := &task.Story{ + ID: "story-named-criteria-1", + Name: "Named Criteria Story", + Status: task.StoryDeployed, + CreatedAt: now, + UpdatedAt: now, + ValidationJSON: `{ + "type": "automated", + "acceptance_criteria": [ + {"name": "API returns 200", "verification": "GET /health returns HTTP 200", "test_ref": "TestHealthEndpoint"}, + {"name": "DB migration applied", "verification": "table users exists", "test_ref": ""}, + {"name": "Auth header required", "verification": "requests without token get 401"} + ] + }`, + } + if err := store.CreateStory(story); err != nil { + t.Fatalf("CreateStory: %v", err) + } + + pool.createValidationTask(context.Background(), story.ID) + + // Drain the submitted task from results. + select { + case <-pool.Results(): + case <-time.After(5 * time.Second): + t.Fatal("timed out waiting for validation task result") + } + + tasks, err := store.ListTasksByStory(story.ID) + if err != nil { + t.Fatalf("ListTasksByStory: %v", err) + } + if len(tasks) != 1 { + t.Fatalf("expected 1 validation task, got %d", len(tasks)) + } + + instructions := tasks[0].Agent.Instructions + // Each criterion name must appear as a formatted list item (not merely in raw JSON). + for _, line := range []string{ + "- API returns 200:", + "- DB migration applied:", + "- Auth header required:", + } { + if !strings.Contains(instructions, line) { + t.Errorf("instructions missing formatted criterion line %q\n\nfull instructions:\n%s", line, instructions) + } + } + // test_ref should appear for criteria that have one. + if !strings.Contains(instructions, "TestHealthEndpoint") { + t.Errorf("instructions should include test_ref 'TestHealthEndpoint'\n\nfull instructions:\n%s", instructions) + } +} + func TestPool_ValidationTask_Fail_SetsNeedsFix(t *testing.T) { store := testStore(t) logger := slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelError})) |
