summaryrefslogtreecommitdiff
path: root/internal/executor/executor.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/executor/executor.go')
-rw-r--r--internal/executor/executor.go26
1 files changed, 24 insertions, 2 deletions
diff --git a/internal/executor/executor.go b/internal/executor/executor.go
index 6aef736..6ffedc7 100644
--- a/internal/executor/executor.go
+++ b/internal/executor/executor.go
@@ -565,13 +565,35 @@ func (p *Pool) createValidationTask(ctx context.Context, storyID string) {
return
}
- var spec map[string]interface{}
+ type validationSpec struct {
+ Type string `json:"type"`
+ AcceptanceCriteria []struct {
+ Name string `json:"name"`
+ Verification string `json:"verification"`
+ TestRef string `json:"test_ref,omitempty"`
+ } `json:"acceptance_criteria"`
+ }
+ var spec validationSpec
if err := json.Unmarshal([]byte(story.ValidationJSON), &spec); err != nil {
p.logger.Error("createValidationTask: failed to parse ValidationJSON", "storyID", storyID, "error", err)
return
}
- instructions := fmt.Sprintf("Validate the deployment for story %q.\n\nValidation spec:\n%s", story.Name, story.ValidationJSON)
+ var instructions string
+ if len(spec.AcceptanceCriteria) > 0 {
+ var sb strings.Builder
+ fmt.Fprintf(&sb, "Validate the deployment for story %q.\n\nFor each acceptance criterion, verify it and report PASS or FAIL:\n", story.Name)
+ for _, c := range spec.AcceptanceCriteria {
+ if c.TestRef != "" {
+ fmt.Fprintf(&sb, "- %s: %s [test: %s]\n", c.Name, c.Verification, c.TestRef)
+ } else {
+ fmt.Fprintf(&sb, "- %s: %s\n", c.Name, c.Verification)
+ }
+ }
+ instructions = sb.String()
+ } else {
+ instructions = fmt.Sprintf("Validate the deployment for story %q.\n\nValidation spec:\n%s", story.Name, story.ValidationJSON)
+ }
now := time.Now().UTC()
vtask := &task.Task{