Project

General

Profile

Edit Copy Actions

Feature #10976

open

Customer Delete Idempotency & Multi-Tenant Concurrency Safety

Added by Ramu Kodali about 22 hours ago.

Status:
New
Priority:
Normal
Assignee:
Target version:
-
Start date:
09/14/2026
Due date:
09/14/2026 (9 days late)
% Done:

0%

Estimated time:
8:00 h
Spent time:

Description

Comprehensive investigation, defensive re-architecture, and bug resolution for customer deletion in multi-tenant environments, enforcing idempotent deletion semantics (customerService.js, customerController.js, ClientList.tsx).

Problem Identification:
Users reported encountering an alarming "Customer not found" error notification when attempting to delete customer records. Detailed analysis revealed that this was caused by stale table rows in browser sessions that had not been refreshed after another user or tab had already removed the customer from the database. Although frontend double-click prevention was active, the backend responded with an unhandled 404/500 error when receiving a delete command for an already-purged customer record.

Technical Remediation & Idempotency:
1. Idempotent Deletion Handler:
- Refactored deleteCustomer in customerService.js to conform to idempotent RESTful design principles.
- If a customer ID is already marked deleted or is absent from the tenant database, the endpoint now quietly returns a 200 OK success response rather than throwing a disruptive error, confirming the desired end state (customer does not exist) is achieved.
- Maintained strict validation for customer restoration operations (restoreCustomer), ensuring that attempting to restore a nonexistent ID still properly returns an informative error.
2. Multi-Tenant Reference Cleanup:
- Ensured cascade cleanup safely detaches or soft-deletes associated quotation drafts, survey bookings, and stage tracking milestones without leaving orphaned foreign keys.
3. Client-Side State Synchronization:
- Updated client-side table state handling in ClientList.tsx to immediately remove rows upon deletion confirmation and trigger background list re-validation.
4. Concurrency & Regression Testing:
- Tested rapid concurrent delete requests and simulated multi-tab simultaneous deletions, verifying smooth error-free UI operation.


Add

Subtasks


Add

Related issues

Edit Copy Actions

Also available in: Atom PDF