Skip to content

feat(aci): automation edit scaffolding #94595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 30, 2025
Merged

Conversation

ameliahsu
Copy link
Member

@ameliahsu ameliahsu commented Jun 28, 2025

  • added automation form to the automation edit view
  • the form + AutomationBuilderReducer are now able to use an existing automation to populate the form fields
  • setting up the edit actions (save + delete) will come in the next PR

we can also remove flattie now since we're maintaining automation builder state outside of the form

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 28, 2025
@ameliahsu ameliahsu marked this pull request as ready for review June 30, 2025 16:36
@ameliahsu ameliahsu requested review from a team as code owners June 30, 2025 16:36
cursor[bot]

This comment was marked as outdated.

Comment on lines 41 to 49
return availableActions.find(
handler =>
handler.type === ActionType.SENTRY_APP &&
((action.config.sentry_app_identifier === SentryAppIdentifier.SENTRY_APP_ID &&
action.config.target_identifier === handler.sentryApp?.id) ||
(action.config.sentry_app_identifier ===
SentryAppIdentifier.SENTRY_APP_INSTALLATION_UUID &&
action.config.target_identifier === handler.sentryApp?.installationUuid))
);
Copy link
Member

Choose a reason for hiding this comment

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

this is difficult to read

cursor[bot]

This comment was marked as outdated.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: State Initialization Vulnerabilities in AutomationBuilder

The AutomationBuilderState initialization in edit.tsx has two issues. Firstly, actionFilters is directly assigned automation.actionFilters without a fallback to a default array (unlike triggers), which can result in actionFilters being undefined and violating its expected array type. Secondly, the useAutomationBuilderReducer hook is initialized with initialState derived from automation. Although the current conditional rendering prevents the reducer from being initialized with an undefined state (as the form only mounts after automation data loads), this pattern is fragile and could lead to an empty default state if loading conditions change.

static/app/views/automations/edit.tsx#L81-L95

const initialState = useMemo((): AutomationBuilderState | undefined => {
if (!automation) {
return undefined;
}
return {
triggers: automation.triggers
? automation.triggers
: initialAutomationBuilderState.triggers,
actionFilters: automation.actionFilters,
};
}, [automation]);
const model = useMemo(() => new FormModel(), []);
const {state, actions} = useAutomationBuilderReducer(initialState);

Fix in Cursor


Was this report helpful? Give feedback by reacting with 👍 or 👎

@ameliahsu ameliahsu merged commit cc2b447 into master Jun 30, 2025
46 checks passed
@ameliahsu ameliahsu deleted the mia/aci/setup-automation-edit branch June 30, 2025 20:55
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.

2 participants