The GitHub Actions job "Generate doc check" on 
pekko.git/worktree-fix+stubbed-cancellable-3251 has succeeded.
Run started by GitHub user He-Pin (triggered by He-Pin).

Head commit for run:
42e5550ca9c68acfc9c917e0f96ec4bdf843ff64 / 虎鸣 <[email protected]>
fix: return proper non-cancelled Cancellable from 
StubbedActorContext.scheduleOnce

Motivation:
StubbedActorContext.scheduleOnce returned a Cancellable with isCancelled=true
and cancel()=false, violating the Cancellable contract which states isCancelled
should be true "if and only if" the Cancellable has been successfully cancelled.
A freshly scheduled task has not been cancelled, so isCancelled must start 
false.
This caused test/production divergence: actors checking cancellable.isCancelled
would take different code paths in tests vs production.

Modification:
Replace the pre-cancelled Cancellable stub with one that starts non-cancelled
and supports proper cancellation semantics: cancel() returns true on first call
and false on subsequent calls, while isCancelled reflects the actual state.

Result:
StubbedActorContext.scheduleOnce now returns a Cancellable that matches the
Cancellable contract and the real production implementation behavior.

Tests:
- sbt "actor-testkit-typed / Test / testOnly 
org.apache.pekko.actor.testkit.typed.scaladsl.BehaviorTestKitSpec" - 35 passed
- sbt "actor-testkit-typed / Test / testOnly 
org.apache.pekko.actor.testkit.typed.javadsl.BehaviorTestKitTest" - 17 passed, 
1 ignored

References:
Fixes #3251

Report URL: https://github.com/apache/pekko/actions/runs/28334041738

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to