Skip to content

feat(deleter): count live resources that block a project or org delete - #2005

Open
AmanGIT07 wants to merge 1 commit into
feat/deletion-configfrom
feat/deletion-resource-blockers
Open

AmanGIT07 wants to merge 1 commit into
feat/deletion-configfrom
feat/deletion-resource-blockers

Conversation

@AmanGIT07

Copy link
Copy Markdown
Contributor

Summary

Adds ProjectResourceBlockers and OrganizationResourceBlockers to the cascade deleter. Each returns one RESOURCES_EXIST blocker per namespace, with Count set to the number of live resources that the app.deletion rules 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, SubjectResourceNamespace and Blocker.Count. A resource blocker has no message; a client builds the text from the namespace in Subject and from Count.
  • core/deleter/resource_blockers.go:
    • The project check lists the project's live resources and applies the project rules.
    • The organization check lists the organization's own resources and the resources of every project in the organization, disabled projects included, and applies the organization rules to all of them.
    • A resource blocks unless its rule is allow, or its rule is block_unless_deletable and its metadata has the boolean "deletable": true. A namespace or delete with no rule blocks.
    • Blockers are sorted by namespace.

A project with two compute/machine resources (project: block) and one compute/order resource without "deletable": true (project: block_unless_deletable) gets:

[]deleter.Blocker{
	{Type: "RESOURCES_EXIST", Subject: "compute/machine", SubjectType: "resource_namespace", Count: 2},
	{Type: "RESOURCES_EXIST", Subject: "compute/order", SubjectType: "resource_namespace", Count: 1},
}

Test Plan

  • core/deleter/service_test.go TestProjectResourceBlockers: nothing is read while disabled; counts per namespace, where only the boolean deletable: true counts 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.

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.
@vercel

vercel Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
frontier Ready Ready Preview Oct 18, 2026 9:03am UTC

@coderabbitai

coderabbitai Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: raystack/frontier/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0c12412e-dd30-44f3-9cdb-ba77be544bd3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 39113827779

Coverage increased (+0.06%) to 55.334%

Details

  • Coverage increased (+0.06%) from the base build.
  • Patch coverage: 54 of 54 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 41810
Covered Lines: 23135
Line Coverage: 55.33%
Coverage Strength: 19.17 hits per line

💛 - Coveralls

This branch was successfully deployed

1 active deployment
Preview — 001ba8cc Deployed Oct 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants