Skip to content

Fix/runcatching coroutine cancellation#1046

Merged
AleksandarIlic merged 5 commits into
mainfrom
fix/runcatching-coroutine-cancellation
May 5, 2026
Merged

Fix/runcatching coroutine cancellation#1046
AleksandarIlic merged 5 commits into
mainfrom
fix/runcatching-coroutine-cancellation

Conversation

@markocic
Copy link
Copy Markdown
Collaborator

@markocic markocic commented May 5, 2026

No description provided.

@markocic markocic requested a review from AleksandarIlic May 5, 2026 10:12
AleksandarIlic
AleksandarIlic previously approved these changes May 5, 2026
markocic added 5 commits May 5, 2026 16:42
The custom runCatching helpers in core/utils caught Throwable,
which silently absorbed CancellationException and broke structured
concurrency. Rethrow CancellationException explicitly so cancellation
propagates as the framework expects; also restores correct behavior
for downstream combinators (mapCatching, alsoCatching, recoverCatching)
that delegate to runCatching, and fixes withTimeout enforcement at
sites that wrap runCatching inside a timeout block.
Introduces a new :detekt-rules subproject that ships two rules in the
PrimalRuleSet:

- RequireCustomRunCatching: flags any runCatching(...) call in a file that
  does not import net.primal.core.utils.runCatching, preventing future use
  of the stdlib variant which silently swallows CancellationException.
- RequireCustomResult: flags any Result<...> type reference or
  Result.success/.failure call in a file that does not import the custom
  net.primal.core.utils.Result.
@markocic markocic force-pushed the fix/runcatching-coroutine-cancellation branch from d86a9f9 to bc7a1aa Compare May 5, 2026 14:42
@AleksandarIlic AleksandarIlic self-requested a review May 5, 2026 14:52
@AleksandarIlic AleksandarIlic merged commit 7d6e83a into main May 5, 2026
4 checks passed
@AleksandarIlic AleksandarIlic deleted the fix/runcatching-coroutine-cancellation branch May 5, 2026 15:29
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.

2 participants