feat: Accept variable-keyed dashboard filter values - #2963
Conversation
🦋 Changeset detectedLatest commit: dd0c178 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 extends dashboard filter persistence and external API schemas to accept selections keyed by dashboard variable names while retaining legacy expression-keyed entries.
Confidence Score: 3/5The PR does not appear safe to merge because variable-keyed selections can still be ignored on load and removed when another dashboard filter changes. The earlier read-path issue remains because variable entries are filtered out before active variables are derived, despite the reply stating that it is addressed by the second PR; separately, the mutation path rebuilds URL state from expression entries alone and the save path persists that rewritten state. The earlier reply from greptile conceded that the mutation issue was not reachable in this PR, but the current API and initialization path provide the concrete counterexample by accepting variable-keyed savedFilterValues and copying them into the URL before setFilterValue runs. Files Needing Attention: packages/app/src/hooks/useDashboardFilters.tsx and packages/app/src/DBDashboardPage.tsx
|
| Filename | Overview |
|---|---|
| packages/app/src/hooks/useDashboardFilters.tsx | Expands URL state typing but still strips variable-keyed entries from both the mutation and active-state derivation paths. |
| packages/app/src/DBDashboardPage.tsx | Uses the expanded parser and round-trips raw filter URL state between saved dashboards and subsequent saves. |
| packages/common-utils/src/dashboardFilterValues.ts | Adds shared parsing, serialization, key selection, and precedence helpers for mixed expression- and variable-keyed state. |
| packages/common-utils/src/types.ts | Extends the shared dashboard schema with bounded variable-keyed filter values. |
| packages/api/src/utils/zod.ts | Extends external dashboard validation to accept strict variable-keyed saved-filter entries. |
| packages/api/src/routers/external-api/v2/dashboards.ts | Documents the new saved-filter union and its limits in the external API annotations. |
| packages/api/openapi.json | Publishes the matching SQL-or-variable saved-filter union in the generated API contract. |
Reviews (6): Last reviewed commit: "feat: Accept variable-keyed dashboard fi..." | Re-trigger Greptile
E2E Test Results✅ All tests passed • 308 passed • 1 skipped • 1055s
Tests ran across 4 shards in parallel. |
🔴 Tier 4 — CriticalTouches authentication, tenancy data models, the public API or shipped database config — or substantially changes the query rendering engine, 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. This is well-scoped Part 1/2 infrastructure: it widens schemas and read paths to accept variable-keyed dashboard filter values without wiring any write path, and it lands with thorough unit and integration coverage. Existing SQL-expression-keyed dashboards parse and behave identically ( 🔵 P3 nitpicks (2)
Reviewers (8): correctness, adversarial, api-contract, testing, kieran-typescript, maintainability, previous-comments, project-standards. Testing gaps:
|
Fixed in the next PR in the stack, I will merge them together. This PR doesn't write variable-keyed state so this isn't hit in practice even if this does merge. |
52f11d3 to
bbefc40
Compare
bbefc40 to
a79326a
Compare
a79326a to
6e8e88e
Compare
6e8e88e to
461fe8a
Compare
461fe8a to
dd0c178
Compare
Summary
Part 1/2 in enabling variable-name-based dashboard filter state. This part covers the types/schema changes and the MCP + API + Import paths.
Why
Historically, dashboard filter selection state has been persisted (in the URL, dashboard documents, and exports) as keyed by the filter's expression, in the same format used by search-page filters. This has two problems:
What
This change will persist dashboard filter selection state (that is, what values are selected in the filter's drop-down) based on the variableName of the filter, when it has one.
Screenshots or video
How to test
This will be easier to test on top of PR 2/2
References