Skip to content

feat(project-creation): Migrate project creation flow to new workflow engine endpoints - #123074

Open
malwilley wants to merge 3 commits into
masterfrom
malwilley/fix-project-rule-api-410
Open

feat(project-creation): Migrate project creation flow to new workflow engine endpoints#123074
malwilley wants to merge 3 commits into
masterfrom
malwilley/fix-project-rule-api-410

Conversation

@malwilley

@malwilley malwilley commented Aug 28, 2026

Copy link
Copy Markdown
Member

(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:

  • Previously, when creating an alert which was sent to email and slack/discord/teams, it would create two separate alerts. It now creates a single alert with two actions.
  • Priority alerts were being created with a 5 minute action interval when created from the frontend. It now uses an action interval of 0 to match the endpoint logic when default_rules is enabled.
  • Custom alerts (e.g. "events in an issue are more than x in y minutes") were being created with a 5 minute action interval, which could result in some very noisy alerts. It was changed to a 24 hour action interval.

I've tested all 3 alert options (high priority, custom, none) on both the old and new project UIs, everything works as expected.

@malwilley
malwilley requested review from a team and jaydgoss August 28, 2026 21:38
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Aug 28, 2026
@malwilley
malwilley marked this pull request as ready for review August 28, 2026 22:58
@malwilley
malwilley requested a review from a team as a code owner 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');
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant