fix(project): add transactional plugin deletion lifecycle hook - #9091
Open
muzamilkm wants to merge 1 commit into
Open
fix(project): add transactional plugin deletion lifecycle hook#9091muzamilkm wants to merge 1 commit into
muzamilkm wants to merge 1 commit into
Conversation
muzamilkm
force-pushed
the
fix/project-deletion-hook
branch
3 times, most recently
from
September 1, 2026 19:18
f63766d to
71f6365
Compare
…e#9081) Project deletion deletes core DevLake records directly without exposing a lifecycle hook for plugins that maintain project-scoped state. While project renames provide a lifecycle extension through ProjectService.RenameProject, there was no equivalent hook for project deletion. This commit: - Introduces optional plugin.ProjectDeleteHook in core/plugin - Traverses registered plugins via plugin.TraversalPlugin during DeleteProject - Executes hooks, blueprint cleanup, and project deletion inside a single transaction - Provides BlueprintManager.DeleteBlueprintInTransaction to participate in caller transaction - Adds comprehensive unit tests covering hook dispatch, veto rollback, and atomic deletion Closes apache#9081 Signed-off-by: Muzamil Kaleem <113013457+muzamilkm@users.noreply.github.com>
muzamilkm
force-pushed
the
fix/project-deletion-hook
branch
from
September 1, 2026 19:33
71f6365 to
c00fdf7
Compare
muzamilkm
marked this pull request as ready for review
September 1, 2026 19:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DELETE /projects/:projectNamedeletes core project state directly, but plugins had no deletion lifecycle extension point. A plugin that persists state tied to a DevLake project therefore had no way to validate or clean up that state when deletion went through the core API.This PR:
plugin.ProjectDeleteHookalongside the existing project-related plugin contractsplugin.TraversalPluginbefore core project deletionBlueprintManager.DeleteBlueprintInTransactionso blueprint cleanup can participate in the caller's transaction while preserving the existingDeleteBlueprint(id)entry pointExisting plugins do not need to implement
ProjectDeleteHookunless they persist state whose lifecycle is tied to a DevLake project.Does this close any open issues?
Closes #9081
Screenshots
N/A
Other Information
Backwards compatibility
ProjectServiceremains unchanged and still only requiresRenameProject(...).ProjectDeleteHookis a separate optional plugin interface, so existing plugins and existingProjectServiceimplementations remain source-compatible.The existing
BlueprintManager.DeleteBlueprint(id)entry point is preserved.DeleteBlueprintInTransactiononly provides a transaction-aware path for callers that already own a transaction.There are no schema, migration, HTTP API, Config UI or Grafana changes in this PR.
Validation
From
backend/:All of the above pass locally.
The new hook contract is documented in core/plugin. No user-facing documentation changes are required.