Skip to content

chore: include principal_type in error logging#1524

Merged
AmanGIT07 merged 1 commit intomainfrom
chore/add-principal-type-in-log
Apr 9, 2026
Merged

chore: include principal_type in error logging#1524
AmanGIT07 merged 1 commit intomainfrom
chore/add-principal-type-in-log

Conversation

@AmanGIT07
Copy link
Copy Markdown
Contributor

Adds principal_type in error logging alongside principal_id

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 9, 2026

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

Project Deployment Actions Updated (UTC)
frontier Ready Ready Preview, Comment Apr 9, 2026 10:17am

@AmanGIT07 AmanGIT07 enabled auto-merge (squash) April 9, 2026 10:21
@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 24184978634

Coverage increased (+0.01%) to 41.293%

Details

  • Coverage increased (+0.01%) from the base build.
  • Patch coverage: 3 uncovered changes across 1 file (15 of 18 lines covered, 83.33%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
internal/api/v1beta1connect/user.go 11 8 72.73%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 36401
Covered Lines: 15031
Line Coverage: 41.29%
Coverage Strength: 11.87 hits per line

💛 - Coveralls

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 9, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Improved internal error logging with enhanced context fields for better debugging and monitoring capabilities.

Walkthrough

Enhanced error logging across three v1beta1connect API handlers by adding principal_type context field to existing error logs in preferences, session, and user management operations. No functional changes to control flow, error codes, or request/response handling.

Changes

Cohort / File(s) Summary
Error logging enhancement
internal/api/v1beta1connect/preferences.go, internal/api/v1beta1connect/session.go, internal/api/v1beta1connect/user.go
Added principal_type field to structured error logging alongside existing principal_id in CreateCurrentUserPreferences, ListCurrentUserPreferences, ListSessions, RevokeSession, UpdateCurrentUser, ListCurrentUserGroups, ListOrganizationsByCurrentUser, and ListProjectsByCurrentUser handlers.

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

Copy link
Copy Markdown
Contributor

@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.

🧹 Nitpick comments (1)
internal/api/v1beta1connect/user.go (1)

512-513: Consider completing principal_type coverage in ListCurrentUserGroups error branches.

After the Line 512-Line 513 addition, the same function still has principal_id-only logs at Line 519-Line 522 and Line 542-Line 545. Adding principal_type there too would keep log fields uniform.

Proposed consistency patch
-			errorLogger.LogUnexpectedError(ctx, request, "ListCurrentUserGroups", err,
-				zap.String("principal_id", principal.ID),
-				zap.String("org_id", request.Msg.GetOrgId()))
+			errorLogger.LogUnexpectedError(ctx, request, "ListCurrentUserGroups", err,
+				zap.String("principal_id", principal.ID),
+				zap.String("principal_type", principal.Type),
+				zap.String("org_id", request.Msg.GetOrgId()))
@@
-			errorLogger.LogUnexpectedError(ctx, request, "ListCurrentUserGroups", err,
-				zap.String("principal_id", principal.ID),
-				zap.String("org_id", request.Msg.GetOrgId()))
+			errorLogger.LogUnexpectedError(ctx, request, "ListCurrentUserGroups", err,
+				zap.String("principal_id", principal.ID),
+				zap.String("principal_type", principal.Type),
+				zap.String("org_id", request.Msg.GetOrgId()))

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 26762ca9-82e3-4f6c-9bd8-13f1331dbb76

📥 Commits

Reviewing files that changed from the base of the PR and between e5de5bd and 5e3b0e5.

📒 Files selected for processing (3)
  • internal/api/v1beta1connect/preferences.go
  • internal/api/v1beta1connect/session.go
  • internal/api/v1beta1connect/user.go

@AmanGIT07 AmanGIT07 merged commit cde820a into main Apr 9, 2026
8 checks passed
@AmanGIT07 AmanGIT07 deleted the chore/add-principal-type-in-log branch April 9, 2026 10:30
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