Repository navigation
feat: Add field references to data source and connection variables - #3889
Conversation
🦋 Changeset detectedLatest commit: d614a1a 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.
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
E2E Test Results✅ All tests passed • 490 passed • 1 skipped • 1102s
Tests ran across 4 shards in parallel. |
🟡 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
|
|
|
||
| const [referenceRefs, valueVariableRefs] = partition( | ||
| resolved, | ||
| r => r.variable.reference != null, |
There was a problem hiding this comment.
🟡 P2 — A quoted identifier reference like '$src' or '${src.table}' gets no validation error
In SQL, WHERE t = '${src.table}' renders as the string literal '`otel_logs`', which contains the backticks, and the validator says nothing. The quoted-reference check only looks at refs whose effectiveFormat === 'sqlstring', and identifier fields default to sqlidentifier. Fix: also flag sqlidentifier refs where inStringLiteral is true, and suggest ${src.table:csv} (or :sqlstring with the quotes removed).
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
PR Review
4 finding(s): 🔴 0 P0/P1 · 🟡 1 P2 · 🔵 3 P3 None could be anchored to changed lines; they are listed below. 3 P3 folded at the bottom. Findings outside the changed lines
🔵 3 P3 — no action needed before merge
Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ca46f4d. Configure here.
Deep ReviewScope: PR #3889 — field references for data source & connection variables (common-utils + SQL-editor completions + MCP docs). Diff vs base ✅ No critical issues found. The core logic ( 🟡 P2 — recommended
🔵 P3 nitpicks (9)
Reviewers (8): correctness, testing, maintainability, security, kieran-typescript, api-contract, adversarial, previous-comments. Testing gaps:
No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
d614a1a to
d1fbe12
Compare

Summary
Part 1 of 4. Adds the common-utils support for referencing DATA_SOURCE and CONNECTION dashboard variables in text (eg.
$sourceor${source.table}).$src, ${src.table}, ${src.database}, ${src.name}, ${src.id}, and ${src.table.<type>}for a metric source's tables. A connection variable offers$conn, ${conn.name} and ${conn.id}.sqlidentifierformat, which backtick-quotes each value. In SQL it is the default for table and database fields; names and IDs default to sqlstring. Users can also apply it to value variables: it appears in SQL completions and in the MCP prompt's format table.ChartVariablegains an optionalreferencefield withhasSelectionand the variable's reference-able fields. An unselected reference expands to nothing. Reading a field the variable doesn't have, or one the selected source can't render, is a validation error.$__filterand$__conditionalAllreject these variables.Screenshots or video
New
sqlidentifierformat:Otherwise there are no other observable changes on this branch.
How to test on Vercel preview
sqlidentifiervariable formatReferences