Skip to content

fix: CalDAVSearcher.filter() to avoid mutating include_completed#651

Merged
tobixen merged 1 commit intomasterfrom
issu650
Mar 23, 2026
Merged

fix: CalDAVSearcher.filter() to avoid mutating include_completed#651
tobixen merged 1 commit intomasterfrom
issu650

Conversation

@tobixen
Copy link
Member

@tobixen tobixen commented Mar 22, 2026

icalendar_searcher.Searcher.check_component() mutated include_completed from None to False (for todo searches) as a side-effect on the first search() call. Subsequent calls would then take the include_completed=False code path (with server clone + three-hacks approach) instead of the simpler else-branch used for include_completed=None. This caused inconsistent results when reusing a CalDAVSearcher object across multiple search() calls.

The fix passes a copy with include_completed already resolved to filter_search_results(), leaving the original CalDAVSearcher unchanged.

Also removes the post_filter=True workaround from testSearchForRecurringTask (it was no longer needed; the auto-setting logic handles it correctly).

Fixes #650

icalendar_searcher.Searcher.check_component() mutated include_completed from
None to False (for todo searches) as a side-effect on the first search() call.
Subsequent calls would then take the include_completed=False code path (with
server clone + three-hacks approach) instead of the simpler else-branch used
for include_completed=None.  This caused inconsistent results when reusing a
CalDAVSearcher object across multiple search() calls.

The fix passes a copy with include_completed already resolved to
filter_search_results(), leaving the original CalDAVSearcher unchanged.

Also removes the post_filter=True workaround from testSearchForRecurringTask
(it was no longer needed; the auto-setting logic handles it correctly).

Fixes #650

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tobixen tobixen merged commit c39d478 into master Mar 23, 2026
9 checks passed
@tobixen tobixen deleted the issu650 branch March 23, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent include_completed behavior

1 participant