Files
Pulse/docs/release-control
rcourtman f74fa7b2fb Carry the PBS-reported node name into the connections ledger (#2794)
A PBS machine that was configured by IP or DNS alias still showed in
connected systems as an API row plus a separate host-agent row, even
though the PBS node and the agent report the same hostname.

## Why

The PBS poll records the hostname the node reports about itself
(`PBSInstance.NodeName`) so `/api/connections` can alias the PBS
connection by it and group the agent running on that machine into the
PBS row. The name reaches the unified PBS resource (`PBSData.NodeName`),
but `Monitor.PBSInstancesSnapshot()` rebuilds each instance from the
read-state view, and the view had no accessor for it. The snapshot
therefore always carried an empty `NodeName`, the ledger's reported-name
map was always empty, and the alias never reached `HostAliases`.

The node name was added on 2026-08-01 (397cad802c), after
`pbsInstanceFromReadStateView` already existed, so it has never worked
on this path. The existing tests missed it because they hand the
aggregator its inputs instead of going through the monitor.

## Change

- `PBSInstanceView.NodeName()` exposes `PBSData.NodeName`, distinct from
`Hostname()` (the host of the configured endpoint).
- `pbsInstanceFromReadStateView` copies it. This is the only place a
`models.PBSInstance` is rebuilt from the view.

## Proof

- `TestMonitorPBSInstancesSnapshotCarriesReportedNodeName`: the unified
resource keeps the name (control assertion) and the snapshot must too.
- `TestConnectionsLedger_GroupsHostAgentWithPBSByReportedNodeName`: a
real monitor through `buildAggregatorInputsWithRuntimeSources`,
`buildConnections` and `buildConnectionSystems`. The PBS connection's
`HostAliases` include the reported name and a host agent whose hostname
equals it attaches to the PBS system.
- `TestView_PBSAndPMGInstanceViewAccessors` pins the accessor.
- Negative control: with the one-line conversion change reverted, the
snapshot test fails (`NodeName = ""`) and the ledger test fails (`pbs
host aliases = [backup 192.0.2.40]`). With it, all pass, alongside the
existing alias and grouping tests.

## Limits

- Only direct `root@pam` sessions can read the node name (API-token and
non-superuser connections get none, see the monitoring contract), so
this restores grouping for password-auth PBS connections only.
Token-auth connections still match on what they were configured with.
- The PBS resource's identity hostnames are deliberately unchanged; this
does not alter registry linking.
- The pre-push frontend lint and type-check did not run in the private
clone used for this change (no `node_modules`); the diff touches no
frontend files.
2026-10-10 13:06:59 +01:00
..