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)
| 137 | // two experiments: "caveman=yes, style=concise" |
| 138 | // nil/empty: "" |
| 139 | func 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 |