Skip to content

Commit dd2dd31

Browse files
dgoodwinclaude
andcommitted
Sort validation errors for deterministic output
Sort the aggregated spot-check validation errors before joining them into the error message, since map iteration order is nondeterministic. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a0ff2dc commit dd2dd31

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

pkg/variantregistry/ocp.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ ORDER BY j.prowjob_job_name;
267267
}
268268
}
269269
if len(errs) > 0 {
270+
sort.Strings(errs)
270271
return nil, errors.New("variant registry validation failed:\n" + strings.Join(errs, "\n"))
271272
}
272273

pkg/variantregistry/snapshot.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package variantregistry
33
import (
44
"fmt"
55
"os"
6+
"sort"
67
"strings"
78

89
"github.com/sirupsen/logrus"
@@ -53,6 +54,7 @@ func (s *VariantSnapshot) Identify() (JobVariants, error) {
5354
}
5455

5556
if len(errs) > 0 {
57+
sort.Strings(errs)
5658
return nil, fmt.Errorf("variant registry validation failed:\n%s", strings.Join(errs, "\n"))
5759
}
5860

0 commit comments

Comments
 (0)