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
Let me start by understanding the repository structure and the issue. The issue is about filters - conditional groups in filters returning HTTP 400 with an error about
TIME_RANGEnot being supported forEXECUTIONresource.Let me explore the repository structure first.
Assistant
Let me search for files related to filters and the error message.
Assistant
Let me look at the key files related to this issue. The error message mentions:
- "Invalid query filters: Provided query filters are invalid: Field TIME_RANGE is not supported for resource EXECUTION"
This suggests that when a conditional group is used, the filter validation fails because TIME_RANGE is being applied to EXECUTION resource. Let me look at the QueryFilterUtils and related files.
Assistant
Now let me look at the QueryFilter model:
Assistant
Now I see the structure. Let me also look at the
DateUtils.validateTimelineandTimeLineSearch.extractFrom:Assistant
Let me search for callers of
replaceTimeRangeWithComputedDateFilterandvalidateQueryFiltersto understand the flowAssistant
Let me look at ExecutionController around line 250 to see the flow:
Assistant
I see the flow.
replaceTimeRangeWithComputedDateFilteris supposed to convert TIME_RANGE to START_DATE/END_DATE before passing to the repository. Then later in the JDBC layer,validateQueryFiltersis called.Let me look at where validateQueryFilters is called in AbstractJdbcRepository:
Assistant
Let me see the full
toConditionmethodAssistant
Let me check the toCondition method:
Assistant
Let me look at the
TimeLineSearchto understand how it extracts timeline fromAssistant
Let me look at the
QueryFilterFormatannotation and its binder:Assistant
Let me look at how the query filter format binder works:
Assistant
Let me look at the QueryFilterFormatBinderTest to understand the filter
Assistant
Let me check the EXECUTION resource's supported fields:
Assistant
Let me search for all places where
validateQueryFiltersis calledAssistant
Let me look at the InvalidQueryFiltersException and how it's handled
Assistant
Let me look at Search
Assistant
Let me look at the
QueryFilterFormatannotation:Assistant
Let me search for the exact error message pattern
Assistant
Let me look at the UI code for how filters are structured when conditional groups are used
Assistant
Let me search for filter-related UI components
Assistant
Let me look at the filter groups compos
Assistant
Let me look at the filter types to understand the structure
Assistant
Let me look at how filters are encoded to URL parameters in the UI
Assistant
Let me look at the QueryFilterUtilsTest
Assistant
Now let me look at how the
getConditionOnFieldhandles the TIME_RANGE inAbstractJdbcRepositoryAssistant
Let me look at lines around 400 and 547
Assistant
Let me look at lines around 540-
Assistant
Let me check the execution repository for timeRangeCondition override
Assistant
Let me look at how the UI converts filter groups to URL
Assistant
Let me look at how route sync works to understand URL
Assistant
Let me look at useRouteSync.ts
Assistant
Let me look at the encodeFilterGroupsToQuery function
Assistant
Now I understand the issue. Let me also check
rewriteTriggerDateFiltersAssistant
Let me first create a reproduce script to confirm the issue
Assistant
Now I have a clear understanding of the issue. Let me implement the fix. The problem is that
TimeLineSearch.extractFrom,QueryFilterUtils.updateFilters,QueryFilterUtils.updateFiltersForEndDate,QueryFilterUtils.rewriteTriggerDateFilters, andDateUtils.validateTimelineonly process top-level filters and don't recurse into children of node (conditional group) filters.Let me start by fixing `QueryFilterUtils
Assistant
The open command seems to have issues. Let me use the correct format.
Assistant
Let me read the full file and then apply edits.
Assistant
Now let me fix the
QueryFilterUtils.javafile. I'll add helper methods and modify the existing ones to recurse into children.First, let me fix
updateFiltersandupdateFiltersForEndDateby adding recursive helper methods:Assistant
Let me try with the --file parameter
Assistant
Let me use a different approach - I'll create a patch using sed or write the updated file content directly
Assistant
Let me use a script file to avoid bash escaping issues
Assistant
Let me try the replace command directly
Assistant
Let me try using open command with just the file
Assistant
Good, the file is now open. Let me use the
editcommand to modifyupdateFilters:Assistant
Let me use
sedto make the changes in a more controlled way.Assistant
Let me disable history expansion and try again
Assistant
Now let me fix `updateFiltersForEndDate
Assistant
Now let me fix `rewriteTriggerDateFilters
Assistant
Now let me fix
TimeLineSearch.extractFromto recurse into childrenAssistant
Now let me edit the
extractFrommethod to recurse into children:Assistant
Let me use perl again for this fix
Assistant
Now let me fix
DateUtils.validateTimelineto recurse into childrenAssistant
Let me see the full validateTimeline method
Assistant
Now let me fix the
validateTimelinein `DateUtilsAssistant
Let me verify all modified files look
Assistant
Let me also verify the TimeLineSearch.java
Assistant
Let me check the DateUtils
Assistant
Now let me try to compile to make sure there are no errors
Assistant
Build succeeded. Now let me run the relevant tests
Assistant
Let me run the binder tests and the TimeLineSearch
Assistant
Let me run the QueryFilter core tests and any relevant
Assistant
All tests pass. Now let me write a quick verification script to confirm the fix works for the specific scenario described in the issue:
Assistant
Let me search for other places that might need similar recursive handling
Assistant
Let me check the AbstractJdbcExecutionRepository for potential issues with recursive handling
Assistant
Let me run all the relevant tests one more time to be sure
Assistant
Let me run the execution repository tests too
Assistant
Let me see the test failure details
Assistant
That's an abstract test class, so it can't be run directly. That's fine - no actual failure.
Let me review all my changes one final time
Assistant
Let me run the jdbc tests for the execution repository to make sure nothing is broken:
Assistant
Let me check what concrete test classes exist
Assistant
Let me run the H2 execution
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.