Uh oh!
There was an error while loading. Please reload this page.
fix: decode alert pipelines that carry an if condition - #64
Merged
Conversation
`AlertPipeline.If` and `ApAlertInhibit.SourceFilters` were generated as `OrFilterGroup` ([][]FilterCondition), but the server models both as a single AND group — a flat list. Any pipeline with an `if` condition therefore failed to decode: json: cannot unmarshal object into Go struct field AlertPipeline.rules.if of type []FilterCondition Both are now `[]FilterCondition`. `OrFilterGroup` is untouched — the silence / inhibit / drop / escalation rules that use it really are OR-of-AND. The refreshed spec also carries two unrelated corrections that landed upstream since the last sync: - `CreateDropRuleRequest.Priority` / `UpdateDropRuleRequest.Priority` are gone; drop rules have no priority server-side. - `KnowledgePackItem.DutyVersion` is new. The pipeline examples in the spec now carry a real `if` shape, so TestSpecExamplesRoundTrip covers both fields — it fails against the old types and passes against these.
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Regenerated from the corrected spec (flashduty-docs #307 + #308).
AlertPipeline.IfandApAlertInhibit.SourceFilterswere generated asOrFilterGroup([][]FilterCondition), but the server models both as a single AND group — a flat list. Any pipeline carrying anifcondition failed to decode:Both are now
[]FilterCondition.OrFilterGroupis untouched — the silence / inhibit / drop / escalation rules that use it really are OR-of-AND.Also picked up by the spec refresh (landed upstream since the last sync, unrelated to the decode fix):
CreateDropRuleRequest.Priority/UpdateDropRuleRequest.Priorityremoved — drop rules have no priority server-side.KnowledgePackItem.DutyVersionadded.Verification — the spec examples now carry a real
ifshape, soTestSpecExamplesRoundTripactually exercises both fields:OrFilterGrouptypes it fails on/alert/pipeline/infoand/alert/pipeline/listwith the exact error above;go test ./...green.