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

   <!--
   * Thank you very much for contributing to Flink Agents.
   * Please add the relevant components in the PR title. E.g., [api], 
[runtime], [java], [python], [hotfix], etc.
   -->
   
   <!-- Please link the PR to the relevant issue(s). Hotfix doesn't need this. 
-->
   Linked issue: #1514
   
   ### Purpose of change
   
   <!-- What is the purpose of this change? -->
   Short-term memory now returns live fields even when a sibling has expired. 
Previously, `getFieldNames()` could still list the expired child and 
`getFields()` could throw `NullPointerException`.
   
   #### Runtime flow
   
   Both methods enumerate the parent’s child names. `getFieldNames()` checks 
each short-term field with `store.contains()`. `getFields()` reads each child 
once.
   
   #### Key decisions
   
   The parent index can outlive a child, so each short-term field lookup 
follows Flink’s TTL visibility policy. Sensory memory uses the parent index 
directly.
   
   ### Behavioral Semantics
   
   <!-- For a non-trivial code change whose implementation is largely 
AI-assisted: interaction decisions, behavioral contracts, and failure behavior. 
See `contribution-guides/ai-assisted-pr.md`. Remove this heading and this 
comment otherwise. -->
   #### Interaction decisions
   
   | TTL update policy | Listing a live field |
   | --- | --- |
   | `ON_READ_AND_WRITE` | Refreshes its TTL |
   | `ON_CREATE_AND_WRITE` | Preserves its expiry time |
   
   #### Behavioral contracts
   
   Name enumeration returns visible fields. A live field set to `null` is 
included in both results.
   
   #### Failure behavior
   
   `getFields()` skips a missing child and continues reading its siblings. 
Backend errors still propagate.
   ### Tests
   
   <!-- How is this change verified? -->
   | Behavior under test | `fieldEnumerationRespectsTtl` assertion |
   | --- | --- |
   | An expired child leaves its siblings readable | The field map contains 
only `fresh=2` and `nullable=null`. |
   | Name listing respects visibility and preserves null fields | The names are 
`fresh` and `nullable`. |
   | Listing follows the configured TTL update policy | After listing at 150 
ms, `fresh` is visible at 230 ms only with read refresh. |
   
   The regression runs on heap and RocksDB with `NEVER_RETURN_EXPIRED`. The 
live Python bridge and relaxed TTL visibility were outside the test run.
   
   <details>
   <summary>Local verification</summary>
   
   110 targeted Java tests and Spotless passed on Flink 2.3.0 and JDK 17.
   
   </details>
   
   ### API
   
   <!-- Does this change touches any public APIs? -->
   No public API signature changes.
   
   ### Documentation
   
   <!-- Do not remove this section. Check the proper box only. -->
   
   - [ ] `doc-needed` <!-- Your PR changes impact docs -->
   - [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [x] `doc-included` <!-- Your PR already contains the necessary 
documentation updates -->
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   <!-- Do not remove this section. Check the proper box only. -->
   
   - [x] Yes
   - [ ] No
   
   
   Generated-by: Codex 0.171 (gpt-6.2)


-- 
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