Skip to content

feat(deleter): add the app.deletion config for resource delete rules - #2004

Merged
AmanGIT07 merged 1 commit into
mainfrom
feat/deletion-config
Oct 20, 2026
Merged

AmanGIT07 merged 1 commit into
mainfrom
feat/deletion-config

Conversation

@AmanGIT07

@AmanGIT07 AmanGIT07 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds an app.deletion block to the server config. It gives each resource namespace one rule for a project delete and one for an organization delete. The block is off by default. #2005 adds the check that reads the rules.

app:
  deletion:
    enabled: true
    resources:
      compute/machine: { project: block, organization: allow }
      compute/order: { project: block_unless_deletable, organization: block_unless_deletable }
      storage/file: { organization: allow }
Rule What it does
block Any live resource blocks the delete.
block_unless_deletable A live resource blocks the delete unless its metadata has "deletable": true.
allow Never blocks the delete.

A namespace or delete with no rule blocks.

Changes

  • core/deleter/config.go: Config, Rules, Rule, Parent and Validate. The project / organization keys are a map, so a misspelled key reaches Validate instead of being dropped by the config loader.
  • pkg/server/config.go: Deletion at app.deletion.
  • cmd/serve.go: validates the block at boot, next to the consent check, and passes it to the cascade deleter.
  • core/deleter/service.go: the deleter keeps the config for the check.
  • Sample config and the configuration reference docs.

When the block is enabled, boot fails if no resources are listed, a namespace key is not shaped like service/name, a namespace has no rules, an inner key is not project or organization, or a rule is not one of the three.

Test Plan

  • core/deleter/config_test.go: every rule is accepted; a disabled block is not checked; no resources; no rules; unknown keys; unknown rules, including an empty one; malformed namespaces.
  • config/config_test.go TestLoadDeletion: the block loads from YAML with service/name keys; FRONTIER_SERVICE_APP_DELETION_ENABLED=false turns it off; a misspelled key in the file fails Validate.
  • go test passes for core/deleter, config, pkg/server and internal/api/v1beta1connect.
  • golangci-lint run ./... reports no issues.

app.deletion gives each resource namespace a rule for a project delete and
for an organization delete: block, block_unless_deletable or allow. A
namespace or delete with no rule blocks. The block is off by default and
is checked at boot. Nothing reads the rules 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

Review in Change Stack →

📝 Summary

Summary by CodeRabbit

  • New Features
    • Added configurable safeguards for project and organization deletions involving live resources. Rules can block deletion, allow it, or block it unless the resource is marked deletable.
    • Deletions are blocked when no matching namespace or delete-type rule is configured. Safeguards are disabled by default.
    • Invalid enabled deletion rules now produce a configuration error during startup.
  • Documentation
    • Added configuration examples and reference guidance for deletion rules and their behavior.

The change adds configurable deletion rules, validates enabled rules during startup, and passes the configuration to the cascade deleter. It also adds configuration samples, tests, and reference documentation.

Changes: Deletion configuration

Layer / File(s) Summary
Deletion rule contract and validation
core/deleter/config.go, core/deleter/config_test.go
Adds configuration types and validation for resources, parent keys, namespaces, and supported rules. Tests cover valid and invalid configurations.
Application configuration and reference
pkg/server/config.go, config/config_test.go, config/sample.config.yaml, config/testdata/deletion.yaml, docs/content/docs/reference/configurations.mdx
Adds the deletion configuration field, sample settings, loading tests, and documentation for rule behavior and validation.
Startup validation and deleter wiring
cmd/serve.go, core/deleter/service.go, core/deleter/service_test.go
Validates deletion configuration during dependency construction and passes it to the cascade deleter, which stores it in the service.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Suggested reviewers: whoabhisheksah, rohilsurana

Merge Risk: 🔵 Low · up to cb42d

Operators could enable the documented rules expecting them to block deletes, although they currently do not. Clarify the sample and reference before users rely on that protection.

Pre-merge checks: Passed 2
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: raystack/frontier/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 31541d4a-7f6a-4a29-a2c6-4ade8fb766cd
📥 Commits

Reviewing files that changed from the base of the PR and between 4098c75 and cb42d94.

📒 Files selected for processing: 10
  • cmd/serve.go
  • config/config_test.go
  • config/sample.config.yaml
  • config/testdata/deletion.yaml
  • core/deleter/config.go
  • core/deleter/config_test.go
  • core/deleter/service.go
  • core/deleter/service_test.go
  • docs/content/docs/reference/configurations.mdx
  • pkg/server/config.go

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Comment thread docs/content/docs/reference/configurations.mdx
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 39113810886

Coverage increased (+0.03%) to 55.276%

Details

  • Coverage increased (+0.03%) from the base build.
  • Patch coverage: 4 uncovered changes across 1 file (31 of 35 lines covered, 88.57%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
cmd/serve.go 4 0 0.0%
Total (3 files) 35 31 88.57%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 41756
Covered Lines: 23081
Line Coverage: 55.28%
Coverage Strength: 19.17 hits per line

💛 - Coveralls

@AmanGIT07
AmanGIT07 requested a review from rohilsurana October 18, 2026 09:34

@rohilsurana rohilsurana left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. It matches the agreed design and the boot checks cover the cases listed.

@AmanGIT07
AmanGIT07 merged commit 32d339a into main Oct 20, 2026
8 checks passed
@AmanGIT07
AmanGIT07 deleted the feat/deletion-config branch October 20, 2026 08:08

This branch was successfully deployed

1 active deployment
Preview — cb42d942 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.

3 participants