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
I'll start by exploring the repository structure and searching for code related to query filters and conditional groups.
- Assistant
Let me search more specifically for QueryFilter and TIME_RANGE and conditional groups.
- Assistant
rg is not available, let me use grep.
- Assistant
I'll examine QueryFilter.java and how validation handles conditional groups.
- Assistant
There's a GROUP field and validation logic. Let me read the QueryFilter.java file carefully, especially around FIELD.GROUP, TIME_RANGE, Resource.EXECUTION, and validateQueryFilters.
- Assistant
Let me read the validation part and Field.TIME_RANGE and Resource.EXECUTION.
- Assistant
Let me read Resource.EXECUTION and validation methods.
- Assistant
Let me look at how filters are processed on the backend - perhaps there's a conversion from TIME_RANGE to START_DATE/END_DATE that doesn't handle nested/conditional groups.
- Assistant
Let me look at QueryFilterUtils thoroughly - especially replaceTimeRangeWithComputedDateFilter - it may not handle nested children (conditional groups).
- Assistant
Let me read the rest of the file.
- Assistant
The issue may be that nested conditional group children aren't handled. I'll check validation, timeline extraction, and how filter queries with groups are parsed.
- Assistant
I'll inspect the ExecutionController list endpoint and how filters are parsed from the HTTP request.
- Assistant
There's a
@QueryFilterFormatannotation. Let me find how filters are parsed. - Assistant
Let me look at the converters package.
- Assistant
Let me read the full QueryFilterFormatBinder.java
- Assistant
Continue reading the rest.
- Assistant
Continue to the end
- Assistant
Let me check how the UI builds filters when conditional groups are added.
- Assistant
Hmm empty results for the pattern? Maybe path issue.
- Assistant
Let me look at useFilters and how filters are serialized to query params. Also look for conditional group handling.
- Assistant
Those are short. Let me look at design-system filter package and the package filter utils in UI.
- Assistant
There's useFilterGroups and helpers - let me read those and how routes encode filters.
- Assistant
When conditional groups exist,
timeRangeis nested under OR/AND and never transformed. I'll inspect JDBC repository filter handling for nested nodes. - Assistant
There's already some node support in AbstractJdbcRepository. Let me check DateUtils, tests, and how nested date filters are handled.
- Assistant
I'll inspect DateUtils and existing tests to match the expected behavior.
- Assistant
Let me also check the jdbc filter method and whether memory repositories need the same fix.
- Assistant
Checking recent related commits and AGENTS.md for guidance.
- Assistant
The "feat: instance filters" commit likely introduced conditional groups. Checking whether TIME_RANGE handling was left incomplete.
- Assistant
Let me also search for when logical groups were added to QueryFilter.
- Assistant
There's
feat: support AND/OR boolean logic in query filters (#16170). Let me look at what that changed regarding TimeLineSearch and QueryFilterUtils. - Assistant
I'll implement recursive TIME_RANGE handling in QueryFilterUtils, TimeLineSearch, and DateUtils.
- Assistant
I left a dead method with an incomplete implementation. Cleaning that up now.
- Assistant
Removing the dead
rewriteTriggerDateFiltermethod. - Assistant
Now I'll update TimeLineSearch and DateUtils.
- Assistant
Now update DateUtils.validateTimeline to recurse containers.
- Assistant
I'll write a temporary script to verify the rewriting logic and run the related unit tests.
- Assistant
The output was truncated. Checking whether the tests passed.
- Assistant
Tests report UP-TO-DATE, so they may not have re-run. Forcing a recompile and clean test.
- Assistant
I'll create a temporary verification that reproduces the issue scenario (nested TIME_RANGE under OR).
- Assistant
I'll write a temporary test file to reproduce the issue, run it, then delete it.
- Assistant
Need to see the compilation error.
- Assistant
The method is package-private or VisibleForTesting but might need different map type. Looking at declaration - it's static with VisibleForTesting. The issue is
Map.ofreturns Map with raw inferred t... - Assistant
getQueryFilters is package-private in the converters package, not utils. Checking how other tests call it.
- Assistant
The method is package-private, so I'll build the filter tree manually instead.
- Assistant
The temporary test passed. I'll delete it and check remaining edge cases.
- Assistant
Cleaning up formatting and running spotless if available.
- Assistant
Remove the double blank line.
- Assistant
Verifying the final state of the changes and that the temp test was removed.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.