Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
Coverage Report for CI Build 39458684805Coverage increased (+0.03%) to 55.62%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
DeleteProject runs the RESOURCES_EXIST check and returns a BlockedError naming the project, which the API answers with failed_precondition and one violation per blocking namespace. The org delete removes its projects without that check. An unknown project or an id that is not a uuid answers not found. The API e2e suite runs with the deletion config on.
26f3314 to
da8dac4
Compare
|
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: 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 |
|---|---|---|
| The refused project is untouched | row live, 5 live | row live, 5 live |
| Delete by an org viewer (no delete permission) | permission_denied | permission_denied |
| Delete an empty project (owner) | ok | ok |
| Delete the first project above after deleting its 4 blocking resources | ok | ok |
CheckProjectDelete on an org's project holding an AOI |
can_delete=false, blockers=[('resource/aoi', 1)] | can_delete=false, blockers=[('resource/aoi', 1)] |
DeleteOrganization on that org (project rules do not apply) |
ok | ok |
With enabled: false, delete that project |
ok | ok |
Summary
DeleteProjectnow refuses while the project's resources block the delete, using theRESOURCES_EXISTcheck from #2005. The refusal isfailed_preconditionwith onegoogle.rpc.PreconditionFailureviolation per blocking namespace. The organization delete removes its projects without the project check, so a resource that blocks a project delete does not stop an organization delete. No delete is refused whileapp.deletionis disabled.Changes
core/deleter/service.go:DeleteProjectlooks the project up by id withIncludeDisabled. A missing project returnsproject.ErrNotExist; an id that is not a uuid returnsproject.ErrInvalidUUID.ProjectResourceBlockers, and returns aBlockedErrornaming the project when anything blocks.deleteProjectholds the removal steps, unchanged.DeleteOrganizationcalls it for each project.core/deleter/deleter.go:BlockedErrorgainsProjectID.Error()names the project or the organization and leaves out empty messages, so a project refusal readsproject cannot be deleted yet.internal/api/v1beta1connect/deleter.go:DeleteProjectanswersfailed_preconditionwith the blockers, andnot_foundfor a missing project or an id that is not a uuid. The blocked-delete log lines carryproject_idand no longer say organization.test/e2e/regression/api_test.go: the API suite runs withapp.deletionenabled and a rule forcompute/order(project: block,organization: allow).Technical Details
failed_preconditionis HTTP 400. A violation carries the blocker type and the namespace;PreconditionFailurehas no field for the count.DeleteProjectwith a project name answered 500 before; it now answersnot_found.Test Plan
core/deleter/service_test.goTestDeleteProject: a blocked project returns theBlockedErrorand removes nothing; a missing project returnsproject.ErrNotExist; a name returnsproject.ErrInvalidUUID; the existing removal cases expect the lookup.TestDeleteOrganization: with the deletion config on, an org whose project holds a resource that blocks a project delete is deleted, and the resource is removed.internal/api/v1beta1connect/deleter_test.goTestHandler_DeleteProject: a blocked delete answersfailed_preconditionwith oneRESOURCES_EXISTviolation; a missing project and a name answernot_found.TestProjectDeleteRefusedWhileResourcesBlock: a project holding acompute/orderresource is refused with that violation and stays readable; after the resource is deleted, the project delete succeeds; an org whose project still holds the resource is deleted.go test ./core/... ./internal/api/... ./pkg/server/...passes.TestEndToEndAPIRegressionTestSuite,TestEndToEndServiceUsersRegressionTestSuiteandTestEndToEndPATRegressionTestSuitepass.golangci-lint run ./core/deleter/... ./internal/api/v1beta1connect/... ./test/e2e/regression/...reports no issues.