Reduce credential-resolution error logging noise (#4814)#4815
Open
stuartc wants to merge 2 commits into
Open
Conversation
Credential-resolution failures were logged with Logger.error from two sites (Resolver and RunChannel), and three of five conditions were logged twice. Because Sentry's LoggerHandler captures :error-level logs, each one became a Sentry event — mostly for user-actionable or transient conditions nobody can act on from an ops seat. Centralise logging in Lightning.Credentials.Resolver (the single run-credential-resolution layer) via a log_resolution_error/2 helper, and remove the duplicate Logger.error calls from RunChannel. Per condition: - project_not_found -> error (genuine invariant violation) - environment_not_configured -> warning (user-actionable config) - environment_mismatch -> warning (user-actionable config) - temporary_failure -> info (transient provider 429/503) - reauthorization_required -> info (user/IdP state, already audited) Only project_not_found now reaches Sentry. Also fix the user-facing "OAuth" casing in the two channel error replies, and add a logging guideline documenting the level policy and single-log-site rule.
|
The PR (#4814) only changes credential-resolution error log levels, removes a duplicate log site in Security Review ✅
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4815 +/- ##
=======================================
+ Coverage 90.3% 90.3% +0.1%
=======================================
Files 442 442
Lines 22545 22547 +2
=======================================
+ Hits 20350 20365 +15
+ Misses 2195 2182 -13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR changes how credential-resolution failures are logged so they stop
flooding Sentry.
These failures were logged with
Logger.errorfrom two places (theResolverand
RunChannel), and three of the five conditions were logged twice. SinceSentry's
LoggerHandlercaptures:errorlogs, each one became a Sentry event— even though most are user-actionable (re-authorise a credential, fix a
project's environment) or transient (provider 429/503), with nothing for us to
fix in code.
Logging is now centralised in
Lightning.Credentials.Resolver(one site percondition) at appropriate levels:
project_not_founderrorenvironment_not_configuredwarningenvironment_mismatchwarningtemporary_failureinforeauthorization_requiredinfoLines stay visible for self-hosted/logs-only operators; they just no longer
page anyone. Also fixes the "OAuth" casing in the two user-facing channel
replies, and adds a short logging guideline.
Closes #4814
Validation steps
mix test test/lightning/credentials/resolver_test.exs— asserts eachcondition logs at its expected level.
confirm it no longer appears in Sentry, while the line is still present in
the application logs at
info/warning.Additional notes for the reviewer
tags_from_metadatacleanup mentioned in the issue isdeliberately out of scope and tracked separately.
AI Usage
You can read more details in our
Responsible AI Policy
Pre-submission checklist
/reviewwith Claude Code)
(e.g.,
:owner,:admin,:editor,:viewer) — N/A, logging-only change