Repository navigation
feat(deleter): add the app.deletion config for resource delete rules - #2004
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 Summary
Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
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
📒 Files selected for processing: 10
cmd/serve.goconfig/config_test.goconfig/sample.config.yamlconfig/testdata/deletion.yamlcore/deleter/config.gocore/deleter/config_test.gocore/deleter/service.gocore/deleter/service_test.godocs/content/docs/reference/configurations.mdxpkg/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.
Coverage Report for CI Build 39113810886Coverage increased (+0.03%) to 55.276%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Summary
Adds an
app.deletionblock 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.blockblock_unless_deletable"deletable": true.allowA namespace or delete with no rule blocks.
Changes
core/deleter/config.go:Config,Rules,Rule,ParentandValidate. Theproject/organizationkeys are a map, so a misspelled key reachesValidateinstead of being dropped by the config loader.pkg/server/config.go:Deletionatapp.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.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 notprojectororganization, 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.goTestLoadDeletion: the block loads from YAML withservice/namekeys;FRONTIER_SERVICE_APP_DELETION_ENABLED=falseturns it off; a misspelled key in the file failsValidate.go testpasses forcore/deleter,config,pkg/serverandinternal/api/v1beta1connect.golangci-lint run ./...reports no issues.