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
Now let me see how
TIME_RANGEis normally handled — where it's converted to start/end dates: - Assistant
Let me check how the frontend encodes filters when groups exist:
- Assistant
Now let me check
DateUtils.validateTimelinewhich runs on the updated filters: - Assistant
Let me check how the JDBC layer handles nested nodes and TIME_RANGE:
- Assistant
The fix belongs in
QueryFilterUtils— the TIME_RANGE→date rewriting must descend into node children. Let me implement it: - Assistant
Now fix
rewriteTriggerDateFilters, which has the same blindness to nested groups (the Triggers page uses the same group filter UI): - Assistant
Now add tests covering the nested-group scenario from the issue:
- Assistant
Now run the tests:
- Assistant
While that runs, let me review the final state of the modified file:
- Assistant
I'll add a controller-level test reproducing the exact issue scenario:
- Assistant
Let me verify the JDBC layer handles nested nodes with date leaves (so the rewritten filter executes):
- Assistant
The fix and tests are in place. Waiting on the Gradle run (
:webserver:test --tests QueryFilterUtilsTest) to finish — it will notify when complete.Summary of the change so far:
- Root cause: When the UI adds a conditional group, all filters — including the default
timeRange— get encoded under afilters[or][N]prefix. The binder builds a logical OR node, butQueryFilterUtils.replaceTimeRangeWithComputedDateFilter()only rewrote top-level leaves, so the nestedTIME_RANGEleaf reached the repository and failedvalidateQueryFiltersforEXECUTION→ HTTP 400. - Fix (
webserver/src/main/java/io/kestra/webserver/utils/QueryFilterUtils.java): recursively resolveTIME_RANGEleaves inside logical nodes intoSTART_DATE/END_DATEboundaries (now() - durationper leaf), and make the "has a date filter already" check recursive so the safety-defaultSTART_DATEisn't AND-ed on top of a group that already carries its own time range (which would silently clip user-selected ranges). Applied the same recursion torewriteTriggerDateFilters(Triggers page uses the same group UI).
- Root cause: When the UI adds a conditional group, all filters — including the default
- Assistant
Unit tests pass (7/7). Now run the related regression tests —
TimeLineSearchTest, the new controller test, and the trigger controller tests: - Assistant
Regression tests running in the background (ExecutionControllerTest is a heavy
@KestraTestsuite — may take a while). I'll report when they finish. - Assistant
Waiting for the ExecutionControllerTest run to confirm the new controller test passes.
- Assistant
All tests pass. The fix is complete and verified.
Summary
Issue: Adding a conditional (OR) group on the Executions view returned HTTP 400:
Field TIME_RANGE is not supported for resource EXECUTION.Root cause: When a conditional group exists, the UI encodes all filters — including the default
timeRangechip — under afilters[or][N][...]prefix. The binder correctly builds a logical OR node tree, but only rewrote on . A leaf nested inside a group node passed through untouched and was rejected by the repository's for .
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.