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
Interface
No new interfaces are introduced.
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 exploring the repository structure to understand the
Assistant
Let me explore the structure of the codebase to understand it
Assistant
Let me view the QueryFilterUtils file:
Assistant
Let me look for places where
validateQueryFiltersis called:Assistant
Let me look at the issue more carefully by searching for where this error comes from:
Assistant
me look at the ExecutionController around line 250:
Assistant
me look at JdbcFilterService:
Assistant
Let me view more of the AbstractJdbcRepository filter method:
Assistant
Let me look at the rest of the QueryFilter.java file:
Assistant
check the UI side to understand the request format:
Assistant
Let me trace how the filters with conditional groups get sent:
Assistant
Let me look at how the executions page builds the filters:
Assistant
me look at how default filters are applied:
Assistant
Let me look at the execution filter configuration:
Assistant
Let me create a small reproduction script to verify the issue:
Assistant
Let me look at the existing tests to understand the data flow:
Assistant
Let me look at the test class structure:
Assistant
Let me create a quick test script to understand the issue first:
Assistant
Now let me check the InvalidQueryFiltersException:
Assistant
Let me see if the existing tests pass:
Assistant
Let me write a reproduction script:
Assistant
Let me write a unit test directly in the project to reproduce:
Assistant
Let me create a temporary test file to reproduce the issue:
Assistant
The bug is reproduced. Now let me also verify the validation fails when given the result:
Assistant
Let me look at the JDBC repository filter flow more carefully:
Assistant
I have a clear understanding. Let me implement the fix. First, let me view the current code once more:
Assistant
Now let me look at the
TimeLineSearchclass:Assistant
Now let me implement the fix. The strategy is to recursively traverse the filter tree in
TimeLineSearch.extractFrom,updateFilters,updateFiltersForEndDate, andrewriteTriggerDateFiltersto handleTIME_RANGE/START_DATE/END_DATEfilters at any nesting level:Assistant
, I need to revise my approach. Let me write the TimeLineSearch more correctly:
Assistant
Now let me update the QueryFilterUtils.java to recursively handle filters inside nodes:
Assistant
me fix the duplicate null check:
Assistant
Now let me view the full file:
Assistant
Now let me run the reproduction test to confirm the fix works:
Assistant
Both tests pass now. Let me also run the existing QueryFilterUtils tests to make sure I didn't break anything:
Assistant
All tests pass. Now let me think about edge cases and verify my fix is correct. Let me re-read the existing TimeLineSearchTest:
Assistant
look at the existing QueryFilterUtilsTest to understand the existing behavior:
Assistant
my reproduction test to cover more edge cases:
Assistant
Let me trace the issue. My implementation is doing "in place" replacement which puts START_DATE inside the OR group. But the correct semantic is to "lift" the time range filter out of the group. Let me fix this:
Assistant
All 5 tests pass. Let me also run the existing tests:
Assistant
Let me check the failure details:
Assistant
I need to change my approach. The existing tests expect "in place" replacement at the top level (preserving original operations). Let me implement a hybrid approach: in-place at top level, lift at nested level:
Assistant
Let me fix the logic for the hybrid approach:
Assistant
All 39 tests pass! Let me also run the core tests to make sure I didn't break anything:
Assistant
Let me also run the JDBC tests to make sure my changes don't break anything:
Assistant
me run the tests with --rerun-tasks:
Assistant
Now 893 tests pass and none are failing. The previous failure must have been intermittent. Let me check if there are any new issues.
Wait, the test output was truncated. Let me run again with better
Assistant
All 893 tests pass. Now let me clean up the temporary test file and run the broader webserver test suite:
Assistant
The tests are running but it timed out before finishing. Let me check if all tests have finished by waiting a bit more:
Assistant
Gradle is not running anymore, so the test was killed. Let me check the report:
Assistant
Let me check what tests are related to my changes:
Assistant
me check if there are tests related to the execution controller or trigger repository:
Assistant
Let me run the actual test file for ExecutionController to ensure my changes don't break it:
Assistant
The test passes. Now let me also check the searchExecutionsByFlowId test which uses TIME_RANGE:
Assistant
tests pass. Let me also run tests that use complex filters (like search executions with complex filters):
Assistant
Let me now look at the searchExecutions test to see what complex filters it tests:
Assistant
me look at the test in more detail:
Assistant
Let me create a more comprehensive test scenario to verify the fix. First, let me look at the JDBC repository find method to understand the flow:
Assistant
Let me run the full set of related tests once more:
Assistant
All 96 tests pass. Let me verify by reading my changes once more:
Assistant
Let me search for other places that might have similar issues:
Assistant
The TIME_RANGE-related logic is only in these two files. My changes should cover all the cases.
Let me also check if there are other places that use the same pattern (only top-level filters):
Assistant
me also check the LogController since it uses TIME_RANGE too:
Assistant
The LogController also uses
replaceTimeRangeWithComputedStartDateFilter. This should also benefit from my fix.Let me check the trigger controller:
Assistant
The TriggerController also uses
rewriteTriggerDateFilters. My fix updates this method to recursively traverse the filter tree.Let me run the trigger tests:
Assistant
All 151 trigger tests pass. Now let me also look at one more thing - the controller test that might have similar scenarios:
Assistant
Let me check the BlueprintController:
Assistant
BlueprintController explicitly rejects nested filter groups. This is expected behavior for the BLUEPRINT resource.
Let me now also look at what
validateTimelinedoes:Assistant
look at the diff to make sure my changes are clean:
Assistant
Let me verify I removed the temporary test file:
Assistant
Now let me create a final temporary verification script to confirm the fix works for the original bug case:
Assistant
All 4 tests pass. Let me clean up the temporary test file:
Assistant
4 tests pass. Let me do a final check on the affected areas:
Assistant
All tests pass. Let me do a final review of my changes:
Assistant
The diff looks clean. Let me also verify the final files one more time:
Assistant
Let me verify all existing patterns are still followed correctly:
Assistant
Let me check if
isDateBoundaryFilteris used anywhere else:Assistant
Let me remove the unused
isDateBoundaryFiltermethod since it's no longer used:Assistant
I accidentally deleted too many lines. Let me fix this:
Assistant
Now let me verify the file compiles and tests still pass:
Assistant
The unused
isDateBoundaryFiltermethod has been removed. Now let me check the git status:Assistant
All 96 tests still pass. Let me also verify the fix one more time with the original bug case:
Assistant
me remove this file - it's not a JUnit test so Gradle won't pick it up:
Assistant
Let me do a final summary of changes:
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.