Skip to content

fix: account for RBAC role query in org permission query-count test - #8260

Merged
gagantrivedi merged 1 commit into
mainfrom
fix/org-permission-query-count-rbac
Aug 11, 2026
Merged

fix: account for RBAC role query in org permission query-count test#8260
gagantrivedi merged 1 commit into
mainfrom
fix/org-permission-query-count-rbac

Conversation

@gagantrivedi

Copy link
Copy Markdown
Member

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Contributes to #8228

The query-count test added in #8230 fails on the private-packages CI run: with RBAC installed, the no-permission path runs a fifth query (the role check), so django_assert_num_queries(4) breaks main.

  • Skip the 4-query test when RBAC is installed
  • Add a 5-query twin (admin, membership, user, group, role) skipped when RBAC is not installed, so both CI environments keep an exact-count guard

How did you test this code?

Ran the module locally without RBAC: 10 passed, 1 skipped (the RBAC twin). The 5-query expectation matches the failing CI output on main (Expected to perform 4 queries but 5 were done).

@gagantrivedi
gagantrivedi requested a review from a team as a code owner August 11, 2026 05:04
@gagantrivedi
gagantrivedi requested review from khvn26 and removed request for a team August 11, 2026 05:04
@vercel

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown

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

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Aug 11, 2026 5:05am
flagsmith-frontend-preview Ignored Ignored Aug 11, 2026 5:05am
flagsmith-frontend-staging Ignored Ignored Aug 11, 2026 5:05am

Request Review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6569f3d0-4e32-4dc4-a053-223a112cd6f8

📥 Commits

Reviewing files that changed from the base of the PR and between 7be291d and 58a863b.

📒 Files selected for processing (1)
  • api/tests/unit/permissions/permission_service/test_user_has_organisation_permissions.py

📝 Walkthrough

Walkthrough

The permission test module now imports pytest and Django settings. The existing non-RBAC query-count test skips when RBAC is installed. A new RBAC-only test confirms that a user without permissions performs five checks across admin, membership, direct, group, and role sources, then returns False.

Estimated code review effort: 2 (Simple) | ~10 minutes


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.

@github-actions github-actions Bot added api Issue related to the REST API fix labels Aug 11, 2026
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-8260 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api-test:pr-8260 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-8260 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api:pr-8260 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-8260 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-8260 Finished ✅ Results

@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.72%. Comparing base (7be291d) to head (58a863b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8260      +/-   ##
==========================================
+ Coverage   98.58%   98.72%   +0.14%     
==========================================
  Files        1556     1556              
  Lines       61916    61929      +13     
==========================================
+ Hits        61041    61141     +100     
+ Misses        875      788      -87     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19190 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  36 seconds
commit  58a863b
info  🔄 Run: #19190 (attempt 1)

🗂️ Previous results
✅ private-cloud · depot-ubuntu-latest-16 — run #19190 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  31.9 seconds
commit  58a863b
info  🔄 Run: #19190 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #19190 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  45.9 seconds
commit  58a863b
info  🔄 Run: #19190 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #19190 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  41.6 seconds
commit  58a863b
info  🔄 Run: #19190 (attempt 1)

@github-actions

Copy link
Copy Markdown
Contributor

Visual Regression

19 screenshots compared. See report for details.
View full report

@gagantrivedi
gagantrivedi merged commit c761517 into main Aug 11, 2026
35 checks passed
@gagantrivedi
gagantrivedi deleted the fix/org-permission-query-count-rbac branch August 11, 2026 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants