test(observability): guard against today's two Grafana bug classes - #5720
Merged
Conversation
…oday's incident - selfhost-grafana-no-dollar-underscore-sentinel.test.ts: fails CI if any dashboard uses a Grafana-reserved $__-prefixed value as a hand-rolled SQL "All" sentinel (the ai-usage/maintainer-reviews/miner-usage bug -- confirmed empirically that Grafana leaves such values unquoted, which SQLite then misparses as its own bind parameter). Verified it actually catches the original pattern before reverting. - selfhost-grafana-datasource-uids.test.ts: pins every provisioned datasource uid and asserts every dashboard panel/template-variable references one that actually exists in a provisioning file. Renaming a datasource uid without a live-instance migration crash-loops the whole Grafana container (confirmed live) -- this test doesn't catch that missing migration step by itself, but it forces a deliberate test update on any future rename, which is the intended prompt to also plan it. Surfaces one pre-existing, accepted gap along the way: github-prs.json's "github" datasource has no git-tracked provisioning source (needs a live PAT, configured manually per self-host instance) -- explicitly allowlisted, not silently ignored.
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
❌ 7 Tests Failed:
View the full list of 7 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
38 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.
Summary
Follow-up to #5714/#5716 — turns today's live-incident lessons into permanent CI guards so they can't recur silently.
selfhost-grafana-no-dollar-underscore-sentinel.test.ts: fails CI if any dashboard uses a Grafana-reserved$__-prefixed value as a hand-rolled SQL "All" sentinel — the exact bug fixed in fix(observability): stop using Grafana's $__ macro prefix as the SQL "All" sentinel #5716. Confirmed live that${var:sqlstring}leaves such values unquoted, which SQLite then misparses as its own bind parameter. Verified this test actually catches the original broken pattern (temporarily reintroduced it, confirmed the test fails, reverted).selfhost-grafana-datasource-uids.test.ts: pins every provisioned datasourceuidand asserts every dashboard panel/template-variable references one that actually exists in a provisioning file. A silent datasource-uid rename without a live-instance migration crash-loops the entire Grafana container on next recreate (confirmed live, separately from fix(observability): fix Grafana dashboards showing no data after deploy #5714 — a distinct incident during today's investigation, fixed with a one-time production DB correction, not a code change since it isn't reproducible from a fresh install). This test can't catch a missing migration step by itself, but it forces a deliberate test update on any future rename, which is the intended prompt to also plan that step.github-prs.json's"github"datasource has no git-tracked provisioning source at all — thegrafana-github-datasourceplugin needs a live PAT, which must never be committed, so it's configured manually per self-host instance. Explicitly allowlisted with a comment, not silently ignored.Scope
site/,CNAME,**/lovable/**CHANGELOG.mdeditValidation
npx vitest run test/unit/selfhost-grafana-no-dollar-underscore-sentinel.test.ts test/unit/selfhost-grafana-datasource-uids.test.ts— all passgit diff --check— cleanSafety