Repository navigation
Conversation
Add valid and invalid model fixtures for every alertmanager schema (datasource, alerts query, silences query, AlertTable and SilenceTable panels) so that `make test-schemas-plugins` exercises them. Fixtures only, no schema or runtime change. Signed-off-by: Joshua (OpenClaw) <s3onghyun@users.noreply.github.com>
Nexucis
approved these changes
Nov 16, 2026
Nexucis
left a comment
Member
There was a problem hiding this comment.
Thanks for adding these, LGTM!
Checked locally
percli plugin test-schemas --plugin.path=alertmanagerwith percli v0.55.1 (the CI version):No tests foundonmain, 24/24 passing on this branch.- Fixing only the intended defect in each invalid fixture makes it validate (14 corrected copies,
both-modes.jsonboth ways), so none of them fails for an unrelated reason. - All files are valid JSON and pass
oxfmt --check.
Optional suggestions
datasource/tests/valid/alertmanager-proxy.jsonis missing two endpoints allowed by the editor's default proxy config (AlertManagerDatasourceEditor.tsx):GET /api/v2/silence/.*andGET /api/v2/status. The latter is the plugin'shealthCheckPath, so the proxy would answer the health check with a 403 if someone reused this config. Mirroring the editor default would make it a realistic example.silence-table/tests/valid/full.jsonconfiguresstatus,matchersandcomment, which are the built-in default columns: the columns editor doesn't offer them, andSilenceTablePaneldrops them fromspec.columnsbefore prepending its own defaults. Columns users can actually add (startsAt,duration,updatedAt, ...) would be more representative.- Cheap cases that pass today and would add coverage:
- valid: a variable datasource selector (
"datasource": "$alertmanager") in both query schemas - invalid: an empty datasource spec (neither
directUrlnorproxy) - invalid: an unknown
labelColorMappings[].mode - invalid: an unknown column
sortvalue
- valid: a variable datasource selector (
alert-table/tests/valid/deduplication-fingerprint.jsonalso coversallowedActions: []; splitting it would keep one concern per fixture.
Out of scope, found while checking coverage
- An invalid fixture for a datasource selector of the wrong kind can't be added yet, because the schemas accept it:
{"kind": "AlertManagerAlertsQuery", "spec": {"datasource": {"kind": "PrometheusDatasource"}}}validates, and so does aPrometheusTimeSeriesQuerypointing at aTempoDatasource. The datasource plugins define#selector: common.#datasourceSelector & {_kind: #kind}, but CUE hidden fields are scoped to their package, so the plugin's_kindisn't the_kinddeclared in perses/shared andkindaccepts any string. In a minimal two-package reproduction, the pattern rejects a wrong kind within one package but accepts it across packages, and passing the kind through a definition field (#kind) instead fixes it. This needs a change in perses/shared and the plugins, and tightening it could start rejecting saved dashboards that use a mismatched kind, so it deserves its own issue. - +1 to fixing
sortMode: "status"inalert-table.cueseparately: the columns editor offers it, so a panel using it currently fails schema validation. A valid fixture using it would fit well in that PR. - The SilenceTable schema accepts any column
name, while the TS model only allows the 8SilenceFieldNamevalues; that could be tightened at the same time.
FYI: the DCO check ran on #934 but hasn't reported on this PR. It's not a required check and the commit is signed off, so it doesn't block.
3 of 5 tasks
3 of 5 tasks
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 free
to 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.
Description
Adds valid/invalid CUE model fixtures for every alertmanager schema (datasource, alerts query, silences query, AlertTable, SilenceTable) so
make test-schemas-pluginscovers this plugin; before this changepercli plugin test-schemas --plugin.path=alertmanagerreported "No tests found" (jaeger has 2 fixtures, prometheus 9).Fixtures only, no schema or runtime change.
make test-schemas-pluginspasses locally with percli v0.55.1 (24 alertmanager tests); breaking one valid fixture makes it fail as expected. Field values followalertmanager/src(column sort modes, silence field names, actions, colour mappings).While writing them I noticed that
alert-table.cuedoes not allowsortMode: "status"although the TS model, the columns editor and the sorting code support it; I left that out of this PR and will open a separate small fix.Screenshots
n/a (no UI change)
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes