This is an automated email from the ASF dual-hosted git repository.
He-Pin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko.git
The following commit(s) were added to refs/heads/main by this push:
new f3d97ead6a Assert the dead-letter recipient for asks to terminated
actors (#3662)
f3d97ead6a is described below
commit f3d97ead6a3b875dce21683cefbe2fb5486c07ef
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Fri Oct 23 21:30:30 2026 +0800
Assert the dead-letter recipient for asks to terminated actors (#3662)
* Assert the dead-letter recipient for asks to terminated actors
Motivation:
The existing ordered termination test checks ask failure without checking
the dead-letter message and original recipient.
Modification:
Extend the existing test with explicit message and recipient assertions
after observing termination.
Result:
The test protects dead-letter routing without introducing a short-timeout
termination race.
Tests:
- Passed: `actor-typed-tests / Test / testOnly
org.apache.pekko.actor.typed.AskSpec`.
- Passed: `+headerCheckAll`.
- Full `validatePullRequest` is left to remote CI.
References:
- Refs [akka/akka-core#32111](https://github.com/akka/akka-core/pull/32111).
- Upstream commit:
[132058fbda96222c650314c9f336f52feaf5d76b](https://github.com/akka/akka-core/commit/132058fbda96222c650314c9f336f52feaf5d76b).
- Source snapshot: Akka `v2.9.0`
(`bf20e967571574994ccb3cae411401f5a9021ab9`). Its
[license](https://github.com/akka/akka-core/blob/v2.9.0/LICENSE) names
2026-10-23 as the Change Date and Apache License 2.0 as the Change License.
`LICENSE` and `NOTICE` record the source, and original copyright notices are
retained. Headers were generated/checked with the project sbt tasks.
* Keep licensing metadata outside the migration change
Motivation:
Keep PR #3662 scoped to its code or documentation change.
Modification:
Restore the root LICENSE and NOTICE files to main.
Result:
The migration diff retains its source headers without repository-level
licensing edits.
Tests:
- git diff --check passed.
- Verified every other file is unchanged; prior focused validation still
applies.
References:
Refs #3662.
* Consolidate the ask test copyright notice #3662
Motivation:
The review requested a single Lightbend notice in AskSpec.
Modification:
Consolidate the duplicate notices into the 2017-2023 notice.
Result:
One notice retains the original and source year coverage and ownership.
Tests:
Validation used a local integration checkout with current main and the
other review fixes.
- actor-typed-tests / Test / testOnly org.apache.pekko.actor.typed.AskSpec:
passed.
- headerCreateAll, +headerCheckAll, native scalafmt, and git diff --check:
passed.
- Full validation is delegated to remote CI.
References:
Refs #3662.
---
.../scala/org/apache/pekko/actor/typed/AskSpec.scala | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git
a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/AskSpec.scala
b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/AskSpec.scala
index 8800f5d962..f4d3f6e35d 100644
---
a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/AskSpec.scala
+++
b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/AskSpec.scala
@@ -8,7 +8,7 @@
*/
/*
- * Copyright (C) 2017-2022 Lightbend Inc. <https://www.lightbend.com>
+ * Copyright (C) 2017-2023 Lightbend Inc. <https://www.lightbend.com>
*/
package org.apache.pekko.actor.typed
@@ -21,10 +21,12 @@ import scala.util.Failure
import scala.util.Success
import org.apache.pekko
+import pekko.actor.DeadLetter
import pekko.actor.testkit.typed.scaladsl.LogCapturing
import pekko.actor.testkit.typed.scaladsl.LoggingTestKit
import pekko.actor.testkit.typed.scaladsl.ScalaTestWithActorTestKit
import pekko.actor.testkit.typed.scaladsl.TestProbe
+import pekko.actor.typed.internal.adapter.ActorRefAdapter
import pekko.actor.typed.internal.adapter.ActorSystemAdapter
import pekko.actor.typed.scaladsl.AskPattern._
import pekko.actor.typed.scaladsl.Behaviors
@@ -69,7 +71,8 @@ class AskSpec extends ScalaTestWithActorTestKit("""
}
"Ask pattern" must {
- "fail the future if the actor is already terminated" in {
+ "fail the future if the actor is already terminated and publish the ask to
its dead letters" in {
+ val deadLetterProbe = createDeadLetterProbe()
val ref = spawn(behavior)
val stopResult: Future[Unit] = ref.ask(Stop.apply)
stopResult.futureValue
@@ -80,6 +83,15 @@ class AskSpec extends ScalaTestWithActorTestKit("""
val result = answer.failed.futureValue
result shouldBe a[TimeoutException]
result.getMessage should include("had already been terminated.")
+
+ deadLetterProbe.receiveMessage() match {
+ case DeadLetter(Foo(message, _), _, recipient) =>
+ message shouldBe "bar"
+ val classicRef = ActorRefAdapter.toClassic(ref)
+ classicRef should not be system.classicSystem.deadLetters
+ recipient shouldBe classicRef
+ case unexpected => fail(s"Unexpected dead letter: $unexpected")
+ }
}
"succeed when the actor is alive" in {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]