You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fory.apache.org by "ayush00git (via GitHub)" <gi...@apache.org> on 2026/06/12 07:30:12 UTC

[PR] fix(compiler): make Go gRPC codec stateless and add collision checks [fory]

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

   ## What
   
   Follow-up to the post-merge review on #3698, resolving the five inline comments on the Go gRPC generator and integration test.
   
   - **Stateless codec / single owner.** `CodecV2` is now `struct{}` and reuses the generated package thread-safe `getFory()` runtime via `Serialize`/`Deserialize`, instead of taking an injected `*fory.Fory`. `NewXxxClient` no longer takes a Fory. This keeps one registration owner and is safe for concurrent RPCs (plain Go `Fory` reuses internal buffers/state).
   - **Server interop without global state.** The Go peer uses `grpc.ForceServerCodecV2(CodecV2{})` instead of mutating grpc-go's process-global `proto` codec registry, and no longer constructs its own non-thread-safe Fory. grpc-go's `getCodec` returns the forced codec regardless of content-subtype, so Java clients sending the default content-type are still decoded by Fory.
   - **Collision checks.** Added Go gRPC method/service name collision checks (PascalCase folds `Foo`/`foo`), mirroring the Java/Python/Rust generators.
   - **No duplicate emission.** `GoGenerator.generate()` no longer emits service companions; the common CLI path already calls `generate_services()`, so this removes the second owner of `_grpc.go`.
   
   ## Verification
   
   - Compiler suite: 359 passed.
   - Go: `go build` / `go vet` clean; `go build -race` clean.
   - Concurrency: built with `-race`, ran 12 concurrent clients against one server under `GORACE=halt_on_error=1`, exercising all four streaming modes -> 0 failures, 0 data races on server or client.
   - Added/updated tests: Go arm in `test_grpc_method_name_collisions_fail`, new `test_go_grpc_service_type_collision_fails`, and `test_go_grpc_service_codegen` updated for the stateless codec.
   
   Follow-up to #3698.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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: commits-unsubscribe@fory.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org


Re: [PR] fix(compiler): make Go gRPC codec stateless and add collision checks [fory]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang closed pull request #3752: fix(compiler): make Go gRPC codec stateless and add collision checks
URL: https://github.com/apache/fory/pull/3752


-- 
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: commits-unsubscribe@fory.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org