Skip to content

Commit b6a855a

Browse files
authored
chore(amber): remove the unused ClosureRequest from ClientActor (apache#7781)
### What changes were proposed in this PR? Deletes `ClientActor.ClosureRequest` and its unreachable `receive` arm. Pure deletion, no behaviour change: **−27 lines**. `AmberClient` is the only thing that messages `ClientActor`, and it sends exactly two things — `PoisonPill` on shutdown and `CommandRequest` for RPC calls. A repo-wide search for `ClosureRequest` returns only the companion-object declaration, the import pulling it into `ClientActor`, its `receive` arm, and two tests. Nothing sends it, so the arm never runs: ```scala case ClosureRequest(closure) => // unreachable try sender() ! closure() catch { case e: Throwable => sender() ! e } ``` It was a run-arbitrary-closure-on-the-actor-thread escape hatch that the engine no longer uses. > Reviewer note: the spec's header comment explaining why it lives in `...engine.common.client` — the members are `private[client]`, so no other package could construct the actor — is kept and reworded to drop the `ClosureRequest` mention, since the rationale still holds for `ClientActor` itself. That is the one added line in this diff. `InitializeRequest`, `CommandRequest` and `ObservableRequest` are untouched. ### Any related issues, documentation, discussions? Closes apache#7779 ### How was this PR tested? Existing tests only — this PR adds none, since it removes code and the tests that covered it. Locally, from the repo root with Java 17: - `sbt "WorkflowExecutionService/Test/compile"` — success. - `sbt "WorkflowExecutionService/testOnly *ClientActorSpec"` — 4 tests, all pass. - `sbt scalafmtCheckAll "scalafixAll --check"` — clean (this PR edits surviving files, so the unused-import gate matters). Verification, re-runnable by a reviewer: ``` git grep -n ClosureRequest # only the deleted declaration, arm, import and tests git grep -n 'clientActor !' # AmberClient sends only PoisonPill and CommandRequest ``` > CI note: build jobs may fail repo-wide at workflow startup while the injected `carabiner-dev/actions/install/ampel` action is off the ASF allowlist — `main` fails identically. Same class as apache#6989 and apache#7572, unrelated to this change. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 5)
1 parent 8ca9db2 commit b6a855a

2 files changed

Lines changed: 1 addition & 27 deletions

File tree

‎amber/src/main/scala/org/apache/texera/amber/engine/common/client/ClientActor.scala‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ import org.apache.texera.amber.engine.common.ambermessage.{
5353
WorkflowRecoveryMessage
5454
}
5555
import org.apache.texera.amber.engine.common.client.ClientActor.{
56-
ClosureRequest,
5756
CommandRequest,
5857
InitializeRequest,
5958
ObservableRequest
@@ -74,8 +73,6 @@ private[client] object ClientActor {
7473

7574
case class ObservableRequest(pf: PartialFunction[Any, Unit])
7675

77-
case class ClosureRequest[T](closure: () => T)
78-
7976
case class CommandRequest(
8077
methodName: String,
8178
command: ControlRequest,
@@ -109,13 +106,6 @@ private[client] class ClientActor extends Actor with AmberLogging {
109106
sender() ! Ack
110107
case CreditRequest(channelId: ChannelIdentity) =>
111108
sender() ! CreditResponse(channelId, getQueuedCredit(channelId))
112-
case ClosureRequest(closure) =>
113-
try {
114-
sender() ! closure()
115-
} catch {
116-
case e: Throwable =>
117-
sender() ! e
118-
}
119109
case commandRequest: CommandRequest =>
120110
coordinator ! AsyncRPCClient.ControlInvocation(
121111
commandRequest.methodName,

‎amber/src/test/scala/org/apache/texera/amber/engine/common/client/ClientActorSpec.scala‎

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ import org.apache.texera.amber.engine.common.ambermessage.{
4444
WorkflowFIFOMessage,
4545
WorkflowRecoveryMessage
4646
}
47-
import org.apache.texera.amber.engine.common.client.ClientActor.ClosureRequest
4847
import org.apache.texera.amber.engine.common.rpc.AsyncRPCClient.ControlInvocation
4948
import org.apache.texera.amber.engine.common.virtualidentity.util.{CLIENT, COORDINATOR}
5049
import org.scalatest.BeforeAndAfterAll
@@ -53,7 +52,7 @@ import org.scalatest.matchers.should.Matchers
5352

5453
// This spec lives in `...engine.common.client` on purpose: `ClientActor`, its
5554
// companion, and their members are `private[client]`, so a spec in any other
56-
// package could not construct the actor or reference `ClosureRequest`.
55+
// package could not construct the actor or reference its members.
5756
class ClientActorSpec
5857
extends TestKit(ActorSystem("ClientActorSpec"))
5958
with ImplicitSender
@@ -83,21 +82,6 @@ class ClientActorSpec
8382
expectMsg(CreditResponse(channelId, 0L))
8483
}
8584

86-
it should "reply with the closure's result on a successful ClosureRequest" in {
87-
val ref = newClientActor()
88-
89-
ref ! ClosureRequest(() => 42)
90-
expectMsg(42)
91-
}
92-
93-
it should "reply with the thrown exception on a failing ClosureRequest" in {
94-
val ref = newClientActor()
95-
96-
ref ! ClosureRequest(() => throw new RuntimeException("boom"))
97-
val e = expectMsgType[RuntimeException]
98-
e.getMessage shouldBe "boom"
99-
}
100-
10185
it should "ack the sender and forward to coordinator on WorkflowRecoveryMessage" in {
10286
val ref = newClientActor()
10387
val coordinatorProbe = TestProbe()

0 commit comments

Comments
 (0)