@@ -33,9 +33,9 @@ type DiffCalculator interface {
3333 // Returns: (diffs map, rendered resource keys, error)
3434 CalculateNonRemovalDiffs (ctx context.Context , xr * cmp.Unstructured , desired render.Outputs ) (map [string ]* dt.ResourceDiff , map [string ]bool , error )
3535
36- // DetectRemovedResources identifies resources that exist in the cluster but are not
36+ // CalculateRemovedResourceDiffs identifies resources that exist in the cluster but are not
3737 // in the rendered set. This is called after nested XR processing is complete.
38- DetectRemovedResources (ctx context.Context , xr * un.Unstructured , renderedResources map [string ]bool ) (map [string ]* dt.ResourceDiff , error )
38+ CalculateRemovedResourceDiffs (ctx context.Context , xr * un.Unstructured , renderedResources map [string ]bool ) (map [string ]* dt.ResourceDiff , error )
3939}
4040
4141// DefaultDiffCalculator implements the DiffCalculator interface.
@@ -231,23 +231,6 @@ func (c *DefaultDiffCalculator) CalculateNonRemovalDiffs(ctx context.Context, xr
231231 return diffs , renderedResources , nil
232232}
233233
234- // DetectRemovedResources identifies resources that exist in the cluster but are not in the rendered set.
235- // This should be called after all nested XRs have been processed to avoid false positives.
236- func (c * DefaultDiffCalculator ) DetectRemovedResources (ctx context.Context , xr * un.Unstructured , renderedResources map [string ]bool ) (map [string ]* dt.ResourceDiff , error ) {
237- xrName := xr .GetName ()
238- c .logger .Debug ("Finding resources to be removed" , "xr" , xrName , "renderedCount" , len (renderedResources ))
239-
240- removedDiffs , err := c .CalculateRemovedResourceDiffs (ctx , xr , renderedResources )
241- if err != nil {
242- c .logger .Debug ("Error calculating removed resources" , "error" , err )
243- return nil , err
244- }
245-
246- c .logger .Debug ("Removal detection complete" , "removedCount" , len (removedDiffs ), "xr" , xrName )
247-
248- return removedDiffs , nil
249- }
250-
251234// CalculateDiffs computes all diffs including removals for the rendered resources.
252235// This is the primary method that most code should use.
253236func (c * DefaultDiffCalculator ) CalculateDiffs (ctx context.Context , xr * cmp.Unstructured , desired render.Outputs ) (map [string ]* dt.ResourceDiff , error ) {
@@ -258,7 +241,7 @@ func (c *DefaultDiffCalculator) CalculateDiffs(ctx context.Context, xr *cmp.Unst
258241 }
259242
260243 // Then detect removed resources
261- removedDiffs , err := c .DetectRemovedResources (ctx , xr .GetUnstructured (), renderedResources )
244+ removedDiffs , err := c .CalculateRemovedResourceDiffs (ctx , xr .GetUnstructured (), renderedResources )
262245 if err != nil {
263246 return nil , err
264247 }
0 commit comments