Skip to content

Conversation

@bpholt
Copy link
Member

@bpholt bpholt commented Jan 10, 2026

Enhances the lifting of Twitter Futures into Cats Effect F[_] : Async to support cancellation, and improves test coverage for this behavior.

  • Updates liftFuture in twitter-futures/src/main/scala/com/dwolla/util/async/twitter.scala by providing a finalizer that triggers Twitter Future interruption via raise(CancelledViaCatsEffect).
  • Introduces CancelledViaCatsEffect object, a java.util.concurrent.CancellationException used to signal interruption from Cats Effect to Twitter's util.Future.
  • Adds recoverFromCancelledViaCatsEffect to handle a potential race condition in Cats Effect where a cancelled future might appear completed with the cancellation exception.
  • Adds TwitterFutureAsyncMapKTests.scala with comprehensive tests for lifting Twitter Futures, verifying both successful completion and proper interruption propagation upon fiber cancellation.

Thanks to @djspiewak for his help resolving a couple of race conditions that popped up along the way.

@bpholt bpholt self-assigned this Jan 10, 2026
@bpholt bpholt requested a review from a team as a code owner January 10, 2026 00:25
j-gens
j-gens previously approved these changes Jan 12, 2026
@bpholt bpholt force-pushed the twitter-future-cancelation branch from 7034201 to 6d48a3d Compare January 21, 2026 00:58
@bpholt bpholt requested a review from j-gens January 21, 2026 21:33
@bpholt bpholt merged commit 8934284 into main Jan 22, 2026
11 checks passed
@bpholt bpholt deleted the twitter-future-cancelation branch January 22, 2026 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants