feat(FN-3955): align mesh state hook contract with topology consumers

- Change useMeshState to expose NodeMeshState[] and unwrap API snapshot nodes in refresh and polling flows
- Update NodesView mesh topology rendering to consume the flattened hook result directly
- Revise mesh-state and NodesView tests to validate array-based contract and topology behavior
- Document the Nodes UI mesh topology contract in architecture docs

Fusion-Task-Id: FN-3955
This commit is contained in:
Fusion
2026-05-10 18:04:37 -07:00
committed by gsxdsm
parent 36b664309c
commit 7883a0f499
5 changed files with 78 additions and 53 deletions

View File

@@ -240,7 +240,7 @@ Lifecycle contract (`types.ts` `isValidApprovalRequestTransition`):
- Default behavior aggregates a deduped cluster snapshot from the local node plus reachable peers (`includeRemote !== false`) while preserving node-local last-known entries when peers are unreachable.
- `includeRemote=false` is the non-recursive local-only path used for peer fan-out, so cross-node aggregation never recursively calls remote aggregated endpoints.
- Route registration reuses the shared `options?.centralCore` instance when available instead of creating per-request `CentralCore` instances, preserving shared mesh state continuity.
- Nodes UI topology (`MeshTopology` via `useMeshState`) now renders peer relationships from `knownPeers` in this snapshot, including remote↔remote links when present.
- Nodes UI topology consumes a dedicated `useMeshState` hook that unwraps the `/api/mesh/state` snapshot into `NodeMeshState[]`; `MeshTopology` renders peer relationships directly from each node's `knownPeers` (including remote↔remote links) without fabricating local-star fallback edges.
### Shared mesh-state snapshot helpers