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

   ## Why?
   
   Malformed meta strings and TypeDef name metadata could trigger 
runtime-specific indexing failures or
   allow decoding to continue with an incomplete error state. Go also exposed 
both a shared `*Error`
   parameter and a returned `error`, which made it easy for callers to drop one 
error channel.
   
   ## What does this PR do?
   
   - Hardens Go meta-string decoding for empty transformed output and unmatched 
escape markers.
   - Makes Go `MetaStringResolver.ReadMetaStringBytes` report failures only 
through its supplied
     `*Error`, and stops TypeInfo consumers before dereferencing failed results.
   - Treats Go name-hash lookups as candidates on TypeDef cache misses and 
requires exact encoded
     namespace/type identity before accepting them.
   - Rejects malformed escape markers and invalid TypeDef name encodings or 
overflowing name lengths
     in the affected Java, Python, JavaScript, and Dart paths.
   - Corrects JavaScript dynamic meta-string reference IDs and one-based 
reference lookup.
   - Adds focused regression coverage for the malformed cases and valid 
JavaScript reference reuse.
   
   Valid metadata bytes and the binary protocol are unchanged.
   
   ## 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` below.
   - [x] I can explain and defend all important changes without AI help.
   - [x] AI-assisted code changes were reviewed line by line before submission.
   - [x] The line-by-line self-review was completed and issues were fixed 
before requesting AI review.
   - [x] Two fresh AI reviewers reviewed the final diff: one Fory-guided 
reviewer and one independent
     general reviewer using the independent-review carve-out.
   - [x] All actionable review comments were addressed and both final reviewers 
reported no further
     actionable comments.
   - [x] Persisted links to both final clean review results are included below.
   - [x] Relevant local verification was run and the results were reviewed 
before push.
   - [x] Focused tests were added for the changed behavior; no specification 
update is required because
     valid wire behavior is unchanged.
   - [x] Performance impact was reviewed at the call-path level; no checked 
cache-hit or normal codec
     work was added.
   - [x] Apache-2.0-compatible provenance was confirmed; no third-party code 
was introduced.
   
   ### AI Usage Disclosure
   
   - substantial_ai_assistance: yes
   - scope: design review, code changes, regression tests, validation, and 
final code review
   - affected_files_or_subsystems: Go, Java, Python, JavaScript, and Dart 
meta-string/TypeDef decoding
   - ai_review: line-by-line self-review completed; a Fory-guided reviewer and 
an independent general
     reviewer reviewed final commit `838bd04dceadd2e1389ab5ad514660e9b8fc072c` 
and reported no
     actionable findings
   - ai_review_artifacts:
     [Fory-guided clean 
review](https://gist.github.com/chaokunyang/380741c1ee4dc6106fb8244dd4de70c5);
     [independent general clean 
review](https://gist.github.com/chaokunyang/44341e7cb6a10fb9efb8c120aa8cfffd)
   - human_verification: local formatter/build/test outputs were inspected 
before push; Go full and
     focused race tests, Java full tests, Python pure/Cython full tests and 
Python xlang tests,
     JavaScript full tests/build/format check, and Dart analyzer/full tests 
passed
   - performance_verification: N/A; static call-path review confirmed checked 
TypeDef cache hits are
     unchanged, new validation is confined to cache misses or malformed 
branches, and JavaScript
     reference fixes retain the existing branch/allocation shape; benchmarks 
were intentionally not run
   - provenance_license_confirmation: Apache-2.0-compatible provenance 
confirmed; no incompatible
     third-party code introduced
   
   ## Does this PR introduce any user-facing change?
   
   Go callers of `MetaStringResolver.ReadMetaStringBytes` now receive only 
`*MetaStringBytes`; failures
   are stored in the supplied `*Error`.
   
   - [x] Does this PR introduce any public API change?
   - [ ] Does this PR introduce any binary protocol compatibility change?
   
   ## Validation
   
   - Go:
     - `ENABLE_FORY_DEBUG_OUTPUT=1 go test -v ./...`
     - focused `go test -race` coverage for malformed meta strings, resolver 
errors, TypeDef names, and
       TypeInfo consumers
   - Java:
     - `mvn -T16 spotless:check`
     - focused metadata tests and full `ENABLE_FORY_DEBUG_OUTPUT=1 mvn -T16 
test`
   - Python:
     - full pytest suites with `ENABLE_FORY_CYTHON_SERIALIZATION=0` and `=1`
     - Java-driven `PythonXlangTest` in both modes
     - `ruff format --check` passed; the changed lines introduce zero Ruff 
findings
   - JavaScript:
     - focused and full Jest suites
     - `npm run build`
     - `npm run format-check`
   - Dart:
     - `dart analyze`
     - focused xlang protocol test and full `dart test packages/fory/test`
   
   ## Benchmark
   
   Not run, by explicit scope. The final diff was reviewed to ensure validation 
remains on TypeDef
   cache-miss or malformed-input paths. Checked metadata cache hits are 
unchanged, and no new
   successful-path allocation or wrapper was introduced.
   


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