Skip to content

fix(api): return CodeFailedPrecondition for disabled org in AuthToken#1621

Merged
rohilsurana merged 2 commits into
mainfrom
fix/org-disabled-error-code
May 18, 2026
Merged

fix(api): return CodeFailedPrecondition for disabled org in AuthToken#1621
rohilsurana merged 2 commits into
mainfrom
fix/org-disabled-error-code

Conversation

@rohilsurana
Copy link
Copy Markdown
Member

Summary

  • AuthToken returned CodeInternal for organization.ErrDisabled, treating a domain condition as an infrastructure error
  • Changed to CodeFailedPrecondition + ErrOrgDisabled, matching serviceuser.go:158 and gRPC API guidelines (caller can retry after org is re-enabled)
  • Also switched from LogUnexpectedError to LogServiceError since this is an expected domain error, not unexpected
  • Replaced raw err with ErrInternalServerError for the remaining catch-all

Test plan

  • Unit tests pass (assertion updated to expect CodeFailedPrecondition)
  • golangci-lint clean

@vercel
Copy link
Copy Markdown

vercel Bot commented May 18, 2026

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

Project Deployment Actions Updated (UTC)
frontier Ready Ready Preview, Comment May 18, 2026 5:47am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 18, 2026

Warning

Rate limit exceeded

@rohilsurana has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 18 minutes and 16 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 34cc04f6-9971-4d91-bc85-95bb7e4e34f8

📥 Commits

Reviewing files that changed from the base of the PR and between 1276dd1 and 0d9c01f.

📒 Files selected for processing (9)
  • internal/api/v1beta1connect/authenticate.go
  • internal/api/v1beta1connect/authenticate_test.go
  • internal/api/v1beta1connect/domain.go
  • internal/api/v1beta1connect/domain_test.go
  • internal/api/v1beta1connect/group.go
  • internal/api/v1beta1connect/group_test.go
  • internal/api/v1beta1connect/invitations.go
  • internal/api/v1beta1connect/organization.go
  • internal/api/v1beta1connect/organization_test.go

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 and usage tips.

@coveralls
Copy link
Copy Markdown

coveralls commented May 18, 2026

Coverage Report for CI Build 26015926393

Coverage remained the same at 42.312%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: 5 uncovered changes across 1 file (26 of 31 lines covered, 83.87%).
  • 1 coverage regression across 1 file.

Uncovered Changes

File Changed Covered %
internal/api/v1beta1connect/invitations.go 5 0 0.0%

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
internal/api/v1beta1connect/authenticate.go 1 22.9%

Coverage Stats

Coverage Status
Relevant Lines: 37741
Covered Lines: 15969
Line Coverage: 42.31%
Coverage Strength: 11.88 hits per line

💛 - Coveralls

@rohilsurana rohilsurana merged commit 53ad4c9 into main May 18, 2026
8 checks passed
@rohilsurana rohilsurana deleted the fix/org-disabled-error-code branch May 18, 2026 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants