Fix 10: the indexer's source catch-up and trunk directories are answered in name order, not a map's

Kind: an order asserted or acted on that came from ranging a map.
Builds: design 47 G §15, §115, §362
This commit is contained in:
2026-11-12 02:21:03 +01:00
parent 5f3410cd24
commit fd3788c517
4 changed files with 6 additions and 3 deletions
@@ -217,7 +217,7 @@ func TestTheSourceIsReadFromTheSeatAndASourceMovedDuringTheCatchUpIsReadAfterIt(
s.catchUp(context.Background())
// The trunk, then each other watched branch the seat lists (a name unescaped), then what was heard meanwhile once each,
// beta among them: main through the take-in, every other branch into its own revision (A-93).
want := []string{"read main", "apply main 4", "read ", "read beta", "branch beta 4", "read feat=2e1", "branch feat.1 4", "read main", "apply main 4", "read beta", "branch beta 4"}
want := []string{"read main", "apply main 4", "read ", "read beta", "branch beta 4", "read feat=2e1", "branch feat.1 4", "read beta", "branch beta 4", "read main", "apply main 4"}
if !reflect.DeepEqual(order, want) {
t.Errorf("order = %v, want %v", order, want)
}
@@ -8,6 +8,7 @@ import (
"fmt"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-checker/checkermsg"
"path"
"slices"
"strings"
"git.novox.be/novox/mesh-delivery/contracts/go/clients/meshcatalogclient"
@@ -110,6 +111,7 @@ func trunkVia(call toolCaller) func(ctx context.Context, repository, sha string)
for dir := range a.Trees {
dirs = append(dirs, dir)
}
slices.Sort(dirs) // a map's order is random: the directories are answered in name order
return dirs, nil
}
}
@@ -83,7 +83,6 @@ func TestTheTrunkIsTheDirectoriesTheForgeListsTrees(t *testing.T) { // 1900/AC3
if err != nil {
t.Fatal(err)
}
slices.Sort(dirs)
if !slices.Equal(dirs, []string{"modules/a", "modules/b"}) {
t.Errorf("dirs = %v", dirs)
}
@@ -4,6 +4,8 @@ import (
"context"
"encoding/json"
"fmt"
"maps"
"slices"
"strings"
"sync"
@@ -71,7 +73,7 @@ func (s *sourceFollow) catchUp(ctx context.Context) {
branches := s.waiting
s.waiting = nil
s.mu.Unlock()
for branch := range branches {
for _, branch := range slices.Sorted(maps.Keys(branches)) { // a map's order is random: the branches are read in name order
s.take(ctx, branch)
}
}