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

Function formatExperimentLabel

pkg/cli/audit_report_experiments.go:139–151  ·  view source on GitHub ↗

formatExperimentLabel returns a compact, human-readable label summarising the experiment assignments for a single run. It is used in the Overview section of the audit report to surface experiment context alongside the run header. Examples: one experiment: "style=concise" two experiments: "cavem

(exp *ExperimentData)

Source from the content-addressed store, hash-verified

137// two experiments: "caveman=yes, style=concise"
138// nil/empty: ""
139func formatExperimentLabel(exp *ExperimentData) string {
140 if exp == nil || len(exp.Assignments) == 0 {
141 return ""
142 }
143
144 names := sliceutil.SortedKeys(exp.Assignments)
145
146 parts := make([]string, 0, len(names))
147 for _, name := range names {
148 parts = append(parts, name+"="+exp.Assignments[name])
149 }
150 return strings.Join(parts, ", ")
151}
152
153// firstExperimentAssignment returns the deterministic first experiment assignment
154// from exp, sorted by experiment name. It is used when callers need a stable

Callers 2

buildAuditDataFunction · 0.85

Calls 1

SortedKeysFunction · 0.92

Tested by 1