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 trace the filter validation and conditional-group handling, identify why
TIME_RANGEis validated as a direct execution field, then reproduce the failure with the narrowest relevant test before modifying the implementation. I’ll start by inspecting the repository layout and searching for the reported validation text and filter enums. - Assistant
ripgrepis unavailable, so I’ll use recursivegrepwith generated/build directories excluded. The initial listing shows a multi-module Gradle Java project; the likely implementation is incore,model, orwebserver, with repository-specific translations elsewhere. - Assistant
The exception confirms validation occurs after parsing, while
TIME_RANGEis a pseudo-field that must be resolved to a concrete date filter. The failure likely happens because top-level time-range resolution does not recurse into conditional groups. I’ll inspect the model representation, validation sequence, request binder, and utility transformation to locate the missing recursion. - Assistant
Validation already recurses through nodes, but both
TimeLineSearch.extractFromand the replacement maps appear top-level only. Thus a groupedTIME_RANGEsurvives and is correctly rejected by resource validation. I’ll inspect node construction/immutability and existing utility tests, then run the focused test class as a baseline and create a temporary reproduction if no existing grouped case exists. - Assistant
The binder can place the default
timeRangeleaf inside anORnode. A correct fix must preserve the logical tree while rewriting pseudo-fields recursively; merely allowingTIME_RANGEin execution validation would leak an unsupported field into repositories and be incorrect.I’ll inspect full utility tests and
DateUtils.validateTimeline, then runQueryFilterUtilsTestto establish the baseline. I’ll also use a temporary Java/JUnit-free reproduction only if constructing and validating the transformed filter is not straightforward through existing tooling. - Assistant
The focused baseline passes only flat cases, confirming coverage misses the reported shape. The grouped reproduction is deterministic from the code: extraction skips nodes (
field == null), replacement leaves the node untouched, then recursive validation reaches itsTIME_RANGEchild and emits exactly the reported error.Before editing, I’ll inspect date validation and repository tree handling to ensure recursively rewritten nodes remain semantically supported, including nested groups and both date modes.
- Assistant
Repository filtering already supports arbitrary nested
AND/ORtrees, so preserving node shape is valid. I’ll now explicitly reproduce the failure against the compiled baseline using a temporary/tmpJava program (not a repository test): constructOR(TIME_RANGE, LABELS), invoke the same execution transformation, then validate asEXECUTION. This should produce the exact unsupported-field exception before the fix. - Assistant
The temporary reproduction emitted the exact issue message. I’ll implement a general recursive tree mapper in
QueryFilterUtils, use it for start/end date and trigger-date rewrites, and makeTimeLineSearch.extractFromtraverse all leaves. Recursive “contains” checks will also prevent an erroneous extra default date filter when the only date criterion is nested. This keeps all existing flat behavior unchanged while handling arbitrary nesting depth. - Assistant
Python is not installed in this environment, so no files were changed. I’ll apply the same focused edits using the provided non-interactive editor commands, first adding imports/helpers and replacing each flat mapping block.
- Assistant
I’ll add the functional imports and recursive helper methods immediately after the field predicates.
- Assistant
The second line-based edit used stale line numbers after imports shifted the file, causing an overlap in the predicate area. I’ve identified the malformed range and will replace that entire section cleanly before proceeding; this is confined to lines 31–54.
- Assistant
The helper section is now correct. I’ll replace the two date-update blocks by exact text matching, avoiding further line-number drift.
- Assistant
Both execution/log date modes now recurse and preserve groups. I’ll apply the same mapper to trigger pseudo-date rewrites, because
TimeLineSearchis shared and conditional groups should not remain partially transformed on trigger endpoints. - Assistant
Next I’ll make timeline extraction depth-first over leaves. This is necessary so a nested
PT24Hcomputes 24 hours rather than falling back to the unrelated eight-day safety default. - Assistant
The implementation is syntactically clean by
git diff --check. I’ll compile and run the focused utility tests (QueryFilterUtilsTestandTimeLineSearchTest), which exercise all date modes, invalid durations, defaults, and timeline boundaries. After compilation I’ll rerun the exact temporary grouped reproduction against the new classes. - Assistant
All seven focused tests pass. I’ll now rerun the exact reproduction; success requires recursive execution validation to pass and the printed tree to retain
ORwhile replacingTIME_RANGEwithSTART_DATE. - Assistant
The exact reproduction now passes: the output preserves the
ORgroup and rewrites its nested pseudo-field toSTART_DATE >= computed timestamp, while the label remains unchanged.I’ll verify edge cases with a temporary assertion program: arbitrary nested groups,
END_DATEmode, no extra top-level safety filter when a nested date exists, and trigger rewrites. Then I’ll run formatting/static checks and relevant binder/controller tests. - Assistant
The temporary nested edge-case assertions pass. The module-wide Spotless check fails on 84 pre-existing files unrelated to this change; I will not apply it globally because that would create a massive unrelated diff. I’ll inspect Spotless’s report/output specifically for the two modified files and review the diff manually, then run binder and execution-controller tests.
- Assistant
Only the intended two source files are modified, and
diff --checkpasses. To conclusively format just these files despite the repository-wide backlog, I’ll run Spotless Apply, save the formatter’s versions of our two files, reset all formatter changes, and restore only those two formatted versions. This avoids submitting any unrelated formatting. - Assistant
The formatting workflow succeeded and left only the two intended files. Spotless reformatted some pre-existing long expressions within
QueryFilterUtils, increasing diff size slightly but still local. I’ll inspect that final diff to ensure no semantic changes, then run the two integration-adjacent test classes. - Assistant
The 38 binder and execution-controller tests pass, including nested conditional parsing and bad-filter validation. The final diff is semantically limited to recursive leaf traversal/mapping; the additional Javadoc indentation is formatter-only.
I’ll perform one final post-format reproduction and repository-status check. I’ll also verify no generated or temporary files are tracked in the repository.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.