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

   Linked issue: Closes #1459. Part of #1458.
   
   ### Purpose of change
   
   #### Outcome
   
   Provide Java and Python API stability markers so interface declarations can 
record their classification and release history. Add `API.md` for interface 
identification, a contributor guide, and user-facing stability and 
compatibility documentation with a lifecycle diagram.
   
   #### Runtime flow
   
   Java annotations are retained at runtime on types and members. Python 
decorators create immutable metadata, attach it to the class or function (the 
underlying function/getter for descriptors), and return the original decorated 
object. The same metadata objects can be used in `typing.Annotated` for fields.
   
   #### Key decisions
   
   - Keep stability and deprecation separate so deprecation preserves the 
original classification and version. Java uses standard `@Deprecated`; Python 
provides `@deprecated(since=...)`.
   - Define enclosing-type defaults without copying metadata to members or 
inheriting it through subclasses. Explicit member markers take precedence; 
resolving these defaults in repository scanning is follow-up work.
   - Keep this PR focused on foundational declarations. YAML/configuration 
marker sections remain TODOs; `ResourceOption`, bulk classification, existing 
Flink `@Internal` migration, compatibility CI, and retirement validation are 
not implemented here.
   
   ### Behavioral Semantics
   
   These details describe the Java/Python marker implementation; the 
documentation defines the intended compatibility policy.
   
   #### Interaction decisions
   
   | Combination | Result |
   | --- | --- |
   | Stability + deprecation on one Python declaration | Both metadata objects 
are retained, regardless of decorator order. |
   | Different stability markers on one Python declaration | `ValueError`; the 
existing marker remains. |
   | Lifecycle decorator above or below `staticmethod`, `classmethod`, or 
`property` | Metadata resides on the underlying function/getter; descriptor 
binding is preserved. |
   | Subclass or overriding method | No automatic inheritance of the base 
declaration's marker. |
   
   #### Behavioral contracts
   
   - Java markers are documented, retained at runtime, and support types, 
methods, constructors, and fields.
   - Python decorators preserve object identity, signatures, invocation 
behavior, and abstract-method behavior; they do not wrap calls or emit 
deprecation warnings.
   - Stability and deprecation metadata coexist. Python metadata objects are 
immutable, and `Annotated` leaves field values unchanged.
   - Unmarked declarations remain unmarked. Enclosing-type metadata remains 
separately available for later classification lookup.
   
   #### Failure behavior
   
   Python raises `TypeError` for unsupported decorator targets and `ValueError` 
for conflicting metadata in the same category. Metadata values, including 
version strings and incomplete-feature combinations, are recorded without 
runtime validation. Java does not add an annotation processor.
   
   ### Tests
   
   | Contract | Verification |
   | --- | --- |
   | Java targets, runtime retention, documentation, deprecation composition, 
and no automatic subclass/override inheritance | `LifecycleAnnotationTest` (5 
tests). |
   | Python identity, signatures, calls, async/generator behavior, descriptors, 
and abstract methods | `test_stability.py` identity/behavior, descriptor, and 
abstract-method tests. |
   | Independent immutable metadata and unchanged field values | Python 
deprecation-composition, frozen-metadata, and `Annotated` tests. |
   | Explicit members and enclosing types remain distinct; unmarked 
declarations stay unmarked | Java member/enclosing-type tests and Python 
enclosing-type, subclass, and unmarked tests. |
   | Conflicts and unsupported targets fail explicitly | Python 
conflicting-marker and unsupported-target tests. |
   
   Validation:
   - Java API module: 933 tests run, 16 skipped, no failures or errors (JDK 11).
   - Python API module, excluding integration tests: 1,278 passed, 17 skipped; 
includes 30 lifecycle tests (Python 3.11).
   - Ruff check/format and `git diff --check` passed. Apache RAT found no 
unknown licenses in an archive of the committed source tree.
   - Hugo 0.110.0 extended build passed; lifecycle diagram rendered with the 
site's CSS. Its scoped styles prevent site badge styling from distorting 
Mermaid labels.
   
   Not verified: Python 3.10/3.12, cross-language or external-service 
integration suites. Repository scanning, lifecycle enforcement, and IDE 
deprecation diagnostics are outside the implemented scope.
   
   ### API
   
   Adds Java `Stable`, `Experimental`, and `Internal` annotations and Python 
lifecycle decorators/metadata classes. Existing production APIs are not 
reclassified, and invocation behavior is unchanged. The policy starts at 1.0 
and guarantees source compatibility rather than Java binary compatibility.
   
   ### 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.153.4 (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