From 746efb4c56b223a30282668f40a483504af5ca0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Jim=C3=A9nez=20S=C3=A1nchez?= Date: Mon, 10 Nov 2025 13:34:46 +0100 Subject: [PATCH] Provisioning: Include ref field in DELETE endpoint response for branch operations (#113615) Fix: Include ref field in DELETE endpoint response for branch operations When deleting a dashboard file via DELETE endpoint with a ref query parameter (for branch operations), the response was missing the ref field. This caused the frontend branch workflow success handler to fail silently. The issue was an inverted boolean condition in the Delete method. The code was setting file.Ref = opts.Ref when shouldUpdateGrafanaDB returned true (main branch operations), but it should have been setting it when false (branch operations), since we read the file with an empty ref. Fixed by inverting the condition from: if r.shouldUpdateGrafanaDB(opts, nil) to: if !r.shouldUpdateGrafanaDB(opts, nil) This ensures the ref field is properly included in the ResourceWrapper response for branch operations. --- pkg/registry/apis/provisioning/resources/dualwriter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/registry/apis/provisioning/resources/dualwriter.go b/pkg/registry/apis/provisioning/resources/dualwriter.go index 052771af700..62f4ffd3b98 100644 --- a/pkg/registry/apis/provisioning/resources/dualwriter.go +++ b/pkg/registry/apis/provisioning/resources/dualwriter.go @@ -100,7 +100,7 @@ func (r *DualReadWriter) Delete(ctx context.Context, opts DualWriteOptions) (*Pa } // HACK: manual set to the provided branch so that the parser can possible read the file - if r.shouldUpdateGrafanaDB(opts, nil) { + if !r.shouldUpdateGrafanaDB(opts, nil) { file.Ref = opts.Ref }