-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Fix #22921 Alerts UI: Return code not displayed after modifying Advanced Configurations #24813
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
base: main
Are you sure you want to change the base?
Conversation
…figurations Fixes #22921
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request fixes issue #22921 where the return code was not displayed after modifying Advanced Configurations in the Alerts UI. The changes enhance the handling and testing of advanced destination configurations (headers, query parameters, and secret keys) for external alert destinations.
Key changes:
- Introduces
normalizeDestinationConfigutility function to standardize destination config formats for reliable comparison - Updates
getFormattedDestinationsto useomitByfor cleaner undefined value filtering - Adds defensive handling for missing
reasonfield in status display (fixes the bug in #22921) - Filters out external destinations with empty configs from test API calls
- Enhances Playwright test utilities to support advanced configuration testing
- Adds comprehensive unit and integration test coverage for new functionality
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
AlertsUtil.tsx |
Added normalizeDestinationConfig function to convert headers/queryParams from object to array format for consistent comparison; updated getFormattedDestinations to use omitBy for cleaner handling of undefined values; added data-testid attributes to add-header and add-query-param buttons |
AlertsUtil.test.tsx |
Added comprehensive test coverage for normalizeDestinationConfig and getFormattedDestinations functions; improved test assertions by changing primitive comparisons from toStrictEqual to toBe |
DestinationSelectItem.tsx |
Refactored to use normalizeDestinationConfig utility instead of inline normalization; added nullish coalescing operator to handle missing reason field in status display (fixes #22921) |
DestinationSelectItem.test.tsx |
Added extensive test suite for destination status comparison scenarios including headers/queryParams handling; moved act import from @testing-library/react to react per React 18 best practices |
DestinationFormItem.component.tsx |
Added filtering logic to exclude external destinations with empty configs from test API calls |
DestinationFormItem.test.tsx |
Added comprehensive test coverage for handleTestDestinationClick including filtering behavior for internal destinations and empty configs |
observabilityAlert.ts |
Enhanced addExternalDestination utility to accept optional advancedConfig parameter for testing headers, query parameters, and secret keys |
NotificationAlerts.spec.ts |
Added E2E test coverage for advanced destination configuration; validates that empty configs are filtered from test API calls |
|
I’ve addressed some of the code smells; the remaining ones are from older code. |
|



Fixes #22921
Screen.Recording.2025-12-12.at.9.25.09.PM.mov
This pull request enhances the Playwright test suite and supporting utilities for notification alerts, focusing on improved handling and testing of advanced destination configurations (such as headers and query parameters) for external alert destinations. The changes ensure that destinations with empty configurations are excluded from test API calls, and introduce normalization utilities to maintain consistency in config comparisons.
Advanced destination configuration support:
addExternalDestinationutility now accepts anadvancedConfigparameter, allowing Playwright tests to specify headers, query parameters, and secret keys for external destinations. The function fills out these fields in the UI as part of the test flow. [1] [2]NotificationAlerts.spec.ts) adds coverage for advanced destination configuration, verifying that values are correctly set and that empty configs are not sent in test API calls. [1] [2]Destination config normalization and filtering:
normalizeDestinationConfiginAlertsUtil.tsxto standardize destination config objects (converting headers and query parameters to arrays) for reliable comparison and processing. [1] [2] [3]DestinationFormItem.component.tsxto exclude external destinations with empty configs from test API calls, preventing unnecessary or invalid requests.Test utility and UI improvements:
data-testidattributes to "add header" and "add query param" buttons to improve Playwright test reliability and clarity. [1] [2]Code cleanup and import formatting:
These changes collectively make destination configuration handling in alert tests more robust and maintainable, while improving test coverage for advanced scenarios.
Type of change:
Checklist:
Fixes <issue-number>: <short explanation>