Repository navigation
feat(deleter): count live resources that block a project or org delete - #2005
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 39391455810Coverage increased (+0.06%) to 55.547%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
There was a problem hiding this comment.
Looks good. It matches the agreed design, and the final config works with no code change, as you said. The small notes are inline.
One question: transfer, download and store have no project rule, so a project that holds one can never be deleted. That is fine while they stay org scoped. Can you confirm Courier will never attach them to a project?
Two test cases are missing: an org with no projects, and a project with no resources.
Yes. They are registered with
Added both in b265947. |
ProjectResourceBlockers and OrganizationResourceBlockers return one RESOURCES_EXIST blocker per namespace, with the number of live resources that the app.deletion rules say block the delete. The org check judges the resources of its projects by the organization rules. Nothing calls them yet.
Also drops comments the names already cover, and adds tests for an org with no projects and a project with no resources.
b265947 to
2f35048
Compare
Summary
Adds
ProjectResourceBlockersandOrganizationResourceBlockersto the cascade deleter. Each returns oneRESOURCES_EXISTblocker per namespace, withCountset to the number of live resources that theapp.deletionrules say block the delete. Both return nothing while the block is disabled. Nothing calls them yet. Stacked on #2004.Changes
core/deleter/deleter.go:BlockerResourcesExist,SubjectResourceNamespaceandBlocker.Count. A resource blocker has no message; a client builds the text from the namespace inSubjectand fromCount.core/deleter/resource_blockers.go:projectrules.organizationrules to all of them.allow, or its rule isblock_unless_deletableand its metadata has the boolean"deletable": true. A namespace or delete with no rule blocks.A project with two
compute/machineresources (project: block) and onecompute/orderresource without"deletable": true(project: block_unless_deletable) gets:Test Plan
core/deleter/service_test.goTestProjectResourceBlockers: nothing is read while disabled; counts per namespace, where only the booleandeletable: truecounts and a namespace or delete with no rule blocks; nothing blocks; a list error.TestOrganizationResourceBlockers: nothing is read while disabled; the organization's own and its projects' resources are judged by the organization rules, with counts added across projects; list errors for the organization's resources, its projects, and a project's resources.go test ./core/deleter/...passes.golangci-lint run ./...reports no issues.