test(analytics): cover every verb in saved-query tenant isolation - #2138
Conversation
The tenant-isolation live test only asserted cross-tenant GET. Extend it to assert LIST invisibility, 404 on cross-tenant GET/PUT/DELETE/run, and that the owner's row is unchanged after the foreign write attempts. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Anton Zelenov <antonz@constructor.tech>
|
Warning Review limit reached
Next review available in: 10 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe tenant-isolation test now verifies that tenant B cannot list or access tenant A’s saved query through any saved-query operation. It also verifies that tenant A can still retrieve the unchanged query. ChangesSaved query tenant isolation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/backend/services/analytics/src/api/http_live_tests.rs`:
- Around line 720-722: Remove the prose comments near the tenant-isolation
requests in the live HTTP tests, including the additional comment at the other
indicated location; leave the test names, requests, assertions, and assertion
messages unchanged.
- Around line 720-776: Split the oversized http_live_tests module into focused
feature submodules, moving the saved-query helpers and tests—including the
cross-tenant test around app, create_body, and query endpoint coverage—into a
dedicated saved-query module. Preserve existing shared test setup and behavior,
and leave unrelated live HTTP tests in their current feature-focused module.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a5523b2c-e304-4255-9395-73699508b950
📒 Files selected for processing (1)
src/backend/services/analytics/src/api/http_live_tests.rs
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Anton Zelenov <antonz@constructor.tech>
11f500d
Summary
QA flagged missing tenant-isolation tests for the saved-query CRUD (
/v1/queries*). A test existed (saved_query_is_tenant_scoped) but only asserted cross-tenant GET; the mutation paths were uncovered.This extends the live test to cover the full surface for a query owned by tenant A when accessed as tenant B:
No production-code changes; the handlers already resolve every verb tenant-filtered.
Testing
Ran the saved-query suite against a local MariaDB (migrations applied via
analytics migrate):clippy + rustfmt clean.
🤖 Generated with Claude Code
Summary by CodeRabbit