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.
Assistant
I'll start by exploring the repository structure to understand the codebase and then locate the issue related to conditional group filters.
Assistant
Let me search for files related to query filters, particularly around EXECUTION resource and conditional groups. The error message mentions "Field TIME_RANGE is not supported for resource EXECUTION" which gives me a good starting point.
Assistant
The open command needs to use the correct format. Let me try without the file parameter prefix.
Assistant
Let me try the open command correctly without any prefix for the file parameter.
Assistant
Let me examine the QueryFilterUtils file that handles TIME_RANGE:
Assistant
Now I can see the validation logic. Let me understand the issue better - the error message says "Field TIME_RANGE is not supported for resource EXECUTION". Let me look at how validation handles conditional groups and where this error originates:
Assistant
Let me look at the execution controller and see how filters are being processed:
Assistant
Now let me look at the ExecutionController to understand how filters are being validated:
Assistant
The user is asking me to continue working. Let me look at where the validation happens in the ExecutionController to understand the flow better. I need to find where the filters are being validated and where TIME_RANGE might be causing issues with conditional groups.
Let me search for where validateQueryFilters is called in the execution controller.
Assistant
Assistant
Now I see the issue! The
extractFrommethod only iterates over the top-level filters. When it encounters a node (conditional group), it checksif (filter.field() == null) { continue; }and skips it entirely without recursing into the children.So when a conditional group contains a TIME_RANGE filter,
TimeLineSearch.extractFromnever finds it, and thenupdateFiltersdoesn't replace it either because it also doesn't recurse into children.The fix needs to be applied in two places:
TimeLineSearch.extractFrom- needs to recursively extract from childrenQueryFilterUtils.updateFiltersandQueryFilterUtils.updateFiltersForEndDate- need to recursively update children
Let me also check if there are similar methods in
rewriteTriggerDateFilters:Looking at the code again, I can see that
rewriteTriggerDateFiltersalso has the same issue - it only maps over the top-level filters without recursing into children.Now let me create a test to reproduce the issue first, then fix it.
Assistant
Good, now I understand the test structure. Let me check the QueryFilterUtilsTest as well.
Assistant
Now let me create a simple test script to reproduce the issue with conditional groups:
Assistant
Assistant
Looking at this more carefully, I think I now understand the issue. The problem is that
TimeLineSearch.extractFrom()andQueryFilterUtils.updateFilters()only look at top-level filters and don't recurse into children of conditional group nodes. This means if any filter (including TIME_RANGE) is inside a conditional group, it won't be processed.Let me look for test cases that might show conditional groups:
Assistant
Looking at the test cases, I can see conditional groups with nested children are used. The issue is that
TimeLineSearch.extractFrom()andQueryFilterUtils.updateFilters()don't recurse into children. Let me now write a fix.Assistant
Now I understand the issue. The
extractFrommethod needs to recurse into children when it encounters a node. Let me fix bothTimeLineSearch.extractFrom()and theupdateFiltersmethods inQueryFilterUtils.Assistant
Let me apply this fix to the TimeLineSearch.java file:
Assistant
Now let me fix the QueryFilterUtils.java file to make the updateFilters methods recursive:
Assistant
I need to copy the fixed file to the correct location:
Assistant
Let me verify the files were updated correctly and run the tests to make sure they pass.
Assistant
I have a compilation error. Let me fix it -
newLinkedHashSetdoesn't exist. I should use a simple ArrayList:Assistant
I need to run the tests again to verify the compilation error is fixed and the tests pass.
Assistant
There are still compilation errors. Let me see the full error output:
Assistant
Let me fix the TimeLineSearch.java to avoid the lambda capture issue:
Assistant
Let me compile and run the tests again:
Assistant
Now let me run the tests to see if they pass:
Assistant
Now let me also run the QueryFilterUtilsTest to make sure those tests pass:
Assistant
Excellent! The existing tests pass. Now let me create a test to verify that my fix works for conditional groups. I'll create a simple script to test the fix:
Assistant
Let me write a proper test to verify the fix works for conditional groups:
Assistant
All 4 tests pass! This confirms that my fix works correctly. Now let me also run the existing tests to make sure I didn't break anything:
Assistant
Excellent! All 85 tests pass. Now let me remove my test file since I shouldn't add new tests (as per the instructions):
Assistant
Now let me run some broader tests to make sure I haven't broken anything else. Let me check if there are any other places where these methods might be used.
<tool_call> <function=bash_terminal> <parameter=command> grep -r "rewriteTriggerDateFilters" /kestra --include="*.java" -l </tool_call>
Assistant
I need to use the bash_terminal function to search for usages of rewriteTriggerDateFilters.
Assistant
Good. Let me also verify that I didn't break anything else by running a broader set of tests. Let me check the trigger-related tests since I modified
rewriteTriggerDateFilters.Assistant
72 tests passed. Let me also check if there are any tests related to execution that might be affected by my changes.
Assistant
138 tests passed. Let me verify my changes and then submit.
Assistant
I need to check the git diff to see the changes I made. Let me use the bash_terminal command properly.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.