eval status: sort plan annotations by task group (#26428)

The plan annotations table isn't sorted by task group, which makes for a less
beautiful UX and a flaky test.
This commit is contained in:
Tim Gross
2025-08-05 09:36:12 -04:00
committed by GitHub
parent 350662c88e
commit 0ae5b3f39b
2 changed files with 12 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ package command
import (
"fmt"
"slices"
"sort"
"strconv"
"strings"
@@ -382,8 +383,16 @@ func formatPlanAnnotations(desiredTGUpdates map[string]*api.DesiredUpdates, verb
}
}
taskGroups := []string{}
for tg := range desiredTGUpdates {
taskGroups = append(taskGroups, tg)
}
slices.Sort(taskGroups)
i := 1
for tg, updates := range desiredTGUpdates {
for _, tg := range taskGroups {
updates := desiredTGUpdates[tg]
// we always show the first 5 columns
annotations[i] = fmt.Sprintf("%s|%d|%d|%d|%d|%d",
tg,

View File

@@ -236,6 +236,6 @@ func TestEvalStatus_FormatPlanAnnotations(t *testing.T) {
out := formatPlanAnnotations(updates, false)
must.Eq(t, `Task Group Ignore Place Stop InPlace Destructive Canary Reconnect
foo 2 1 0 0 0 1 0
bar 0 1 3 0 0 0 2`, out)
bar 0 1 3 0 0 0 2
foo 2 1 0 0 0 1 0`, out)
}