MCPcopy Create free account
hub / github.com/github/gh-aw / EvaluateOutcomes

Function EvaluateOutcomes

pkg/cli/outcome_eval.go:112–150  ·  view source on GitHub ↗

EvaluateOutcomes checks the current state of all safe output items from a run. The mapping parameter is required and defines how labels map to objective values.

(items []CreatedItemReport, repoOverride string, mapping *github.ObjectiveMapping)

Source from the content-addressed store, hash-verified

110// EvaluateOutcomes checks the current state of all safe output items from a run.
111// The mapping parameter is required and defines how labels map to objective values.
112func EvaluateOutcomes(items []CreatedItemReport, repoOverride string, mapping *github.ObjectiveMapping) []OutcomeReport {
113 outcomeEvalLog.Printf("Evaluating outcomes: items=%d, repo_override=%q", len(items), repoOverride)
114 if repoOverride == "" {
115 slug, err := GetCurrentRepoSlug()
116 if err == nil {
117 repoOverride = slug
118 outcomeEvalLog.Printf("Resolved repo override from current repo slug: %s", repoOverride)
119 }
120 }
121
122 reports := make([]OutcomeReport, 0, len(items))
123 skipped := 0
124 for _, item := range items {
125 if item.Type == "noop" || item.Type == "missing_tool" || item.Type == "missing_data" || item.Type == "report_incomplete" {
126 skipped++
127 continue
128 }
129 repo := item.Repo
130 if repo == "" {
131 repo = repoOverride
132 }
133 eval, ok := outcomeEvaluators[item.Type]
134 if !ok {
135 outcomeEvalLog.Printf("No evaluator registered for type %q, using generic sticky", item.Type)
136 eval = evalGenericSticky
137 }
138 report := eval(item, repo)
139 report.CreatedAt = item.Timestamp
140 report.CheckedAt = time.Now().UTC().Format(time.RFC3339)
141 report.OutcomeEvaluation = normalizeOutcomeEvaluation(report)
142
143 // Compute objective value from issue/PR labels
144 enrichOutcomeWithObjectiveValue(&report, repo, mapping)
145
146 reports = append(reports, report)
147 }
148 outcomeEvalLog.Printf("Outcome evaluation complete: reports=%d, skipped=%d", len(reports), skipped)
149 return reports
150}
151
152// ComputeOutcomeSummary aggregates outcome reports into a summary.
153// The mapping parameter is required and defines how labels map to objective values.

Callers 4

RunOutcomesFunction · 0.85
buildAuditDataFunction · 0.85

Calls 4

GetCurrentRepoSlugFunction · 0.85
PrintfMethod · 0.45