Files
Pulse/docs/release-control
rcourtman 4471dcaaba Fold chained manual links the same way in any link order (#2793)
Operator links that share a member form a chain, and `applyManualLinks`
used to apply them one at a time in store order, looking each member up
only among listed rows. Once an earlier link folded a member into
another row, a later link naming that member skipped. So a chain
depended on the order its links were stored in:

- Agent A linked into VM V, and V linked into storage W. A-V first folds
A into V and V into W. V-W first folds V into W, and A-V then finds V
gone, so A stays its own row.
- A saved host (continuity-only row) whose partner the published
registry had already folded into a third row answered for itself instead
of being held under that row.

Standing the row that holds a folded member in for it (an earlier
attempt) fixed neither: that row then outranked the link's own primary,
and the agent-into-guest direction was lost once the guest was folded.

## What changes

Links now apply as chains
(`internal/unifiedresources/manual_link_chains.go`).

- A link member resolves to its own row or the row a link folded it
into, and is judged by its own recorded shape (agent, hypervisor-managed
guest), not the shape of the row holding it. Shapes ride on the fold
records.
- Every connected set of observed members folds into one root.
Candidates are the members no link folds (every member on a direction
cycle; the chain's guests when every candidate is an agent). Candidate
rows compete by their own identity: guest, then non-agent over agent,
then the earliest-created link, then canonical ID. A single link and an
agreeing chain keep their last primary, as before.
- The spanning tree follows the fold records rows already carry before
any other link, so a refresh that recreates folded members folds them
back along their records. A row folding into another orients its records
away from an anchor (the surviving row's ID when its records name it,
else the linking member), so the surviving row is never recorded as
folded and every folded ID keeps resolving.
- Every link of the chain is recorded on the root (cycle-closing links
included, with each side's own sources), so report-merge can cut a
reported member from every path.
- Saved members never join a chain; they are held under the row their
partner survives in, found after the folds, by the same precedence.
- A joined Proxmox node+agent row records the fold of the node's own ID
before links resolve, so a second link naming it joins the chain in
either store order. A link a newer operator split separates is dropped
before the chain forms (both behaviours were already in the loop and are
kept).
- The monitor's rebuild holds the link pass back until the snapshot and
every record source except availability are ingested, then folds each
chain once over the assembled estate. Availability still comes last.
Live supplemental refresh and the read-state overlay still run a pass
per call.

## Evidence

New proofs rebuild each estate in every link order and compare the
monitor, its read-state overlay and a registry seeded from that read
state, then refresh each record source. Negative controls on pulse-dev
(each reverted):

- On main, 10 of 12 chain cases, the refresh case, the joined-node case,
the changed-link seed cases, the surviving-row hold case, the rebuild
case and the report-merge cycle case all fail; the other two chain cases
guard behaviour that already worked.
- A plain breadth-first tree, a path-only rehang, ranking a pre-fold row
for holds, no shapes on the joined-pair fold, recording the joined-pair
fold during link discovery, forcing the rebuild back to per-source
passes, dropping cycle-link records, and not carrying own sources each
fail the specific test written for them.
- Full `internal/unifiedresources` passes on the final tree (326s under
load); `internal/monitoring`, `internal/api/resourceapi`, `internal/api`
link/continuity/report tests, `internal/mock`, `internal/vmware` and a
full build passed on the tree before the last rebase. Two single
failures under machine load (`TestRetentionLoop_RunsInitialPrune`,
`TestJSONRPCSnapshotContinuesAfterTelemetryTimeout`) passed 6/6 and 8/8
in isolation, with main's link files as well.

## Not in this change

- The mock-mode fixture build (`internal/mock`) and the resources API's
snapshot-seeded fallback still run a pass per source, so a chain whose
answer depends on the order its members' sources arrive in can settle
differently there than in the monitor's rebuild. The contract says so; a
follow-up aligns the mock build.
- Production reaches the resources API's snapshot fallback only when the
monitor has published no unified listing.
2026-10-10 12:30:27 +01:00
..