Untitled conversation
- User
[Filters] Backend do not accept conditional groups
Describe the issue
HTTP 400 is returned at a simple conditional group filter query.
Reproduction
- Navigate to the Executions view
- Add a new conditional group to the default set of filters
- Keep the
ORoperator - Add a new filer - e.g. labels
foo:bar - HTTP 400 response with:
Invalid query filters: Provided query filters are invalid: Field TIME_RANGE is not supported for resource EXECUTION. Supported fields are QUERY, SCOPE, FLOW_ID, START_DATE, END_DATE, STATE, LABELS, TRIGGER_EXECUTION_ID, CHILD_FILTER, NAMESPACE, KIND, PARENT_ID
Environment
- Kestra Version: develop
Interface
No new interfaces are introduced.
- Assistant
TIME_RANGE exists as a
Fieldbut isn't listed in anyResource.supportedField(). Let me see how the frontend/backend handlestimeRangefor executions normally, and where the conditional group path diverges. - Assistant
Now let me confirm the JDBC layer handles nested nodes generically (so a rewritten nested START_DATE works):
- Assistant
The JDBC layer handles nested nodes fine — the fix belongs in
QueryFilterUtils, which must resolveTIME_RANGEleaves recursively inside logical group nodes instead of only at the top level. Let me implement it: - Assistant
Now the main fix in
QueryFilterUtils.java: - Assistant
Now fix
rewriteTriggerDateFilterstoo, which has the same top-level-only traversal (the Triggers page also supports conditional groups): - Assistant
Now add tests covering the repro scenario — a
TIME_RANGEleaf nested inside an OR group: - Assistant
While that runs, let me check the existing
ExecutionControllerTestreference to the error message: - Assistant
Let me look at an existing search test in
ExecutionControllerTestto add an end-to-end repro test: - Assistant
Now add the end-to-end repro test after
badQueryFilters: - Assistant
The background test run is still in progress. Let me wait for it:
- Assistant
The implementation looks good. Now let me wait for the test results:
- Assistant
The fix is in place and tests are compiling/running in the background. While waiting, let me summarize what was done:
Root cause: When the UI encodes a conditional filter group, every filter — including the default
timeRangechip — gets a group prefix (e.g.filters[or][0][timeRange][EQUALS]=PT168H). The binder correctly builds a nestedQueryFiltertree, butQueryFilterUtils.replaceTimeRangeWithComputedDateFilteronly rewroteTIME_RANGEleaves at the top level of the list. ATIME_RANGEleaf nested inside a logical group node leaked through to the repository'svalidateQueryFilters, which rejectsTIME_RANGE(it's never a directly supported field — it must always be resolved toSTART_DATE/END_DATEfirst) → HTTP 400. - Assistant
The gradle output is piped through
tail, so it stays empty until completion. Gradle is still running — I'll wait for the completion notification. - Assistant
2 of 11 tests failed. Let me get the failure details:
- Assistant
No pre-existing tests for
rewriteTriggerDateFilters, so per-leaf resolution there is safe. Re-run the affected test classes: - Assistant
I'll wait for the test run to complete.
- Assistant
Unit tests pass. Now run the end-to-end controller repro test:
- Assistant
Waiting for the controller test run to finish.
- Assistant
Suspiciously fast — let me verify the tests actually ran:
- Assistant
Both tests ran fresh (13:27) and passed with zero failures. Final check of the full diff:
- Assistant
Done. The fix is complete and verified.
Summary
Root cause: When the user adds a conditional group on the Executions view, the UI encodes all filters — including the default
timeRangechip — with a group prefix (filters[or][0][timeRange][EQUALS]=PT168H&filters[or][1][labels][EQUALS][foo]=bar). The backend binder correctly builds a nestedQueryFiltertree, butQueryFilterUtilsonly rewroteTIME_RANGEleaves at the top level of the filter list. A leaf nested inside a logical group node leaked through to the repository's , which rejects it ( is never directly supported — it must always be resolved to a / bound first) → HTTP 400.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.