You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(utils): type async request methods as coroutines and test cancelling them - #2112
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Tests
Added coverage for cancelling asynchronous requests during active calls and retry delays, including checks that cancellation stops further requests and leaves connections available.
Developer Experience
Improved the precision of async return type information for HTTP operations, making it clearer to type checkers and developers that these operations return coroutines.
The pull request adds cancellation tests for AsyncFunctionsClient using aiohttp and httpx sessions. The tests cover cancellation during a hanging request and during a retry delay, for buffered and streaming invocations. They check that cancellation propagates and that a connection remains available afterward. The pull request also changes asynchronous return annotations in handle_http_io.__get__ from Awaitable to Coroutine.
Possibly related PRs
supabase/supabase-py#1977: It changes the AsyncFunctionsClient constructor contract used by the cancellation tests.
Change: Other
Merge Risk: Minimal · up to e3f48
This change adds tests for cancelling async function invocations and adjusts type annotations so that wrapping calls in asyncio.create_task type-checks. It does not change runtime behavior, so the merge risk is minimal.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 857ed687-c727-4d50-b9f4-e8800dc4b467
Commits
Reviewing files that changed from the base of the PR and between 76d87d4 and e3f482c.
Files selected for processing: 2
src/functions/tests/_async/test_cancellation.py
src/utils/src/supabase_utils/http/io.py
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
spydon
changed the title
test(functions): cover cancelling invoke() on both async adapters
fix(utils): type async request methods as coroutines and test cancelling them
Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tests that cancelling the task awaiting
invoke()orinvoke_stream()aborts the request and frees its connection. SDK-2781AsyncHttpIOwaits between retries (no retry is sent).handle_http_iomethods are now typed as returning aCoroutineinstead of anAwaitable, soasyncio.create_task(client.invoke(...))type checks.