bpattarkine opened a new pull request, #1506:
URL: https://github.com/apache/flink-agents/pull/1506

   Linked issue: #1431
   
   ### Purpose of change
   
   An experimental, non-durable Java agent job can run with 
`pipeline.generic-types=false` and restore buffered inputs, pending actions, 
and memory from a Flink checkpoint. This draft includes the typed Java output 
work in #1505.
   
   #### Runtime flow
   
   The typed Java terminal declares the Flink output serializer at the agent 
operator. During restore the operator checks a union-list marker for the 
checkpoint format before recovering work. It registers processing keys with 
Flink's input key serializer and selects an explicit length-prefixed Java 
serialization format for events, tasks, memory items, and timer state. Event 
copies, read-through memory copies, and timer owner context reuse the same 
format. The default job setting continues to select the existing serializers.
   
   #### Key decisions
   
   Application object graphs must implement Java `Serializable`. This preserves 
concrete types and object graphs across copies and restore without a Flink 
generic fallback. The checkpoint format is experimental and same-build only. 
Using a format marker makes switching job settings during restore fail even 
when there are no pending values to trigger a serializer compatibility check.
   
   ### Behavioral Semantics
   
   #### Interaction decisions
   
   | Job configuration | Result |
   | --- | --- |
   | Generic types enabled, default checkpoint format | Standard runtime and 
serializers |
   | Generic types disabled, fresh state or same-format checkpoint | Explicit 
checkpoint serializers and typed Java output |
   | Format differs from restored checkpoint | Operator initialization rejects 
restore |
   | Generic types disabled with a durable store | Operator initialization 
rejects the configuration before opening the store |
   
   #### Behavioral contracts
   
   - A Java agent with typed input keys, typed output, and serializable 
application values can execute with generic types disabled.
   - A same-format checkpoint restores queued inputs, pending actions, and 
short-term memory.
   - Jobs reject a checkpoint written in the other serialization format.
   - Kafka and Fluss remain available with the default setting. The 
experimental setting rejects both durable stores.
   
   #### Failure behavior
   
   Unsupported application objects fail when the serializer first copies or 
writes them, with the non-serializable class in the error. Restore errors 
propagate from the operator. The codec loads classes from the Flink job class 
loader and expects trusted checkpoints and savepoints.
   
   ### Tests
   
   | Contract | Evidence |
   | --- | --- |
   | Java job executes with generic types disabled | 
`GenericTypesDisabledTest.runsAgentWithGenericTypesDisabled` runs a local Flink 
job and checks per-key outputs. |
   | A new Java job starts from a canonical savepoint | 
`GenericTypesDisabledTest.restoresAJavaJobFromSavepoint` starts two local 
cluster jobs and verifies the restored counter. |
   | Restore resumes pending work and preserves memory | 
`GenericTypesDisabledTest.restoresPendingWorkAndMemoryWithGenericTypesDisabled` 
snapshots a completed input followed by pending work and compares restored 
outputs with the expected memory sequence. |
   | A different checkpoint format is rejected | The recovery test also 
attempts to restore its snapshot with generic types enabled. |
   | Durable store configuration is rejected before startup | 
`GenericTypesDisabledTest.refusesDurableStateBeforeStartingTheBackend`. |
   | Historical checkpoint path | `ActionExecutionOperatorMigrationTest` 
restores the existing release snapshot using generic types enabled. |
   
   Thirty focused tests passed. The tests include a Java job running on a local 
Flink cluster, triggering a canonical savepoint, and resuming with restored 
memory in a new job. The operator harness separately covers in-flight tasks and 
buffered inputs. A PyFlink process recovery, native Python payloads, durable 
replay with the flag disabled, and compatibility across different builds were 
outside this test run.
   
   <details>
   <summary>Focused Java verification</summary>
   
   ```sh
   mvn -B --no-transfer-progress -pl runtime -am \
     
-Dtest=GenericTypesDisabledTest,ActionExecutionOperatorMigrationTest,OperatorStateManagerShortTermMemoryTtlTest,TypedOutputTerminalTest,ChatMemoryIsolationTest,TimerOperationTest
 \
     -Dsurefire.failIfNoSpecifiedTests=false test
   ```
   
   </details>
   
   ### API
   
   The existing typed Java output terminal declares the output type. Start a 
disabled-format job from fresh state and restore with the same build and flag. 
Kafka and Fluss require generic types enabled.
   
   ### Documentation
   
   - [ ] `doc-needed`
   - [ ] `doc-not-needed`
   - [x] `doc-included`
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   - [x] Yes
   - [ ] No
   
   Generated-by: Codex CLI 0.173.0 (GPT-6)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to