Repository navigation
feat(deleter): project delete publishes the app.project.deleted event - #2014
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 50 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage Report for CI Build 39895435488Coverage remained the same at 55.72%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
|
Sandbox run: a local Frontier server with Postgres and SpiceDB in Docker, called over the Connect protocol. The binary was built from #2014 with #2011 applied, so it has main plus #2008, #2011, #2013 and #2014. Deletion config used (for the projects with resources): app:
deletion:
enabled: true
resources:
resource/aoi: { project: block, organization: allow }
resource/workflow: { project: block, organization: allow }
resource/orderitem: { project: block_unless_deletable, organization: block_unless_deletable }
resource/insight: { project: allow, organization: allow }
|
| Check | Expected | Observed |
|---|---|---|
| Delete an empty project | 1 | 1 |
| Delete a project after its blocking resources were deleted | 1 | 1 |
| Delete a disabled project holding an insight | 1 | 1 |
| Delete an org with two projects, one disabled: events per project | 1, 1 | 1, 1 |
The project.deleted audit records for the same deletes were written as before:
| Check | Expected | Observed |
|---|---|---|
Delete an empty project: project.deleted audit records |
1 | 1 |
| Delete an org with two projects: audit records per project | 1, 1 | 1, 1 |
9b57ea6 to
54f916c
Compare
7f56a17 to
8a77632
Compare
8a77632 to
1cdfbdc
Compare
487ee5d to
46950f2
Compare
1cdfbdc to
7ebbe5a
Compare
The project delete now publishes app.project.deleted once the project row is deleted, for the DeleteProject RPC and for each project an org delete removes. A project that was already gone publishes nothing.
7ebbe5a to
ebe0dd5
Compare
Summary
The project delete now publishes the
app.project.deletedevent. The event name already existed and is offered as a webhook event, but nothing published it; project created, updated, and member events were already published. It goes out once the project row is deleted, for theDeleteProjectRPC and for each project an organization delete removes, the same way the organization delete publishesapp.organization.deleted. Stacked on #2013.Changes
core/deleter/service.go: afterDeleteModel,deleteProjectpublishesapp.project.deletedwith the project as the target and the project's organization. A project that was already gone returns without an event. A failure to publish is logged and does not fail the delete.Test Plan
core/deleter/service_test.goTestDeleteProject: a delete publishes oneapp.project.deletedevent with the project's organization and the project as the target; a project that was already gone publishes nothing.TestProjectDeleteKeepsTheRowAndRemovesAccess: oneapp.project.deletedevent for the project after the delete.TestOrganizationDeleteAlsoDeletesDisabledProjectsAndGroups: oneapp.project.deletedevent for each project of the deleted organization, the disabled one included.go test ./core/... ./internal/api/... ./pkg/server/...passes.TestEndToEndAPIRegressionTestSuite,TestEndToEndServiceUsersRegressionTestSuiteandTestEndToEndPATRegressionTestSuitepass.golangci-lint run ./core/deleter/... ./test/e2e/regression/...reports no issues.