Repository navigation
Test that the V7 AwaitingOn message is flushed before blocking - #662
Closed
StephanEwen wants to merge 1 commit into
Closed
StephanEwen wants to merge 1 commit into
StephanEwen wants to merge 1 commit into
Conversation
Restate Server will use AwaitingOnMessage to suspend idle invocations early, so the SDK must flush it before it parks waiting for input. Only the native (FFM) state machine implements protocol V7 and sends it. ProtocolConversation drives one invocation step by step, like the runtime: it withholds input until an expected message is decoded, so a message that is buffered instead of flushed makes the test time out. The V7 messages that the vendored V6 protocol.proto lacks are defined in a test-only proto, in a separate package. The tests cover: - a single await: flushed before blocking, and sent once - DurableFuture.all/any and Kotlin awaitAll/select: the reported tree, and the tree shrinking after partial progress - none while a ctx.run executes, then one while waiting for the ProposeRunCompletionAck - closing the input after AwaitingOn suspends with the same tree - none with protocol V6, on both the legacy and the native state machine The V7 tests are skipped when the native state machine is unavailable (JDK < 23, or no native library for the platform).
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This review covers the test-only addition of protocol V7 AwaitingOnMessage flush tests in sdk-core.
ProtocolConversationtest driver. It steps one invocation on a single core executor and holds back input until an expected frame is decoded, so a buffered but unflushed message makes the test time out after 10s.0x0006frames decode asAwaitingOnMessagewhatever the content type, so a stray frame on V6 still fails the nextexpect(...).protocol_v7_test.proto. I comparedCombinatorType,Future, the V7SuspensionMessage(reserved 1–3,awaiting_on = 4),AwaitingOnMessageandProposeRunCompletionAckMessagewith upstreamsdk-shared-core'sservice-protocol/dev/restate/service/protocol.proto. All field numbers and type ids (0x0006,0x0007) match. The separate proto package andjava_packagekeep these messages apart from the classes generated from the main protocol.- Java
AwaitingOnTest. It covers a single await, theDurableFuture.alltree shrinking after one completion,DurableFuture.any,ctx.run, input close leading to a V7 suspension with the same tree, and a V6 negative case on both state machines. In thectx.runtest, therunStartedlatch is a reliable barrier:HandlerContextImplstarts the closure from the await loop, so the handler is already blocked when the idle check runs. - Kotlin
AwaitingOnTest. TheawaitAllandselecttests check that the Kotlin API reports the same trees.
claude-opus-5-5 | 𝕏
Contributor
Contributor
|
im gonna close this as this test is not really mantainable long term, considering you tested and it works is good enough for me. We're gonna need a proper e2e test on this behavior shipped via sdk-test-suite, instead of unit tests on each sdk. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Restate Server will use the protocol V7
AwaitingOnMessageto suspend idle invocations early when concurrency slots run out. So the SDK must flush that message before it parks waiting for input. In Java only the native (FFM) state machine implements V7 and sends it.What this adds
All files are test-only, under
sdk-core/src/test/. No main code or build changes.ProtocolConversation: a test driver that behaves like the runtime. It withholds input until an expected message has been decoded from the output, so a message that is buffered instead of flushed makes the test time out.expectNoOutputUntilIdle()asserts that nothing more is written once the core thread is idle.protocol_v7_test.proto: the V7 messages the vendored V6protocol.protolacks:Future,AwaitingOnMessage,ProposeRunCompletionAckMessage, and the V7SuspensionMessage. They are in a separate proto package. Field numbers were checked against the upstream protocol.AwaitingOnTest(Java) andkotlinapi/AwaitingOnTest(Kotlin) check that:DurableFuture.all/anyand KotlinawaitAll/selectreport the right tree, which shrinks after partial progress;ctx.runclosure executes, then one message is sent while waiting for the run-completion ack;Verification
HandlerContextImpl: all 7 fail with "No output within 10s".disableNewCore). CI (tests.yml, JDK 25 with Rust) builds the native library, so they run there.*AwaitingOnTestpassed 9/9 in 10 reruns, in about 0.8 s../gradlew :sdk-core:buildpasses: 1368 tests, 0 failures, plus spotless, license check and javadoc.Sibling PRs adding the same kind of tests: restatedev/sdk-python#318, restatedev/sdk-go#182, restatedev/sdk-rust#144.
🤖 Generated with Claude Code