Repository navigation
[runtime] Add cross-release state migration test for ActionExecutionOperator - #1341
Merged
Merged
Conversation
…perator Generated-by: Claude Code 2.1.312 (Claude Opus 5.5)
wenjin272
approved these changes
Nov 2, 2026
wenjin272
left a comment
Contributor
There was a problem hiding this comment.
Thanks for adding this! Looks good to me as a first step for migration testing. We can cover pending actions/events and Action State Store recovery in follow-ups.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Linked issue: #1332
Purpose of change
This PR adds
ActionExecutionOperatorMigrationTest, which restoresActionExecutionOperatorstate written by an earlier release, modeled on Flink's migration tests (WindowOperatorMigrationTest,CEPMigrationTest). The committed reference snapshot comes from the 0.4.0 release. A state-layout or serializer change that breaks restoring that snapshot now fails the test on the PR that makes it. The first scenario covers state at rest only.Runtime flow
Generation runs once per release, on that release's branch.
mvn clean package -Pgenerate-migration-test-data -Dgenerate.version=0.4 -DskipTests -pl runtime -amrunsMigrationTestsSnapshotGeneratorin theruntimemodule directory. It calls each@SnapshotsGeneratormethod ofActionExecutionOperatorMigrationTest, which drives the operator through a keyed test harness and writes the snapshot withOperatorSnapshotUtiltosrc/test/resources/action-execution-operator-migration-at-rest-flink-agents<version>-snapshot.The test runs in the normal suite, parameterized over
FlinkAgentsVersion.publishedVersions(). For each version it restores the committed snapshot into a new harness, checks the restored state, then processes more input.Key decisions
FlinkAgentsVersionenum instead of Flink'sMigrationTestutilities, which are typed onFlinkVersionand can't name Flink Agents releases. The generator and the annotation are a small subset of Flink's: no classpath scanning, the profile names the classes.MigrationTestAgent, with one action that keeps a running total per key in short-term memory. Its actions and the generated input must stay the same across releases, so the expected values don't move with the code under test. Inputs are keyed by parity so one key has seen two inputs.release-0.4.0tree.Behavioral Semantics
Interaction decisions
Not applicable: the change crosses no independent conditions.
Behavioral contracts
None for users. This PR adds test code, a test resource and a Maven profile; production code is unchanged.
Failure behavior
The generator fails the build when an argument is missing or unknown, when
--classesnames no class, when--versiondoesn't match aFlinkAgentsVersionconstant, when a listed class has no@SnapshotsGeneratormethod, or when a generator method throws.Tests
restoresStateAtRest5, 4, 10messageSequenceNumberis 1 and 0, then 3 and 1 after more inputjobIdentifierequals the restoredidentifier_stateand differs from the new harness's job IDactionTasks,pendingInputEventsandcurrentProcessingKeysare emptyRenaming the short-term memory, sequence number or job identifier state makes the test fail. The pending checks are weaker: a renamed pending state also reads as empty, which matches an at-rest snapshot.
Ran
mvn -pl api,plan,runtime test, the migration test on JDK 11, 17 and 21 (11 and 17 use the parallel engine, so each input waits onwaitInFlightEventsFinished()),./tools/lint.sh -fand-con JDK 11, the generation profile on therelease-0.4.0tree, andtools/check-license.sh.Not verified: pending actions and events, Python actions, an Action State Store, and Flink versions other than the root build's 2.3.0. Restoring a snapshot with a pending action failed on earlier upgrade paths (#1327); that scenario and any serializer change are follow-ups.
API
No public API changes.
FlinkAgentsVersion,@SnapshotsGeneratorand the generator live inruntimetest sources.Documentation
doc-neededdoc-not-neededdoc-includedWas this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code 2.1.312 (Claude Opus 5.5)
As a follow-up, I'd add snapshot generation for each minor release to the release guide, as Flink does. Would you rather keep the 0.4 snapshot as an early warning, or drop it and start from 1.0.0?