feat: Warn on missing params/macros in SQL Editor - #2742
Conversation
🦋 Changeset detectedLatest commit: abc11c0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Review process: Full human review — logic, architecture, edge cases. Stats
|
Greptile SummaryThis PR adds editor-level validation for raw SQL chart parameters and macros.
Confidence Score: 4/5The PR does not yet appear safe to merge because non-parameter occurrences of parameter names can still bypass the validation this change introduces. The time-range status helper checks parameter-name substrings in resolved SQL, so comments, literals, or longer identifiers can make missing time-range and interval parameters appear present and suppress the corresponding editor diagnostics. Files Needing Attention: packages/common-utils/src/core/utils.ts
|
| Filename | Overview |
|---|---|
| packages/common-utils/src/core/utils.ts | Adds shared raw SQL chart validation and refactors alert validation around common time-range status detection. |
| packages/common-utils/src/macros.ts | Adds helpers for detecting source-dependent macros and counting source-table macro arguments. |
| packages/app/src/components/ChartEditor/RawSqlChartEditor.tsx | Debounces raw SQL configuration validation and renders resulting warnings and errors in the editor. |
| packages/api/src/mcp/tools/dashboards/validation.ts | Reuses the shared source-dependent macro helper when validating dashboard tiles. |
| packages/common-utils/src/tests/validateRawSqlChartConfig.test.ts | Adds broad unit coverage for chart validation across display types, source selection, malformed SQL, and metrics sources. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
SQL[Raw SQL chart config] --> D[Debounced editor config]
D --> V[validateRawSqlChartConfig]
V --> T[Time-range and interval checks]
V --> S[Source macro checks]
V --> M[Metrics source compatibility checks]
T --> UI[Editor warning or error alert]
S --> UI
M --> UI
Reviews (6): Last reviewed commit: "Merge branch 'main' into drew/sql-warnin..." | Re-trigger Greptile
E2E Test Results✅ All tests passed • 243 passed • 1 skipped • 1051s
Tests ran across 4 shards in parallel. |
|
<!-- deep-review --> Deep Review🟡 P2 — recommended
🔵 P3 nitpicks (7)
Reviewers (9): correctness, adversarial, testing, maintainability, project-standards, kieran-typescript, api-contract, agent-native, learnings-researcher. Testing gaps:
Scope caveat: |
82e9906 to
df60ee4
Compare
|
<!-- deep-review --> Deep Review
✅ No critical issues found. 🟡 P2 -- recommended
🔵 P3 nitpicks (5)
Reviewers (4): correctness, testing, maintainability, kieran-typescript. Testing gaps:
|
df60ee4 to
51424d4
Compare
Deep Review✅ No critical issues found. Nothing here is a ship-blocker: the new validation is additive, non-blocking, and defensively wrapped. The substantive concerns are false-negatives that let the feature silently fail to warn, plus a theming-convention violation on the new callout. 🟡 P2 -- recommended
🔵 P3 nitpicks (8)
Reviewers (3): correctness-orchestrator (direct verification of every cited line), maintainability, learnings-researcher. Coverage caveats:
Testing gaps:
|
|
These P0s are existing issues and beyond the scope of this PR. |
51424d4 to
da7f5fb
Compare
Deep Review✅ No critical issues found. The new 🟡 P2 -- recommended
🔵 P3 nitpicks (3)
Reviewers (0): the plugin's persona sub-agent fan-out did not run. Testing gaps:
|
Deep ReviewNote: 🔴 P0/P1 -- must fix
🟡 P2 -- recommended
🔵 P3 nitpicks (7)
Reviewers (7): correctness, adversarial, testing, maintainability, project-standards, frontend-races, api-contract Testing gaps:
|
Summary
This PR adds additional validation to the Raw SQL Chart Editor. Previously, missing macro / param warnings only included the validations that were applied when an alert was added to the tile. Now we surface various missing macro / para warnings and errors regardless of whether an alert has been added.
Screenshots or video
How to test on Vercel preview
References