fix(overview): resolve a group's leader against its own members (scadaproj#43)

LeaderResolver searched every instance of the application, so co-located
groups (QA: ScadaBridge central-a and site-a both on vq03) got the
first-listed group's instance name on their leader chip. Resolution is now
scoped to the group's members; an unmatched address keeps its raw form.

- tests: QA co-located central/site layout; cross-group host not borrowed
- CLAUDE.md: correct the leader-resolution / 127.0.0.1 guidance
- code-reviews: Overview-002 Resolved; README regenerated

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
Joseph Doherty
2026-11-09 14:43:18 -05:00
parent c25acd6093
commit 6c81c0bc0a
5 changed files with 60 additions and 25 deletions
@@ -45,16 +45,13 @@ public static class LeaderResolver
if (!members.Exists(m => m.HasActiveRole))
continue;
groups.Add(ResolveGroup(name!, members, all));
groups.Add(ResolveGroup(name!, members));
}
return groups;
}
private static GroupSnapshot ResolveGroup(
string name,
IReadOnlyList<InstanceSnapshot> members,
IReadOnlyList<InstanceSnapshot> allInstances)
private static GroupSnapshot ResolveGroup(string name, IReadOnlyList<InstanceSnapshot> members)
{
// Only members that are actually talking get a vote. A Down or Unreachable node's last
// known leader is stale by definition, and counting it would manufacture a disagreement
@@ -80,9 +77,14 @@ public static class LeaderResolver
.First()
.Key;
// Resolved against the group's OWN members only. A group's leader is one of its members by
// definition, and co-located groups of one application (QA: ScadaBridge central-a and
// site-a both on vq03) share hosts — searching the whole application let the first-listed
// group's instance win every later group's chip (Overview-002). An unmatched address keeps
// its raw form rather than borrowing a name from another cluster.
return new GroupSnapshot(
name,
ResolveToInstanceName(winner, allInstances),
ResolveToInstanceName(winner, members),
winner,
Disagreement: distinct.Count > 1,
distinct);