Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Keep the root identity anchor in the first decoded raw field map
pulse-triage[bot]4f1dc52bc3f3
diff --git a/internal/websocket/state_delta.go b/internal/websocket/state_delta.goindex 8d638fc928..38b667088f 100644--- a/internal/websocket/state_delta.go+++ b/internal/websocket/state_delta.go@@ -310,27 +310,13 @@ func createJSONMergePatch(previous, current json.RawMessage) (json.RawMessage, eif !json.Valid(previous) || !json.Valid(current) {return nil, fmt.Errorf("invalid JSON merge value")}- patch, changed, err := diffRawJSONMergeValue(previous, current)+ patch, changed, err := diffRawJSONMergeValue(previous, current, true)if err != nil {return nil, err}if !changed {return json.RawMessage(`{}`), nil}- // Preserve the existing identity anchor for changed object entries.- if rawJSONObject(current) && rawJSONObject(patch) {- var object, patchObject map[string]json.RawMessage- if err := json.Unmarshal(current, &object); err != nil {- return nil, err- }- if id, ok := object["id"]; ok {- if err := json.Unmarshal(patch, &patchObject); err != nil {- return nil, err- }- patchObject["id"] = id- return json.Marshal(patchObject)- }- }return patch, nil}@@ -341,7 +327,7 @@ func rawJSONObject(value json.RawMessage) bool {// Inputs here are validated by createJSONMergePatch. Raw equality is only a// fast positive match, never a content hash, source-ID hint or freshness test.-func diffRawJSONMergeValue(previous, current json.RawMessage) (json.RawMessage, bool, error) {+func diffRawJSONMergeValue(previous, current json.RawMessage, anchorIdentity bool) (json.RawMessage, bool, error) {if bytes.Equal(previous, current) {return nil, false, nil}@@ -358,6 +344,15 @@ func diffRawJSONMergeValue(previous, current json.RawMessage) (json.RawMessage,if !changed {return nil, false, nil}+ if anchorIdentity {+ if object, ok := patch.(map[string]interface{}); ok {+ if currentObject, ok := after.(map[string]interface{}); ok {+ if id, exists := currentObject["id"]; exists {+ object["id"] = id+ }+ }+ }+ }encoded, err := json.Marshal(patch)return encoded, true, err}@@ -380,7 +375,7 @@ func diffRawJSONMergeValue(previous, current json.RawMessage) (json.RawMessage,patch[key] = valuecontinue}- nested, changed, err := diffRawJSONMergeValue(old, value)+ nested, changed, err := diffRawJSONMergeValue(old, value, false)if err != nil {return nil, false, err}@@ -391,6 +386,12 @@ func diffRawJSONMergeValue(previous, current json.RawMessage) (json.RawMessage,if len(patch) == 0 {return nil, false, nil}+ // Preserve the existing identity anchor without decoding current twice.+ if anchorIdentity {+ if id, ok := after["id"]; ok {+ patch["id"] = id+ }+ }encoded, err := json.Marshal(patch)return encoded, true, err}