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

   Linked issue: Closes #1417
   
   ### Purpose of change
   
   Ensure `PythonSerializableResourceProvider.provide()` returns both 
registered and deserialized resources bound to the supplied context, matching 
Java. This removes an inconsistency in direct provider/in-memory plan usage; no 
affected standard Python Flink production path has been identified.
   
   #### Runtime flow
   
   Deserialize when no instance exists, assign `resource.resource_context`, 
then return the resource. The runtime subsequently calls `open()`.
   
   #### Key decisions
   
   Bind once after deserialization instead of inserting runtime context into 
`self.serialized`. Preserve the registered instance and the existing lazy 
reconstruction behavior.
   
   ### Behavioral Semantics
   
   #### Interaction decisions
   
   | Provider state | Result |
   | --- | --- |
   | Registered or previously materialized instance | Return the same instance 
with the supplied context |
   | Serialized data only | Deserialize, bind the supplied context, and return 
the new instance |
   
   #### Behavioral contracts
   
   Both paths bind context before returning, so a subsequent `open()` can 
resolve dependencies. A later `provide()` updates the binding to the context 
supplied by that call; this does not establish support for sharing an opened 
resource across runtime scopes.
   
   #### Failure behavior
   
   Import, class lookup, model validation, and assignment errors propagate 
without retries or fallback.
   
   ### Tests
   
   | Contract | Test in `test_resource_provider.py` |
   | --- | --- |
   | Registered instance retains identity, receives context, and resolves a 
dependency in `open()` | 
`test_serializable_provider_binds_context_before_open[False]` |
   | Deserialized instance receives context and resolves a dependency in 
`open()` | `test_serializable_provider_binds_context_before_open[True]` |
   | Subsequent calls bind the current context | 
`test_serializable_provider_binds_current_context` |
   
   Python plan suite: **512 passed, 1 skipped** (`python -m pytest 
flink_agents/plan/tests -q`, from `python/`, with the active environment 
purelib path exported as `PYTHONPATH`). Ruff lint/format checks and `git diff 
--check` passed.
   
   Not verified: full Flink cluster execution, custom validators requiring 
context during deserialization, or concurrent cross-scope instance sharing.
   
   ### API
   
   No signature or resource configuration format changes. Context is now 
injected after `model_validate()`; custom validators must not rely on 
provider-injected context during deserialization. Dependency initialization 
belongs in `open()`.
   
   ### Documentation
   
   - [ ] `doc-needed`
   - [x] `doc-not-needed`
   - [ ] `doc-included`
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   - [x] Yes
   - [ ] No
   
   Generated-by: Codex CLI 0.167.0-alpha.4.1 (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