feat: Expand variables as empty in alert queries - #2910
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
Greptile SummaryThe PR makes dashboard-tile alerts evaluate variable references using empty selections and aligns alert previews and editor messaging with that behavior.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| packages/api/src/tasks/checkAlerts/index.ts | Adds empty dashboard-variable declarations to reconstructed raw-SQL and builder alert chart configurations. |
| packages/app/src/components/DBEditTimeChartForm/EditTimeChartForm.tsx | Computes variable-reference warnings for alert-enabled chart forms and forwards them to both editor variants. |
| packages/app/src/components/alerts/AlertDetailChart.tsx | Configures tile alert-detail previews with the same empty variable state used during scheduled execution. |
| packages/app/src/hooks/useDashboardFilters.tsx | Reuses the centralized declaration helper while retaining selected dashboard variable values. |
| packages/common-utils/src/filters.ts | Introduces a shared helper that derives unique variable declarations from dashboard filters. |
| packages/common-utils/src/variables.ts | Adds warning generation for chart configurations that reference in-scope dashboard variables. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Filters[Dashboard variable declarations] --> Empty[Attach empty selections]
Empty --> Editor[Chart editor alert preview]
Empty --> Detail[Alert detail preview]
Empty --> Task[Scheduled alert task]
Editor --> Query[Rendered ClickHouse query]
Detail --> Query
Task --> Query
Reviews (5): Last reviewed commit: "chore: Update rachet" | Re-trigger Greptile
E2E Test Results✅ All tests passed • 300 passed • 1 skipped • 989s
Tests ran across 4 shards in parallel. |
f89980d to
c0e271a
Compare
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Additional context: touches background tasks or the delivery pipeline lightly (11 lines, under the 30-line bar for Tier 4) Review process: Full human review — logic, architecture, edge cases. Stats
|
Deep Review✅ No critical issues found. The refactor extracting 🟡 P2 -- recommended
🔵 P3 nitpicks (2)
Reviewers (6): correctness, reliability, adversarial, kieran-typescript, testing, maintainability. Testing gaps:
|
The merge-base changed after approval.
fae0abd to
988024b
Compare
Summary
This PR extends the dashboard variable functionality to support substitution in alerts.
Screenshots or video
Empty variable state in alert previews
Empty states substituted in execution
Warning
How to test locally
NEXT_PUBLIC_ENABLE_DASHBOARD_VARIABLES=trueReferences