Skip to content

feat: reach error on blocked tenant#245

Merged
alienvspredator merged 1 commit intomainfrom
feature/blocked-tenant-error
Mar 23, 2026
Merged

feat: reach error on blocked tenant#245
alienvspredator merged 1 commit intomainfrom
feature/blocked-tenant-error

Conversation

@alienvspredator
Copy link
Copy Markdown
Member

@alienvspredator alienvspredator commented Mar 4, 2026

Return reach error details when the tenant is blocked

Summary by CodeRabbit

  • Bug Fixes

    • Improved error handling for blocked tenants: they now return a gRPC error with FailedPrecondition status and detailed violation information, instead of a successful response with an invalid session flag. This provides clearer and more specific feedback to clients about tenant access blocks.
  • Chores

    • Upgraded Go language version to 1.26.0 and streamlined development tooling directives for improved tool management.

@alienvspredator alienvspredator force-pushed the feature/blocked-tenant-error branch 2 times, most recently from 904e418 to 874f5a6 Compare March 4, 2026 17:04
@alienvspredator alienvspredator force-pushed the feature/blocked-tenant-error branch from 874f5a6 to da7a62f Compare March 4, 2026 17:05
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 4, 2026

pabloszel11
pabloszel11 previously approved these changes Mar 5, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 23, 2026

📝 Walkthrough

Walkthrough

Go version upgraded from 1.25.6 to 1.26.0 with tool directives refactored into a grouped block. gRPC session service modified to return FailedPrecondition error for blocked tenants instead of a valid response. Tests and error handling updated accordingly.

Changes

Cohort / File(s) Summary
Go Version and Tools
go.mod
Updated Go version to 1.26.0 and consolidated separate tool directives into a single grouped tool (...) block.
Session Error Handling
internal/grpc/session.go, internal/grpc/session_test.go, internal/grpc/violations.go
Modified GetSession to return a gRPC FailedPrecondition error with enriched precondition failure details when a tenant is blocked, instead of returning a normal response with Valid: false. Added new constant violationTenantBlocked and updated corresponding tests to verify error behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • pabloszel11

Poem

🐰 A blocked tenant now stops at the gate,
With proper gRPC errors—no faking the state!
From "false" to "FailedPrecondition" we spring,
Version 1.26 makes everything sing! 🌟

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete. It lacks the structured sections required by the template: 'What this PR does / why we need it', 'Special notes for your reviewer', and 'Release note'. Expand the description to follow the template structure with sections explaining the implementation details, any special considerations for reviewers, and release notes.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: returning gRPC error details when a tenant is blocked, which is the core objective across all modified files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/blocked-tenant-error

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@internal/grpc/session_test.go`:
- Around line 416-419: The test currently accesses pf.GetViolations()[0] without
ensuring the slice has elements which can panic; update the assertion to check
the slice length first (e.g. call require.NotEmpty(t, pf.GetViolations()) or
require.Len(t, pf.GetViolations(), 1)) before using pf.GetViolations()[0], then
keep the existing require.Equal on the violation type; reference the
PreconditionFailure value pf and its GetViolations() method when adding the
length check.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3191fac6-783f-4200-bf14-2f2ddd925a9f

📥 Commits

Reviewing files that changed from the base of the PR and between ed4d222 and 738c87b.

📒 Files selected for processing (4)
  • go.mod
  • internal/grpc/session.go
  • internal/grpc/session_test.go
  • internal/grpc/violations.go

Comment thread internal/grpc/session_test.go
@alienvspredator alienvspredator merged commit 88da356 into main Mar 23, 2026
9 checks passed
@alienvspredator alienvspredator deleted the feature/blocked-tenant-error branch March 23, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants