mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-25 12:52:25 +00:00
5321c8b7a2
Discovery records for Proxmox guests (VM / system-container) are canonically keyed by node name + VMID — the form the background fingerprint loop and the Assistant prefetch already use. But the browser action path addresses guests by the linked agent UUID (discoveryTarget.agentId, the action-authorization target), and normalizeDiscoveryRequest was a no-op for guest types — so a UUID-targeted trigger/lookup stored and read records under a second, divergent key. Result: the resource drawer reported "Not discovered" for a guest the background loop had already discovered, and duplicate records accumulated (node-keyed + UUID-keyed). normalizeDiscoveryRequest now canonicalizes guest targets to the node name: resolve a linked-agent-UUID target back to its hosting node (node->linked-agent map, falling back to the agent host's hostname when it is a known node). Both creation (DiscoverResource) and lookup (GetDiscoveryByResource) funnel through this chokepoint, so every path converges on the node-name key; the caller already aliases the original target, so pre-existing UUID-keyed records are still found and consolidated onto the canonical key on the next run. The agent UUID is unchanged as the action-authorization target — this governs only the record key, so the discoveryTarget security contract is untouched. - Test: TestService_ProxmoxGuestDiscoveryCanonicalizesToNodeKey. - Live-verified on the dev instance: the Home Assistant LXC drawer readiness went missing -> fresh (discoveryId system-container:delly:101).