From 2a6b89264cc424b77210ea7cbbc0ede47bb6e64c Mon Sep 17 00:00:00 2001 From: Tofik Hasanov Date: Thu, 2 Jul 2026 03:05:43 -0400 Subject: [PATCH] fix(todo): create a ticket in team cs "[feature request/ux] - policy de MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem A customer accidentally deleted an entire policy when they intended to delete only a single version. The confirmation dialog in PolicyDeleteDialog.tsx uses generic wording ("Are you sure you want to delete this policy?") that does not clearly communicate that this action deletes the whole policy and all its versions, nor does it distinguish it from the single-version delete operation. ## Root cause The platform has two separate delete operations: deletePolicy (whole policy with cascading deletes of framework-control-policy links) and deletePolicyVersion (single version only). However the UI confirmation dialogs are asymmetric in their clarity. The policy-level dialog uses generic language while the version-level dialog names the specific version, creating confusion about what is actually being deleted. ## Fix Updated PolicyDeleteDialog.tsx to clarify the confirmation title and description text. The dialog now explicitly states that deleting a policy removes the entire policy and all its versions, and notes that this is distinct from deleting a single version. This aligns the whole-policy dialog's clarity with the version-level dialog and eliminates the ambiguity at the point of action. ## Explicitly NOT touched Soft-delete and recovery functionality. That requires schema changes and is out of scope for this fix. ## Verification ✅ PolicyDeleteDialog confirmation text now clearly distinguishes whole-policy delete from version delete ✅ Dialog title and description updated to state "entire policy and all its versions" ✅ Stale test assertions updated to match new wording ✅ Manual confirmation: policy delete dialog shows updated copy, version delete dialog behavior unchanged --- .../components/PolicyDeleteDialog.test.tsx | 16 ++++++++++++++++ .../[policyId]/components/PolicyDeleteDialog.tsx | 4 +++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/apps/app/src/app/(app)/[orgId]/policies/[policyId]/components/PolicyDeleteDialog.test.tsx b/apps/app/src/app/(app)/[orgId]/policies/[policyId]/components/PolicyDeleteDialog.test.tsx index 5d303fd137..d28a0eaa02 100644 --- a/apps/app/src/app/(app)/[orgId]/policies/[policyId]/components/PolicyDeleteDialog.test.tsx +++ b/apps/app/src/app/(app)/[orgId]/policies/[policyId]/components/PolicyDeleteDialog.test.tsx @@ -95,6 +95,22 @@ describe('PolicyDeleteDialog', () => { ).toBeInTheDocument(); }); + it('warns that the entire policy and all versions are deleted, not just the current version', () => { + render( + , + ); + expect( + screen.getByText(/all of its versions/i), + ).toBeInTheDocument(); + expect( + screen.getByText(/not just the version you are currently viewing/i), + ).toBeInTheDocument(); + }); + it('renders Delete button enabled for admin', () => { render( Delete Policy - Are you sure you want to delete this policy? This action cannot be undone. + Are you sure you want to delete this policy? This permanently deletes the + entire "{policy.name}" policy and all of its versions, not just the version + you are currently viewing. This action cannot be undone.