feat: Add filter variable configuration - #2836
Conversation
🦋 Changeset detectedLatest commit: 33e693f 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.
|
Greptile SummaryThis PR adds feature-gated broadcast and variable configuration for dashboard filters, including UI controls, shared validation, persistence, import/export support, and test coverage.
Confidence Score: 4/5The PR is not yet safe to merge because provisioned dashboards can still persist variable-enabled filters without any usable variable token. The API request paths now reject enabled variables whose names cannot resolve, but the provisioning task still parses the bare dashboard schema and writes its filters directly, leaving the previously reported invalid persisted state reachable. Files Needing Attention: packages/common-utils/src/types.ts; packages/api/src/tasks/provisionDashboards/index.ts
|
| Filename | Overview |
|---|---|
| packages/common-utils/src/types.ts | Adds the variable and broadcast fields, but the schema used by dashboard provisioning still permits variable-enabled filters without a usable token. |
| packages/common-utils/src/dashboardValidation.ts | Adds shared dashboard-level validation for variable-name resolution, uniqueness, and the requirement that at least one filter mode be enabled. |
| packages/api/src/routers/api/dashboards.ts | Applies the shared filter validations to internal dashboard creation and partial updates. |
| packages/api/src/routers/external-api/v2/utils/dashboards.ts | Applies the shared filter validations to external dashboard create and update request schemas. |
| packages/app/src/DashboardFiltersModal.tsx | Adds feature-gated broadcast and variable controls, derived variable names, and client-side validation. |
Reviews (3): Last reviewed commit: "feat: Improved validation, implement bro..." | Re-trigger Greptile
E2E Test Results✅ All tests passed • 279 passed • 1 skipped • 1120s
Tests ran across 4 shards in parallel. |
6c65b8c to
03f5bee
Compare
🔴 Tier 4 — CriticalTouches authentication, tenancy data models, the public API or shipped database config — or substantially changes background tasks, the OTel pipeline, image build, or release CI. Why this tier:
Review process: Deep review from a domain expert. Synchronous walkthrough may be required. Stats
|
Deep Review✅ No critical issues found. The change is well-guarded: the missing- The items below are recommendations and nits only. 🟡 P2 -- recommended
🔵 P3 nitpicks (4)
Reviewers (10 dimensions): correctness, testing, maintainability, project-standards, api-contract, kieran-typescript, frontend-races, adversarial, security, agent-native, learnings-research. Testing gaps: Confirm the new suites cover the backward-compat path (a legacy filter with Note: the automated sub-reviewer fan-out was truncated before individual agents reported, so this report reflects direct full-diff analysis across the dimensions above rather than merged per-agent findings. |
03f5bee to
33e693f
Compare
| * Whether a filter definition broadcasts its selected value onto a tile | ||
| * whose source is `sourceId`. | ||
| */ | ||
| const definitionAppliesToSource = ( |
There was a problem hiding this comment.
Changes in this file prevent filters with broadcast mode disabled from being applied to any dashboard tiles.
| onRemoveFilter={handleRemoveFilter} | ||
| source={source} | ||
| isLoading={isFetchingFilters || isFiltersMutationPending} | ||
| showVariableOptions={false} |
There was a problem hiding this comment.
The user doesn't define tiles on this dashboard, so there is no reason for variable-type filters. The UI will not show the option to enable variable mode or disable broadcast mode.
| * field broadcasts, and that must not change. Read it through | ||
| * `isFilterBroadcastEnabled` rather than defaulting at each call site. | ||
| */ | ||
| isBroadcastEnabled: z.boolean().optional(), |
There was a problem hiding this comment.
do we want to make these changes on the model side as well?
Summary
This PR updates the dashboard filter configuration modal to support enabling "variable" mode for a filter, which will allow users to refer to the filter value as a variable in queries.
This feature is behind the
NEXT_PUBLIC_ENABLE_DASHBOARD_VARIABLESfeature toggle, since the actual variable replacement is not yet implemented.Variable mode is off by default for existing filters and on by default for new filters, when the toggle is on. The user may specify a custom name for the variable. A default variable name is generated from the filter's name. Variable names must be unique in the dashboard, while filter names may not be.
Variable mode and broadcast mode (the current behavior) may both be enabled or disabled independently. When the feature is disabled, broadcast mode cannot be disabled and variable mode cannot be enabled - the checkboxes do not appear.
**Note: Variable substitution functionality is not implemented by this PR. ** Only configuration of variable type filters is implemented.
Screenshots or video
With the toggle enabled
Screen.Recording.2026-08-07.at.2.26.31.PM.mov
Updated tooltips and broadcast-disabled functionality
Screen.Recording.2026-08-10.at.12.33.45.PM.mov
Variable mode is not available on Preset Dashboards, and broadcast mode cannot be disabled
This works on temporary/local dashboards as well
Screen.Recording.2026-08-07.at.2.32.12.PM.mov
Import/Export preserves variable mode
Screen.Recording.2026-08-07.at.2.33.56.PM.mov
With the toggle disabled
Screen.Recording.2026-08-07.at.2.40.45.PM.mov
How to test locally
NEXT_PUBLIC_ENABLE_DASHBOARD_VARIABLESis enabledReferences