Repository navigation
fix(alerts): destination ids belong to the server - #36791
Conversation
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
Code Review ✅ Approved 1 closed / 1 findings🔴 High risk · The 2.1.0 migration rewrites missing or duplicate destination IDs; incorrect reassignment could make alert updates or test sends target the wrong destination. Server now owns destination ids on alert create, PUT, and PATCH, assigning fresh ids on create and ignoring client ids that the alert does not store or that repeat, with a migration that reissues missing or duplicate stored ids. The secrets ADR was amended to cover the new matching rule, addressing the missing ADR record finding, and a cross-alert test was added for copied ids. No open issues found. ✅ 1 closed✅ Quality: Server-owned destination id rule changes the secrets ADR, no record
VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Describe your changes:
Fixes #36790
A destination's
idnames one destination of one alert, but the server kept whatever id a request sent. An API client that built an alert from another alert's JSON, or sent the same id twice, could store two destinations with the same id. Code that finds a destination by its id, such as restoring its stored values on save or a test send, could then pick the wrong one.The server now owns destination ids:
DestinationIds.assignNew, on single and bulk create).DestinationIds.forgetIdsNotIssuedHere, before any id-based matching). Ignoring keeps an existing client pattern working: sending the same create request again as a PUT keeps the alert's ids.DestinationIdMigration).With ids unique, the test-send lookup no longer needs the "more than one destination holds this id" refusal added in PR #36147, so it is removed with its test.
Type of change:
Tests:
DestinationIdsTest,DestinationIdMigrationTest, plus everyorg.openmetadata.service.alertingunit test (707 pass).EventSubscriptionResourceIT#test_destinationIdsAreTheServers(create ignores sent ids; a repeated PUT, an unknown id and a repeated id keep the stored ids; an added destination gets its own).EventSubscriptionResourceIT,AlertStateIT,TemplateTestSendIT,DispatchScenariosIT,AlertReconcilerIT,SlowEndpointIT,MetricResourceITpass locally on Postgres. One check intest_destinationSecretsTheServerAloneWrites_400now adds a masked destination instead of renaming one, since a foreign id is ignored rather than refused.UI screen recording:
Not applicable: no UI change.
Checklist: