ISSUE DESCRIPTION [Filters] Backend do not accept conditional groups Describe the issue…
- User
ISSUE DESCRIPTION
[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
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /kestra, current file: none) bash-$
- Assistant
I'll start by exploring the repository structure to understand the codebase and locate relevant files for the issue. The issue mentions "Filters" and "conditional group filter query" causing HTTP 400 with error about TIME_RANGE not supported for resource EXECUTION. Let's first look at the repository.
- Assistant
Let me explore the repository structure to understand what we're dealing with.
- Assistant
The issue mentions "conditional group filter query" and an error about "TIME_RANGE is not supported for resource EXECUTION". Let me search for relevant filter-related code.
- Assistant
Let me look at the error message: "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"
The issue is about conditional groups. Let me search for "conditional group" in the codebase.
- Assistant
Let me look at the filter-related files to understand the issue.
- Assistant
Let me look at the QueryFilter class and the QueryFilterUtils class to understand the issue better.
- Assistant
Let me look at the QueryFilter model and the QueryFilterUtils to understand how filters are processed. clash
- Assistant
Now let me look at the
TimeLineSearchandQueryFilterUtilsto understand how TIME_RANGE is handled. - Assistant
Let me look at the
TimeLineSearchclass and also look at how the filter validation works, especially how the validation handles nested filters (conditional groups). - Assistant
Now I understand the issue better. Let me look at the EXECUTION resource definition and how filters are validated.
- Assistant
Let me look at the EXECUTION resource definition in detail.
- Assistant
Now let me understand the flow - the issue is that
TIME_RANGEis not a supported field forEXECUTIONresource, but when using conditional groups, the validation happens before theTIME_RANGEis converted toSTART_DATE/END_DATE. Let me look at where validation happens and where the conversion of TIME_RANGE happens. - Assistant
Now I see the issue. Let me look at the execution controller and the AbstractJdbcRepository to understand the flow better.
- Assistant
Let me check where validation happens in the filter format binder or controller.
- Assistant
Let me look at the QueryFilterFormatBinder to understand how filters are parsed.
- Assistant
Now let me look at where the validation is called to understand the flow.
- Assistant
Let me see how this method is called.
- Assistant
Let me look at the
toConditionmethod: - Assistant
Let me see the full
toConditionmethod. - Assistant
Now I understand the issue. The problem is clear:
TimeLineSearch.extractFrom()only iterates top-level filters, not recursing into conditional group childrenupdateFilters()andupdateFiltersForEndDate()only process top-level filters- So when a TIME_RANGE filter is inside a conditional group (node with logical + children), it never gets replaced with START_DATE/END_DATE
- But
validateQueryFilters()DOES recurse into children, so it finds the unsupported TIME_RANGE field
The fix needs to make
QueryFilterUtilsmethods recursive. Let me also look at the fullupdateFiltersandupdateFiltersForEndDate: - Assistant
Now let me look at the test files to understand expected behavior:
- Assistant
Now I understand the issue clearly. When a filter contains a conditional group (node with
logical+children), theTimeLineSearch.extractFrom()andupdateFilters()/updateFiltersForEndDate()methods only iterate top-level filters and skip the node filters (wherefield() == null). They don't recurse into children. ButvalidateQueryFilters()DOES recurse into children, so it finds theTIME_RANGEfield which isn't in the EXECUTION resource's supported fields.The fix needs to make these methods recursive to handle TIME_RANGE filters inside conditional groups.
Let me first check the
TimeLineSearch.extractFrommethod more carefully: - Assistant
Now I have a clear understanding. Let me look at the existing tests to make sure I understand the test structure:
- Assistant
Now let me look at how
rewriteTriggerDateFiltersalso works: - Assistant
Now let me look at the
DateUtils.validateTimelinemethod: - Assistant
Let me check if
DateUtils.validateTimeline(filters)also needs to recurse into children. - Assistant
Now I have a clear picture of the issue. Let me also look at the
collectValidationErrorsto confirm it handles nested filters: - Assistant
Now I understand the full issue. The problem is:
TimeLineSearch.extractFrom()only looks at top-level filters and skips node filters (wherefield() == null), missing TIME_RANGE inside conditional groupsupdateFilters()andupdateFiltersForEndDate()also only process top-level filters, not recursing into children of conditional groups- But
validateQueryFilters()DOES recurse into children (viacollectValidationErrors), finding unsupported TIME_RANGE
I need to make the filter replacement methods recursive. Let me fix
TimeLineSearch.extractFromfirst: - Assistant
Now let me fix
TimeLineSearch.extractFromto recurse into conditional groups: - Assistant
Now I have a complete understanding of the issue. Let me implement the fix. The core problem is that
TimeLineSearch.extractFrom(),updateFilters(),updateFiltersForEndDate(), andrewriteTriggerDateFilters()don't recurse into conditional group children.Let me fix
TimeLineSearch.extractFromfirst: - Assistant
Now let me fix the
QueryFilterUtilsclass. TheupdateFiltersandupdateFiltersForEndDatemethods need to handle conditional groups: - Assistant
Now let me update
updateFiltersto handle conditional groups: - Assistant
Now update
updateFiltersForEndDate: - Assistant
Now I need to add the
hasDateFilterRecursivehelper method and updaterewriteTriggerDateFilters: - Assistant
Now I need to add the
hasDateFilterRecursivehelper and updaterewriteTriggerDateFilters: - Assistant
I see there's an extra
}at the end. Let me check and fix: - Assistant
There's an extra closing brace at the end. Let me fix that.
- Assistant
Now let me also check the
DateUtils.validateTimeline(List<QueryFilter>)to see if it needs to be recursive: - Assistant
I also need to update
DateUtils.validateTimeline(List<QueryFilter>)to recurse into conditional groups since after our fix the date filters might be inside conditional groups: - Assistant
Now let me also check if
DateUtils.validateTimelineneeds to be updated. Actually, looking at it, it's called after the filters have already been transformed, so it should still work since the date filters it's looking for would be at the top level or within groups. But for correctness with the new recursive behavior, let me also make it recursive: - Assistant
I also need to make
DateUtils.validateTimeline(List<QueryFilter>)recursive since date filters can now be inside conditional groups: - Assistant
Good. Now let me verify the changes compile and run the existing tests:
- Assistant
Let me run the existing tests to make sure they pass:
- Assistant
All existing tests pass. Let me also run the QueryFilterFormatBinder test and other related tests:
- Assistant
All tests pass. Let me also run the QueryFilterTest:
- Assistant
All tests pass. Now let me create a simple reproduction script to verify the fix works for the specific scenario described in the issue:
- Assistant
Now let me try to compile and run this verification. I'll use Gradle to run it:
- Assistant
Good, it compiles. Let me review the full diff of my changes:
- Assistant
The diff looks correct. Let me also run the full test suite for the affected modules to make sure nothing is broken:
- Assistant
All 96 tests pass. Let me also check if there are any JDBC repository tests that test filter validation:
- Assistant
Let me also check if there are any related tests in the core module:
- Assistant
All 194 core utility tests pass. Let me do a final review of the changed files:
- Assistant
Let me now review the final state of all three files to make sure everything is correct.
- Assistant
Let me also review the DateUtils file:
- Assistant
Let me clean up and run all the related tests one final time:
- Assistant
Let me run all the related tests one more time to make sure everything is good.
- Assistant
All tests pass. Let me run the full diff one more time to confirm all changes:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →