// Package promptfixture adapts complete prompt documents for controlled tests. package promptfixture import ( "go.yaml.in/yaml/v4" "testing" ) // WithRepairAttempts changes prompt-owned budgets without depending on YAML layout. func WithRepairAttempts(t testing.TB, data []byte, attempts int) []byte { t.Helper() var document map[string]any if err := yaml.Unmarshal(data, &document); err != nil { t.Fatal(err) } var update func(map[string]any) update = func(scope map[string]any) { records, _ := scope["prompts"].([]any) for _, record := range records { prompt := record.(map[string]any) output := prompt["output"].(map[string]any) output["repair_attempts"] = attempts } collections, _ := scope["collections"].(map[string]any) for _, collection := range collections { update(collection.(map[string]any)) } } update(document) result, err := yaml.Marshal(document) if err != nil { t.Fatal(err) } return result }