Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-sonnet-5· anthropicHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION [Filters] Backend do not accept conditional groups Describe the issue…

  1. 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

    1. Navigate to the Executions view
    2. Add a new conditional group to the default set of filters
    3. Keep the OR operator
    4. Add a new filer - e.g. labels foo:bar
    5. 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 using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to 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-$

  2. Claude Assistant

    No python available. I'll use the edit tool instead.

  3. Claude Assistant

    Good, file wasn't modified. Now let's use open + edit to insert helper methods after line 35.

  4. Claude Assistant

    Now let's insert the recursive helper methods after line 35, and update the three functions (updateFilters, updateFiltersForEndDate) to use recursion, plus rewriteTriggerDateFilters later.

  5. Claude Assistant

    Now let's update updateFilters and updateFiltersForEndDate to use the recursive helpers.

  6. Claude Assistant

    There's leftover duplicate closing lines 141-143. Let's remove them.

  7. Claude Assistant

    Need blank line before public static List<QueryFilter> replaceTimeRangeWithComputedStartDateFilter. Also update rewriteTriggerDateFilters to use recursive mapping.

  8. Claude Assistant

    Now let's fix rewriteTriggerDateFilters to use recursive mapping too.

  9. Claude Assistant

    Let's make this recursive as well.

  10. Claude Assistant

    That's fine already - handles nested nodes properly for SQL generation. Now let's rebuild and re-run repro test (should now pass) plus run the full existing test suites.

  11. Claude Assistant

    The fix resolves the reported issue. Now let's remove the temp test and run the existing full test suites for the affected files.

  12. Claude Assistant

    All existing tests pass. Now let's run DateUtils related tests in core module.

  13. Claude Assistant

    Let's compile core module to make sure DateUtils change is valid.

  14. Claude Assistant

    Good, compiles fine. Now let's run the broader test suites that matter: QueryFilterTest in core, jdbc AbstractExecutionRepositoryTest (nested groups), and webserver ExecutionControllerTest for filters.

  15. Claude Assistant

    All 730 pass. Now let's run the ExecutionControllerTest for filters (likely requires DB, might be slow but let's try just filter-related tests).

  16. Claude Assistant

    All pass. Now let's run jdbc AbstractExecutionRepositoryTest (contains OR/AND group tests) as h2 implementation.

  17. Claude Assistant

    All 106 tests pass, including complex nested filter tests. Let's also run the full webserver test suite to be thorough (or at least utils-related), and the jdbc core test suite for DateUtils, plus core full test suite once more for confidence.

  18. Claude Assistant

    Good, all pass. Let's also check final diff and clean up.

  19. Claude Assistant

    Let's view the full diff for a final review.

  20. Claude Assistant

    This looks good. Now let's clean up remaining temp files and verify no stray test files remain.

  21. Claude Assistant

    Clean. Now let's also double check TriggerController's rewriteTriggerDateFilters usage still works with nested groups (compile jdbc tests for triggers, since TRIGGER also supports nested filters potentially).

  22. Claude Assistant

    All good. Let's also run flow and log H2 repository tests, since they also use replaceTimeRangeWithComputedDateFilter-like paths (Flow doesn't necessarily use it, but let's check LogController flow).

  23. Claude Assistant

    All 297 tests pass. Now let's do a final review of the full diff and ensure everything is clean.

  24. Claude Assistant

    Everything is clean and ready. Let me go through the checklist:

  25. Claude Assistant

    Summary

    Root cause: When a TIME_RANGE query filter is nested inside an AND/OR conditional group (e.g. filters[or][0][timeRange][EQUALS]=PT168H), the backend's TIME_RANGE→START_DATE/END_DATE conversion logic (QueryFilterUtils.updateFilters/updateFiltersForEndDate, TimeLineSearch.extractFrom) only inspected the top-level filter list, never recursing into the children of node filters. Since Resource.EXECUTION (and other resources) intentionally do not list TIME_RANGE as a supported field (because it's expected to always be converted before validation/repository access), a TIME_RANGE leaf trapped inside a nested group survived unconverted and failed QueryFilter.validateQueryFilters with "Field TIME_RANGE is not supported for resource EXECUTION."

    Fix: Made the filter-tree traversal recursive in three places so nested TIME_RANGE/START_DATE/END_DATE filters (at any depth inside AND/OR conditional groups) are properly located and converted:

    • webserver/.../QueryFilterUtils.java: added generic anyMatchInTree/mapFilterTree helpers and used them in updateFilters, updateFiltersForEndDate, and rewriteTriggerDateFilters.
    • webserver/.../TimeLineSearch.java: extractFrom now recursively walks node children to find START_DATE/END_DATE/TIME_RANGE.
    • core/.../DateUtils.java: validateTimeline(List<QueryFilter>) now recursively collects START_DATE/END_DATE bounds from nested filters too.

    Checklist

    • Reproduced the error: Yes — wrote a temporary JUnit test exercising QueryFilterFormatBinder → QueryFilterUtils.replaceTimeRangeWithComputedStartDateFilter → QueryFilter.validateQueryFilters with a TIME_RANGE filter nested inside an OR group targeting Resource.EXECUTION, and it failed with the exact reported error message.
    • Confirmed the fix resolves it: Yes — after the fix, the same reproduction test passes, and I verified the nested TIME_RANGE filter is actually rewritten into a START_DATE filter inside the group (not just silently ignored).
    • Edge cases considered: Handled arbitrarily deep/nested AND/OR groups, multiple resource types (EXECUTION, TRIGGER via rewriteTriggerDateFilters, LOG, FLOW), the dateFilter=END_DATE/START_OR_END_DATE variants, the "no date filter present anywhere" default-injection behavior (still only added once, respecting nested filters as satisfying the requirement), and the mutual-exclusivity check between timeRange and startDate/endDate (now also honored across nested filters).
    • Ran existing tests: Ran core:test (730 tests, all pass, including QueryFilterTest), webserver:test for QueryFilterUtilsTest, TimeLineSearchTest, QueryFilterFormatBinderTest, ExecutionControllerTest, DashboardControllerTest, MetricControllerTest (all pass), and jdbc-h2:test for H2ExecutionRepositoryTest (106 tests incl. complex nested AND/OR filter cases), H2TriggerRepositoryTest (151 tests), H2LogRepositoryTest/H2FlowRepositoryTest (297 tests) — all pass. Temporary reproduction test files were removed before submission.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.