• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

raystack / frontier / 27186856054
43%
main: 43%

Build:
Build:
LAST BUILD BRANCH: fix/prospect-rql-error-classification
DEFAULT BRANCH: main
Ran 09 Jun 2026 06:00AM UTC
Jobs 1
Files 276
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

09 Jun 2026 05:55AM UTC coverage: 43.495% (+0.01%) from 43.481%
27186856054

Pull #1683

github

whoAbhishekSah
fix(role): reject deletion of a role still in use by policies

Deleting a role used to strip its app/role:<id>#<perm>@* tuples from SpiceDB
*before* the row delete. Because policies.role_id has a foreign key to
roles(id) with no ON DELETE rule, deleting an in-use role then failed the
row delete with an opaque 500 — after the permission tuples were already
gone, leaving a half-deleted role that still existed but granted nothing.

Make role deletion a clean guard instead of a destructive cascade: attempt
the row delete first, and only remove the permission tuples once it
succeeds. The role repository maps the foreign-key violation to a new
role.ErrInUse, which the handlers return as FailedPrecondition. Deleting a
role that still has policies is therefore rejected with a clear message and
zero side effects; the caller must remove those policies first.

This intentionally avoids cascading policy deletion, which would revoke
access for every principal granted the role and, for a widely-assigned
role, fan out into many serial SpiceDB deletes inside one request.

Adds unit tests for the in-use rejection / clean-delete paths and an e2e
test asserting an in-use role can't be deleted (FailedPrecondition, nothing
torn down) and deletes cleanly once its policy is removed.

Refs #1661

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pull Request #1683: fix(role): reject deletion of a role still in use by policies

10 of 18 new or added lines in 3 files covered. (55.56%)

16573 of 38103 relevant lines covered (43.5%)

12.19 hits per line

Uncovered Changes

Lines Coverage ∆ File
4
25.41
-0.28% internal/api/v1beta1connect/role.go
4
77.17
-1.44% internal/store/postgres/role_repository.go
Jobs
ID Job ID Ran Files Coverage
1 27186856054.1 09 Jun 2026 06:00AM UTC 276
43.5
GitHub Action Run
Source Files on build 27186856054
  • Tree
  • List 276
  • Changed 3
  • Source Changed 0
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Pull Request #1683
  • PR Base - main (#27183829692)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc