chaokunyang opened a new pull request, #3886:
URL: https://github.com/apache/fory/pull/3886

   ## Why?
   
   Dart classes owned by dependencies cannot carry Fory annotations. 
Applications
   need generated serializers for those types without copying values into local
   models or adding a second registration, carrier, root, or polymorphic path.
   
   ## What does this PR do?
   
   - Adds `ForyStruct.target` and constructor selection so an `abstract final`
     local schema declaration generates a direct serializer for a closed 
external
     class.
   - Uses the existing generated struct model, target-keyed schema/module
     registration, field descriptors, carrier codecs, root APIs, reference
     resolver, compatible reads, and polymorphic registration.
   - Generates direct target getters, generative constructor calls, and setters;
     validates the external contract at generation time, including generic type
     rendering, re-exported nullable aliases, and constructor-cycle constraints.
   - Covers roots, fields, nested list/set/map fields, named and numeric
     registration, polymorphism, references, compatible mode, generic targets,
     Java-to-Dart xlang exchange, and JavaScript compilation.
   - Documents the current external-type serialization and manual serializer
     APIs without migration or removed-API material.
   
   ## Related issues
   
   N/A
   
   ## AI Contribution Checklist
   
   - [x] Substantial AI assistance was used in this PR: `yes`
   - [x] I included the standardized `AI Usage Disclosure`.
   - [ ] I can explain and defend all important changes without AI help.
   - [ ] I reviewed AI-assisted code changes line by line before submission.
   - [ ] I completed a personal line-by-line self-review before requesting AI
         review.
   - [x] Two fresh AI reviewers reviewed current HEAD
         `0e750233c7443d4c7e760d48aa1f70c0ddf01d1b`: one Fory-guided reviewer 
and
         one independent clean-context reviewer.
   - [x] All actionable AI review comments were fixed and both final reviewers
         reported no actionable findings.
   - [x] Persisted links to both final clean review results are included below.
   - [ ] I personally reviewed the listed local/CI verification results.
   - [x] Required tests and owning guide/spec documentation are included.
   - [x] Protocol and performance impact were validated.
   - [x] No third-party implementation code or incompatible dependency was
         introduced.
   
   ### AI Usage Disclosure
   
   - substantial_ai_assistance: yes
   - scope: design refinement, implementation, tests, documentation, performance
     validation, and review fixes
   - affected_files_or_subsystems: Dart annotations and source generation, Dart
     external-type fixtures and benchmarks, Dart xlang integration, Dart guides,
     and the xlang implementation guide
   - ai_review: line-by-line agent self-review and the required two-reviewer 
loop
     completed on current HEAD; both final fresh reviewers reported no 
actionable
     findings
   - ai_review_artifacts: Fory-guided review: FORY_REVIEW_LINK; independent
     general review: INDEPENDENT_REVIEW_LINK
   - human_verification: contributor confirmation remains required before this
     draft is marked ready; agent-run checks and results are listed below
   - performance_verification: fresh-main ordinary paths and equivalent external
     paths met the less-than-1% slowdown gate; generated bodies and bytes 
matched;
     all eight allocation lanes had identical object counts
   - provenance_license_confirmation: generated changes are original to this 
task,
     use the repository's Apache-2.0 licensing, and introduce no incompatible
     third-party code
   
   ## Does this PR introduce any user-facing change?
   
   - [x] Does this PR introduce any public API change?
   - [ ] Does this PR introduce any binary protocol compatibility change?
   
   The public Dart annotation API adds optional `target` and `constructor`
   arguments to `ForyStruct`. The wire format is unchanged.
   
   ## Verification
   
   - `cd dart/packages/fory && dart run build_runner build && dart analyze && 
dart test`
     - generation: 98 outputs, no tracked changes
     - analysis: clean
     - tests: 232/232 passed
   - `cd dart/packages/fory-test && dart run build_runner build && dart analyze 
&& dart test`
     - generation: 3 outputs, no tracked changes
     - analysis: clean
     - tests: 18/18 passed
   - `cd dart && dart analyze && dart test`
     - analysis: clean
     - tests: 1/1 passed
   - `cd dart/packages/external-type-test-models && dart analyze`
     - analysis: clean
   - `dart compile js` for
     `dart/packages/fory-test/tool/external_type_js_smoke.dart`, followed by 
Node
     execution
     - compiled successfully and exited successfully
   - `FORY_DART_JAVA_CI=1 ENABLE_FORY_DEBUG_OUTPUT=1 mvn -T16 
--no-transfer-progress test -Dtest=org.apache.fory.xlang.DartXlangTest`
     - 101/101 passed with no failures, errors, or skips
   
   ## Benchmark
   
   Fresh `apache/main` ordinary benchmarks were run in adjacent baseline/current
   pairs. Every retained median met the less-than-1% slowdown gate, and the
   generated ordinary benchmark source was byte-identical.
   
   Equivalent ordinary/external generated paths were measured in AOT mode with
   split debugging data:
   
   | Path                    | Retained delta |
   | ----------------------- | -------------: |
   | Root serialize          |         +0.02% |
   | Root deserialize        |         +0.04% |
   | Direct field serialize  |         +0.53% |
   | Direct field deserialize |         -0.82% |
   | List field serialize    |         +1.47% |
   | List field deserialize  |         -0.02% |
   | Map field serialize     |         +0.09% |
   | Map field deserialize   |         +0.90% |
   
   Negative values are slowdowns; every slowdown is below 1%. Serialized bytes
   and normalized generated serializer bodies matched. The fixed-iteration VM
   allocation check reported identical per-class object counts for all eight
   serialize/deserialize lanes at 1,000 iterations.
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to