feat(project-creation): Migrate project creation flow to new workflow engine endpoints - #123074
Open
malwilley wants to merge 3 commits into
Open
feat(project-creation): Migrate project creation flow to new workflow engine endpoints#123074malwilley wants to merge 3 commits into
malwilley wants to merge 3 commits into
Conversation
…lert being created at once any longer
malwilley
marked this pull request as ready for review
August 28, 2026 22:58
Comment on lines
+113
to
+121
| const detectorIds = await fetchIssueStreamDetectorIdsForProjects({ | ||
| queryClient, | ||
| organization, | ||
| projectIds: [projectId], | ||
| }); | ||
|
|
||
| if (detectorIds.length === 0) { | ||
| throw new Error('Could not find issue stream detector for project'); | ||
| } |
Contributor
There was a problem hiding this comment.
Bug: A race condition exists where the frontend queries for a project's detector immediately after creation without retries. Due to replication lag, this can fail and cause the project creation to be rolled back.
Severity: HIGH
Suggested Fix
Introduce retry logic for the detector fetch operation. When calling fetchIssueStreamDetectorIdsForProjects or the underlying queryClient.fetchQuery, enable retries with a backoff strategy. This will make the process resilient to replication or indexing delays by allowing a short time for the detector to become available via the API.
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: static/app/components/onboarding/useCreateProjectRules.ts#L113-L121
Potential issue: After a project is successfully created, the frontend immediately
queries for its associated 'issue stream' detector using
`fetchIssueStreamDetectorIdsForProjects`. This query is configured with `retry: false`.
While the backend creates the detector synchronously, delays from database replication
or indexing can cause the detector to be temporarily unavailable via the API. If the
query fails to find the detector, an error is thrown, which triggers a rollback that
deletes the successfully created project. This race condition can lead to intermittent
failures in the project creation workflow.
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.
(Note: do not merge until first merging #123033 - without this, team admins will be unable to create alerts for their projects)
The project creation UI, when custom options are checked, is currently using the old deprecated /rules/ endpoint. This PR updates the hooks to now use the new workflow engine /detectors/ and /workflows/ endpoints.
In addition, it also fixes some issues such as:
default_rulesis enabled.I've tested all 3 alert options (high priority, custom, none) on both the old and new project UIs, everything works as expected.