chore(alerts): Remove unused incidents code#115236
Draft
Conversation
Comment on lines
108
to
114
| kwargs["incident"] = gop | ||
| return args, kwargs | ||
|
|
||
| # Legacy path (flag off): replicate IncidentEndpoint.convert_args lookup. | ||
| # PUT: update_incident_status operates on the legacy Incident model. | ||
| try: | ||
| incident = kwargs["incident"] = Incident.objects.get( | ||
| organization=organization, identifier=int_id |
Contributor
There was a problem hiding this comment.
Bug: Removing the legacy fallback for GET requests makes legacy incidents (those without a GroupOpenPeriod record) inaccessible, while PUT requests still use the legacy Incident model.
Severity: HIGH
Suggested Fix
The legacy fallback logic for GET requests should be restored until the data migration is complete and the PUT endpoint is also migrated to use the new workflow engine models. This prevents legacy incidents from becoming inaccessible.
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/incidents/endpoints/organization_incident_details.py#L108-L114
Potential issue: The removal of the legacy fallback logic for `GET` requests in
`organization_incident_details.py` causes a regression. Legacy incidents, which exist in
the `Incident` table but lack a corresponding `GroupOpenPeriod` record, will now return
a 404 error on `GET` requests. This happens because the `GET` path now exclusively
queries for `GroupOpenPeriod` and raises `ResourceDoesNotExist` if not found. However,
the `PUT` path for the same endpoint still operates on the legacy `Incident` model,
creating an inconsistency where an incident can be updated but not viewed. Similarly,
the incident index endpoint will no longer list these legacy incidents.
Also affects:
src/sentry/incidents/endpoints/organization_incident_index.py
Did we get this right? 👍 / 👎 to inform future reviews.
34dd5bc to
0c171df
Compare
Contributor
Backend Test FailuresFailures on
|
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.
Delete a whole lot of unused incidents code.