feat(): Add periodic resolution task for sourcemap configuration detectors#109849
Open
wedamija wants to merge 1 commit intodanf/sourcemap-config-issues/pr4-detectionfrom
Open
Conversation
…ctors Resolves stale sourcemap detectors when no new failures arrive for 30 minutes.
Comment on lines
+71
to
+74
| handler = state.detector.detector_handler | ||
| fingerprint = [ | ||
| *handler.build_issue_fingerprint(), | ||
| handler.state_manager.build_key(None), |
Contributor
There was a problem hiding this comment.
Bug: The handler variable can be None if state.detector.detector_handler returns None, but it's used without a null check, which will cause an AttributeError.
Severity: HIGH
Suggested Fix
Add a check to ensure handler is not None before attempting to access its methods. For example: handler = state.detector.detector_handler; if not handler: return.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: src/sentry/processing_errors/tasks.py#L71-L74
Potential issue: The `detector_handler` property can return `None` under certain
conditions, such as registry corruption or version mismatches during deployment. The
code in `_resolve_detector` retrieves this handler but then attempts to call methods on
it (`build_issue_fingerprint`, `build_key`) without first checking if the handler is
`None`. This will lead to an `AttributeError`, crashing the periodic task responsible
for sourcemap detector resolution. Other parts of the codebase correctly handle this
`None` case by performing a check before using the handler.
Did we get this right? 👍 / 👎 to inform future reviews.
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.
Resolves stale sourcemap detectors when no new failures arrive for 30 minutes.