plane
plane copied to clipboard
[WEB-5225]feat: enhance authentication logging with detailed error and info message
Description
- Added logging for various authentication events in the Adapter and its subclasses, including email validation, user existence checks, and password strength validation.
- Implemented error handling for GitHub OAuth email retrieval, ensuring proper logging of unexpected responses and missing primary emails.
- Updated logging configuration in local and production settings to include a dedicated logger for authentication events.
Type of Change
- [x] Bug fix (non-breaking change which fixes an issue)
Test Scenarios
- check all authentication views
References
Summary by CodeRabbit
Release Notes
- Chores
- Enhanced authentication system observability and monitoring capabilities through improved event logging across credential and OAuth authentication flows.
You have run out of free Bugbot PR reviews for this billing cycle. This will reset on November 20.
To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
Walkthrough
The changes introduce comprehensive logging throughout the authentication module across adapter and provider components, with new logger configuration entries added to both local and production settings. Logging is added to validation paths, exception handlers, and provider-specific events without altering core logic or public API signatures.
Changes
| Cohort / File(s) | Summary |
|---|---|
Logger Configuration apps/api/plane/settings/local.py, apps/api/plane/settings/production.py |
Added new logger entry "plane.authentication" with INFO level, console handler, and propagate set to False in both environments. |
Base Adapter Logging apps/api/plane/authentication/adapter/base.py |
Added logger initialization in Adapter.__init__; logs errors for missing email, warnings for invalid email in sanitize_email, insufficient password strength in validate_password, and disabled signup without invite in __check_signup. |
OAuth Adapter Logging apps/api/plane/authentication/adapter/oauth.py |
Added warning logs in exception handlers when RequestException occurs during get_user_token and get_user_response calls, capturing request/response context. |
Email Provider Logging apps/api/plane/authentication/provider/credentials/email.py |
Added warning logs in set_user_data for three scenarios: existing user with same email, non-existent user, and password validation failures, each capturing email context. |
GitHub OAuth Provider Logging apps/api/plane/authentication/provider/oauth/github.py |
Added runtime validation with error logs for invalid email response format and missing primary email; added warning logs for RequestException during email retrieval and organization membership failures; added info log when email is found. |
Estimated code review effort
π― 2 (Simple) | β±οΈ ~10 minutes
The changes follow a consistent, repetitive pattern of adding logging statements and logger configuration. The scope is contained within the authentication module with no logic alterations or signature changes. Most edits are straightforward logging additions that require minimal reasoning per file.
Poem
π° Hop, hopβthe logs now glow so bright, Each auth path logged from left to right, Errors whisper, warnings peek, Debugging becomes less mystique! β¨
Pre-merge checks and finishing touches
β Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | β οΈ Warning | Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
β Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title Check | β Passed | The pull request title "[WEB-5225]feat: enhance authentication logging with detailed error and info message" accurately describes the main change in the changeset. The PR adds comprehensive logging throughout the authentication system, including logging in the Adapter base class, OAuth providers, email provider, and updates to logging configuration in both local and production settings. The title is concise, specific, and clearly conveys that the primary purpose is to enhance authentication logging with detailed messages, which aligns perfectly with the actual changes made across all modified files. |
| Description Check | β Passed | The pull request description follows the required template structure and includes all mandatory sections. The Description section provides specific bullet points about logging additions in Adapter, GitHub OAuth error handling, and logging configuration updates. The Type of Change section is completed (though marked as "Bug fix" when it appears to be more of a feature/improvement). The Test Scenarios section is present with "check all authentication views," and the References section includes a link to the related issue WEB-5225. The Screenshots and Media section is omitted, but this is acceptable as it's marked optional in the template and not applicable for logging changes. |
β¨ Finishing touches
- [ ] π Generate docstrings
π§ͺ Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
- [ ] Commit unit tests in branch
fix-api-sentry-errors
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 @coderabbitai help to get the list of available commands and usage tips.