Repository navigation
Conversation
- Add IN (SQL) and =| (PromQL) operators; conditions on the same key are OR'd into one IN (...) or =~"a|b" condition. - Ad hoc filters always broadcast (isBroadcastEnabled: z.literal(true)), and their variable name is a unique identifier only, no longer declared as a $variable. - Warn when another ad hoc filter already applies to the same sources. - Collapse the filter input to three conditions behind a "+N more" toggle.
🦋 Changeset detectedLatest commit: 0b8dfa4 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
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
PR Review
4 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 4 minor 3 posted as inline comment(s) on the changed lines. 1 listed below. Findings outside the changed lines1 minor
Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides. |
Deep ReviewScope: Intent: Make the ad hoc filter name a unique identifier rather than a referenceable variable, force broadcast always-on, add an overlap warning, collapse condition chips, and add The core logic is sound: escaping for both new operators is correct (SQL 🟡 P2 — recommended
🔵 P3 nitpicks (5)
Reviewers (7): correctness, security, kieran-typescript, testing, maintainability, project-standards, previous-comments. Testing gaps:
Coverage note: 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 • 468 passed • 1 skipped • 1156s
Tests ran across 4 shards in parallel. |
One predicate decides whether a filter's name is a referenceable variable, used by getDashboardVariableFilters, getFilterEffect, and the filters list. Updates the ad hoc filter e2e specs for the removed broadcast checkbox and the list no longer showing an ad hoc filter's name as a variable.
Summary
Finishing touches for ad hoc dashboard filters, which are still behind
NEXT_PUBLIC_ENABLE_ADHOC_FILTERS.$name, but its name still has to be unique because it keys the filter's conditions in thefilters=URL param. The edit form now says so. The filter-bar tooltip and the filters list no longer present it as a variable.getDashboardVariableFiltersskips ad hoc filters, so checkAlerts, MCP validation and the alert chart stop declaring them.isVariableEnabled: truestays, because name-uniqueness validation reads it.isBroadcastEnabled: z.literal(true), the same waySTATIC_LISTandPROMETHEUS_LABELusez.literal(false). The edit form drops the broadcast checkbox and always shows "Applies to sources".IN(SQL) and=|(PromQL) operators. Each condition still holds one key and one value. When rendered, conditions sharing a key are OR'd: SQL renderstoString(key) IN ('a', 'b')and PromQL renderskey=~"a|b", with regex characters escaped. These are two separate stored values, each valid only for its source type. A condition the filter's source type can't express is skipped and its chip is marked invalid.Compatibility: an ad hoc filter already stored with
isBroadcastEnabled: false, or without the field, will no longer parse. The feature is behind a flag, so there is no migration.Screenshots or video
I couldn't capture screenshots from my environment. @aaronknudtson, please add before/after shots of the ad hoc filter edit modal and of a filter input holding more than 3 conditions.
How to reproduce
Starting point:
yarn dev.packages/app/.env.developmentsetsNEXT_PUBLIC_ENABLE_ADHOC_FILTERS=true.On
main:inoption.On this branch:
ServiceName in apiandServiceName in web. Tiles on Logs filter withtoString(ServiceName) IN ('api', 'web'). On a Prometheus ad hoc filter,=|conditions on the same label render aslabel=~"(a|b)".How to test on Vercel preview
N/A. The preview builds without
NEXT_PUBLIC_ENABLE_ADHOC_FILTERS, so ad hoc filters aren't offered there.Preview routes: N/A
Steps:
References