feat(investigations): add favorite and duplicate endpoints - #121683
Open
wedamija wants to merge 8 commits into
Open
feat(investigations): add favorite and duplicate endpoints#121683wedamija wants to merge 8 commits into
wedamija wants to merge 8 commits into
Conversation
…w-up Leaves the collection API as the index and details endpoints plus their shared bases.
Splits the per-investigation favorite and duplicate actions out of the collection API, on top of its shared endpoint bases.
Comment on lines
+31
to
+41
| duplicate = duplicate_investigation(investigation=investigation, user_id=viewer_id) | ||
| return Response( | ||
| serialize( | ||
| duplicate, | ||
| request.user, | ||
| InvestigationDetailsSerializer( | ||
| accessible_project_ids=accessible_project_ids(self, request, organization) | ||
| ), | ||
| ), | ||
| status=status.HTTP_201_CREATED, | ||
| ) |
Contributor
There was a problem hiding this comment.
Bug: The endpoint allows duplicating archived investigations, bypassing the intended read-only restriction that is enforced by other write operations.
Severity: MEDIUM
Suggested Fix
In the duplicate_investigation service function, add a check to ensure the source investigation's status is ACTIVE. If it is not, raise an InvestigationValidationError with the message "Archived investigations are read-only.", consistent with other write operations.
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/investigations/endpoints/organization_investigations_duplicate.py#L27-L41
Potential issue: The `duplicate_investigation` endpoint and its underlying service
function do not check if an investigation is archived before proceeding with
duplication. This is inconsistent with all other write operations on investigations
(e.g., `create_block`, `update_block`), which explicitly check for an `ACTIVE` status
and raise an error for archived ones. This allows users to bypass the intended read-only
contract for archived investigations by creating a new, active copy from an archived
source.
Did we get this right? 👍 / 👎 to inform future reviews.
wedamija
force-pushed
the
investigations/05-collection-api
branch
from
August 10, 2026 23:12
25e5b33 to
f0e5d4a
Compare
wedamija
force-pushed
the
danf/investigations-favorite-duplicate
branch
from
August 10, 2026 23:13
76f02bd to
b79c8de
Compare
arslnb
approved these changes
Aug 10, 2026
arslnb
force-pushed
the
investigations/05-collection-api
branch
from
August 11, 2026 05:34
bdb196b to
3ba799b
Compare
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.
Add apis for favouriting and duplicating investigations
Split out from #121405