bujjibabukatta opened a new pull request, #9083:
URL: https://github.com/apache/devlake/pull/9083

   ### Summary
   Fixes #9081. The generic `DELETE /projects/:projectName` flow
   (`services.DeleteProject`) has no lifecycle hook for plugins/features
   with project-scoped state, unlike `PatchProject`'s rename flow, which
   already calls `projectService.RenameProject(...)`. Feature-owned
   records can be left stale or orphaned when a project is deleted
   directly through this endpoint.
   
   ### Root Cause
   `ProjectService` only defines `RenameProject`. `DeleteProject` deletes
   core records (project, mappings, metric settings, blueprint) with no
   equivalent extension point, so any plugin/feature relying on its own
   project-deletion flow to clean up state never gets invoked when
   deletion happens through the core API.
   
   ### Fix
   - Added `ProjectDeleteHook`, a separate optional interface (not a new
     required method on `ProjectService`), so existing downstream
     implementations that only support renaming aren't broken.
   - `DeleteProject` now checks via type assertion whether the injected
     `projectService` also implements `ProjectDeleteHook`, and if so
     invokes it inside the same deletion transaction, before core rows
     are deleted — a hook error rolls back the whole deletion, and any
     cleanup it performs commits atomically with core deletion.
   
   **Known limitation:** `deleteProjectBlueprint(name)` runs before the
   transaction/hook, so a hook veto can't stop the blueprint from already
   being deleted. Not addressed in this PR — flagging for a possible
   follow-up.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to