simplify: hoist TrimSpace out of placement loop, add slug upgrade · Entire
simplify: hoist TrimSpace out of placement loop, add slug upgrade
b03d852→main·
evisdren·1w ago·1 file·+8 added/-1 removed
Hoist r.Cell normalization before the inner placement loop so it's computed once instead of N times. Replace EqualFold with direct lowercase comparison since both sides are already normalized.
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com
Sessions
01KWZTWB0NZNXJQ5JQ4031HZ8QView transcript
[?
Fix Code Search across Mirror PlacementsClaude Code·Opus 4.6·4 steps](/content/gh/entireio/cli/session/049ddfe6-94db-4012-a48d-d8e512970d53#timeline-01KWZTWB0NZNXJQ5JQ4031HZ8Q/index.html)
Changes
1
cmd/entire/cli
Mcell_fanout.go+8/-1
79 unmodified lines
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
1 unmodified line
99
100
101
95
102
103
104
105
79 unmodified lines
}
byCell[key] = g
}
// Upgrade an empty slug if a later entry provides one (a mirror
// placement may create the group before the home placement adds the
// slug).
if g.clusterSlug == "" && clusterSlug != "" {
g.clusterSlug = clusterSlug
}
g.repoIDs = append(g.repoIDs, id)
}
for _, r := range repos {
if len(r.Placements) > 0 {
homeCell := strings.ToLower(strings.TrimSpace(r.Cell))
for _, p := range r.Placements {
// Placements don't carry a cluster slug; the top-level
// slug applies only to the home placement. Pass it when
1 unmodified line
// empty otherwise — resolveCellBaseURLs falls back to
// jurisdiction matching for groups without a slug.
slug := ""
if strings.EqualFold(strings.TrimSpace(p.Cell), strings.TrimSpace(r.Cell)) {
if strings.ToLower(strings.TrimSpace(p.Cell)) == homeCell {
slug = r.ClusterSlug
}
addToGroup(p.ID, p.Cell, p.Jurisdiction, slug)
Mcmd/entire/cli/cell_fanout.go+8/-1