Skip to content

Conversation

@ameliahsu
Copy link
Member

we use the targetDisplay to set automatic names for alerts (based on the configured actions), but the POST API doesn't expect a targetDisplay for email actions. this fix strips the targetDisplay field before submitting the form data.

@ameliahsu ameliahsu requested a review from a team as a code owner November 19, 2025 20:17
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 19, 2025
Copy link
Member

@malwilley malwilley left a comment

Choose a reason for hiding this comment

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

Is there a test we can add to make sure this doesn't regress in the future?

@@ -35,8 +35,18 @@ const stripSubfilterId = (subfilter: any) => {
return subfilterWithoutId;
};

const stripActionId = (action: any) => {
const stripActionFields = (action: any) => {
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated to this PR, but we should really give action a type here

@codecov
Copy link

codecov bot commented Nov 19, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
12592 1 12591 10
View the top 1 failed test(s) by shortest run time
AutomationNewSettings creates an automation from scratch and submits successfully
Stack Traces | 4.44s run time
Error: expect(jest.fn()).toHaveBeenCalledWith(...expected)

Expected: Anything, ObjectContaining {"data": {"actionFilters": [{"actions": [{"config": {"targetDisplay": "#alerts", "targetIdentifier": "", "targetType": "specific"}, "data": {}, "integrationId": "1", "status": "active", "type": "slack"}, {"config": {"targetIdentifier": "1", "targetType": "user"}, "data": {}, "status": "active", "type": "email"}], "conditions": [{"comparison": {"key": "env", "match": "co", "value": "prod"}, "conditionResult": true, "type": "tagged_event"}], "logicType": "any-short"}], "config": {"frequency": 1440}, "detectorIds": [], "enabled": true, "environment": null, "name": "Notify #alerts via Slack", "triggers": {"actions": [], "conditions": [{"comparison": true, "conditionResult": true, "type": "first_seen_event"}, {"comparison": true, "conditionResult": true, "type": "reappeared_event"}, {"comparison": true, "conditionResult": true, "type": "regression_event"}], "logicType": "any-short"}}}

Number of calls: 0

Ignored nodes: comments, script, style
...
    at toHaveBeenCalledWith (.../views/automations/new.spec.tsx:154:20)
    at runWithExpensiveErrorDiagnosticsDisabled (.../sentry/node_modules/.pnpm/@[email protected]/node_modules/@.../dom/dist/config.js:47:12)
    at checkCallback (.../sentry/node_modules/.pnpm/@[email protected]/node_modules/@.../dom/dist/wait-for.js:124:77)
    at checkRealTimersCallback (.../sentry/node_modules/.pnpm/@[email protected]/node_modules/@.../dom/dist/wait-for.js:118:16)
    at Timeout.task [as _onTimeout] (.../sentry/node_modules/.pnpm/[email protected]..../jsdom/browser/Window.js:579:19)
    at listOnTimeout (node:internal/timers:588:17)
    at processTimers (node:internal/timers:523:7)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@ameliahsu ameliahsu merged commit 9010524 into master Nov 20, 2025
48 of 52 checks passed
@ameliahsu ameliahsu deleted the mia/aci/fix-email-target-display branch November 20, 2025 18:49
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.

3 participants