[Overview] Leader matched across the whole app, not the cluster group (QA site shows central leader) #43

Closed
opened 2026-11-09 14:39:23 -05:00 by dohertj2 · 1 comment
Owner

From the scadaproj#15 shared-library review (code-reviews/Overview/findings.md, Overview-002), verified at 91fb2b4. Update the finding's Resolution row when fixed.

Severity Medium
Priority P2
Category Correctness & logic bugs
Status Open
Location ZB.MOM.WW.Overview/src/ZB.MOM.WW.Overview/Polling/LeaderResolver.cs:85 (scan at :150-166)

Description

ResolveGroup passes allInstances (every instance in the application) to
ResolveToInstanceName. That method returns the first instance in registry order whose
BaseUrl host equals the Akka address host.

A group's leader is by definition one of that group's members, but the members are never searched
first. Whenever two groups of the same application share hosts, the group listed later gets the
earlier group's instance name on its "Leader ·" chip. No card in the right group then gets the Leader
badge: IsLeader compares within the group, and the resolved name belongs to the other group.

ZB.MOM.WW.Overview/CLAUDE.md and deployment.md §7 describe this as a single-box problem (worked
around on VD03 with 127.0.0.1 BaseUrls) and state that "QA's registry can use real FQDNs" because
the hosts are distinct. On QA, however, ScadaBridge central-a and site-a both run on vq03, and
central-b and site-b on vq04
(deployment.md:52-53), all inside one ScadaBridge application.

Failure scenario

On the QA dashboard (vq03:5320 / vq04:5320), ScadaBridge's central group is listed first and the
site cluster's leader is on vq03. A scratch test of that exact layout gave:

  • central: leaderInstance=central-a
  • site: leaderInstance=central-a

So the site group header reads "Leader · central-a" (a node in a different Akka cluster), and neither
site card shows the Leader chip. This is the only environment with a real HA pair, which is where
operators read leadership during failover. This is inferred from the documented QA layout; the QA
overlay is deployed-only and was not read.

Recommendation

In ResolveGroup, resolve against members first and fall back to allInstances only if no member
matches. Add a LeaderResolverTests case with two co-located groups. Then revisit the CLAUDE.md /
deployment.md guidance: with the fix, the VD03 127.0.0.1 workaround also becomes unnecessary.

Resolution

Unresolved.

From the scadaproj#15 shared-library review (`code-reviews/Overview/findings.md`, **Overview-002**), verified at 91fb2b4. Update the finding's Resolution row when fixed. | | | |--|--| | Severity | Medium | | Priority | P2 | | Category | Correctness & logic bugs | | Status | Open | | Location | `ZB.MOM.WW.Overview/src/ZB.MOM.WW.Overview/Polling/LeaderResolver.cs:85` (scan at `:150-166`) | **Description** `ResolveGroup` passes `allInstances` (every instance in the application) to `ResolveToInstanceName`. That method returns the **first** instance in registry order whose `BaseUrl` host equals the Akka address host. A group's leader is by definition one of that group's members, but the members are never searched first. Whenever two groups of the same application share hosts, the group listed later gets the earlier group's instance name on its "Leader ·" chip. No card in the right group then gets the Leader badge: `IsLeader` compares within the group, and the resolved name belongs to the other group. `ZB.MOM.WW.Overview/CLAUDE.md` and `deployment.md` §7 describe this as a single-box problem (worked around on VD03 with `127.0.0.1` BaseUrls) and state that "QA's registry can use real FQDNs" because the hosts are distinct. On QA, however, ScadaBridge **central-a and site-a both run on vq03, and central-b and site-b on vq04** (`deployment.md:52-53`), all inside one `ScadaBridge` application. **Failure scenario** On the QA dashboard (`vq03:5320` / `vq04:5320`), ScadaBridge's central group is listed first and the site cluster's leader is on vq03. A scratch test of that exact layout gave: - `central: leaderInstance=central-a` - `site: leaderInstance=central-a` So the site group header reads "Leader · central-a" (a node in a different Akka cluster), and neither site card shows the Leader chip. This is the only environment with a real HA pair, which is where operators read leadership during failover. This is inferred from the documented QA layout; the QA overlay is deployed-only and was not read. **Recommendation** In `ResolveGroup`, resolve against `members` first and fall back to `allInstances` only if no member matches. Add a `LeaderResolverTests` case with two co-located groups. Then revisit the CLAUDE.md / `deployment.md` guidance: with the fix, the VD03 `127.0.0.1` workaround also becomes unnecessary. **Resolution** _Unresolved._
dohertj2 added the type:review-findingpriority:p2 labels 2026-11-09 14:39:23 -05:00
Author
Owner

Fixed on main 6c81c0b (Overview-002 → Resolved): leader matched only against the group's own members (QA site group no longer shows central-a). Deliberately dropped the recommended whole-app fallback (it reintroduces the bug when a member doesn't match by host); an unmatched leader shows its raw address. Limit: two members of one group on one host are indistinguishable. Overview/CLAUDE.md and deployment.md §7 corrected. Evidence: Overview 195/195, Theme 65/65, GalaxyRepository 74/74; each regression test failed before its fix; code-reviews --check consistent.

Fixed on main 6c81c0b (Overview-002 → Resolved): leader matched only against the group's own members (QA site group no longer shows central-a). Deliberately dropped the recommended whole-app fallback (it reintroduces the bug when a member doesn't match by host); an unmatched leader shows its raw address. Limit: two members of one group on one host are indistinguishable. Overview/CLAUDE.md and deployment.md §7 corrected. Evidence: Overview 195/195, Theme 65/65, GalaxyRepository 74/74; each regression test failed before its fix; code-reviews --check consistent.
Sign in to join this conversation.