Skip to content

fix: async support for get_object_by_uid (issue #642)#643

Merged
tobixen merged 1 commit intomasterfrom
issue642-clean
Mar 18, 2026
Merged

fix: async support for get_object_by_uid (issue #642)#643
tobixen merged 1 commit intomasterfrom
issue642-clean

Conversation

@tobixen
Copy link
Member

@tobixen tobixen commented Mar 18, 2026

Summary

  • get_object_by_uid() (and the get_todo_by_uid, get_event_by_uid, get_journal_by_uid wrappers, plus the deprecated todo_by_uid / event_by_uid / journal_by_uid aliases) were broken for async clients.
  • When is_async_client is True, Calendar.search() returns a coroutine rather than a list. get_object_by_uid() tried to iterate over the coroutine directly, raising TypeError: 'coroutine' object is not iterable.
  • Fix: dispatch to a new _async_get_object_by_uid() coroutine when is_async_client is True, following the same pattern already used by _async_add_object_finish, _async_make_calendar, _async_calendar_delete, etc.

Fixes #642

Test plan

  • TestAsyncGetObjectByUid::test_get_object_by_uid_returns_coroutine_for_async_client — verifies that get_object_by_uid() returns a coroutine (not a TypeError) for async clients
  • TestAsyncGetObjectByUid::test_get_object_by_uid_async_returns_correct_object — verifies that awaiting the coroutine returns the correct object
  • Full unit test suite passes

⚠️ This comment is AI-generated (Claude Sonnet 4.6 via Claude Code) on behalf of tobixen ⚠️

get_object_by_uid() called self.search() which, for async clients,
returns a coroutine rather than a list.  The method then tried to
iterate over the coroutine, raising TypeError.

Fix by adding _async_get_object_by_uid() that awaits the search, and
dispatching to it when is_async_client is True, following the same
pattern used by other async-capable methods in the class.

The get_todo_by_uid(), get_event_by_uid(), get_journal_by_uid() and
the deprecated *_by_uid() aliases are fixed transitively because they
all call get_object_by_uid().

Fixes #642

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tobixen tobixen merged commit 51e2c1b into master Mar 18, 2026
9 checks passed
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.

Have no support for async in get_object_by_uid

1 participant