Repository navigation
feat: add an "All" option to SQL query dashboard filters - #3861
karl-power wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 2c209d8 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 |
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
PR Review
2 finding(s): 🔴 0 P0/P1 · 🟡 1 P2 · 🔵 1 P3 None could be anchored to changed lines; they are listed below. 1 P3 folded at the bottom. Findings outside the changed lines
🔵 1 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 2c209d8. Configure here.
| message: tooManyOptionsForAllMessage(filter.name), | ||
| }); | ||
| } else { | ||
| optionsByVariableName.set(name, result.values); |
There was a problem hiding this comment.
Tiles run with stale All options
Medium Severity
Tiles can keep running against a previous options list after the values query key changes. useExpandedSqlQueryVariables only waits while isLoading is true, but useSqlQueryFilterValues sets placeholderData: keepPreviousData, so a refetch reports isLoading false and still returns the old values. Those stale options are expanded as All and tiles query immediately instead of showing the loading placeholder.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 2c209d8. Configure here.
Deep Review✅ No critical issues found. This is a carefully-built, well-tested change. The The items below are recommendations, not merge blockers — several are explicitly intended trade-offs that are worth a second look. 🟡 P2 -- recommended
🔵 P3 nitpicks (2)
Reviewers (11): correctness, testing, maintainability, project-standards, kieran-typescript, performance, reliability, api-contract, adversarial, frontend-races, security. Testing gaps: No test asserts the partial-results-on-timeout behavior of "All" expansion, nor the 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 |
E2E Test Results✅ All tests passed • 481 passed • 1 skipped • 1112s
Tests ran across 4 shards in parallel. |
pulpdrew
left a comment
There was a problem hiding this comment.
Implementation LGTM, but I am wondering about the rationale behind the dependent filters behavior, asked below.
Also, re The options query stops after 30 seconds and returns partial results, so "All" can silently select an incomplete list. - could we show a warning in this case so it isn't silent?
| connectionId ClickHouse connection the query runs on (from clickstack_list_sources), or a CONNECTION filter's "$variableName". | ||
| sourceId Optional log, trace, session, or metric source on that connection, or a DATA_SOURCE filter's "$variableName". Needed for $__sourceTable and $__filters; $__filters expands to the dashboard's broadcast filter selections for that source. | ||
| sqlTemplate SELECT whose FIRST column becomes the dropdown values, cast to string with nulls and duplicates dropped, in row order (add ORDER BY). May use the time macros and other filters' variables, plus $__sourceTable and $__filters when sourceId is set. | ||
| allowAll Set true to add an "All" choice that selects every option the query returns, up to 1,000; tiles show an error above that, so add a LIMIT if the query can return more. Multi-select filters only. Other filters' sqlTemplates see this filter's "All" as no constraint: $__filter and $__conditionalAll expand to 1=1 there and a bare $variableName to NULL, so reference it through the macros. |
There was a problem hiding this comment.
Why is it that other filters don't see the all option like tiles do?



Summary
SQL query dashboard filters can now offer "All", which selects every option the filter's query returns. Stacked on #3847, which added "All" for static list filters.
Include "All" optioncheckbox, hidden for single-select filters.allowAllon SQL query filters. MCPquery_tileandquery_tileswithall: truerun the filter's query to fill in its options.toSqlQueryFilterValuesand the values query settings moved to common-utils so the app and MCP run the query the same way.Behaviour notes
$variableand$__filteruse every returned option;$__conditionalAllbecomes1=1.1=1, while bare$variablebecomesNULL. Use macros for these dependencies to avoid filtering out every option. Static-list "All" still supplies its full option list;$__conditionalAllremains unconstrained.$variablebecomesNULL, and both macros become1=1.all: true; one failed or over-cap filter fails the whole call, even for unrelated tiles.How to test
On this branch, import this dashboard to ClickStack and follow the instructions:
References
Note
Medium Risk
Expands filter variables via extra ClickHouse queries on tile load and MCP runs; high-cardinality or slow options queries can block tiles or fail whole MCP batch calls, though behavior is bounded by the 1,000-option cap.
Overview
SQL query dashboard filters can now expose Include "All" option" (
allowAll), matching static-list filters. Choosing All means every value the filter’s options query returns, capped at 1,000 (tiles and editor previews error above that or when the options query fails).The dashboard and tile editor expand SQL All by running the same options query as the filter bar (
useExpandedSqlQueryVariables), block dependent tiles/previews until options resolve, and pass expanded variables into queries. The SQL filter form documents how All on sibling SQL filters behaves in dependent queries ($__filter/$__conditionalAll→1=1, bare$variable→NULL).API/MCP:
allowAllis no longer stripped from SQL query filters on the external API; OpenAPI/MCP schemas and prompts document it.clickstack_query_tile/query_tilescallexpandSqlQueryAllVariablesto run each filter’s values query when{ all: true }is passed.common-utils centralizes values-query settings and
toSqlQueryFilterValues, plus shared 1,000-option limits/messages used by app and MCP.Reviewed by Cursor Bugbot for commit 2c209d8. Bugbot is set up for automated code reviews on this repo. Configure here.