Skip to content

test(compiler): add IR validation and codegen tests for gRPC service support#3528

Open
darius024 wants to merge 5 commits intoapache:mainfrom
darius024:test/compiler-grpc-service-ir-validation
Open

test(compiler): add IR validation and codegen tests for gRPC service support#3528
darius024 wants to merge 5 commits intoapache:mainfrom
darius024:test/compiler-grpc-service-ir-validation

Conversation

@darius024
Copy link
Copy Markdown

Why?

Issue #3277 requires unit tests for gRPC service support in the Fory compiler: IR validation tests covering name, type, and streaming rules, and golden codegen tests for service schemas. The parser tests for FDL/proto/fbs service syntax already existed from closed sub-issues. This PR fills the remaining gaps.

What does this PR do?

compiler/fory_compiler/ir/validator.py

  • Added _check_services() implementing three validation rules:
    1. Duplicate service names → error
    2. Duplicate method names within the same service → error
    3. RPC request/response types must be messageenum and union are rejected
  • Wired _check_services() into validate() after _check_type_references()

compiler/fory_compiler/tests/test_ir_service_validation.py (new)

  • Tests for all three validation rules above, across FDL, proto, and fbs frontends
  • Tests that streaming RPCs (client, server, bidi) pass validation without error

compiler/fory_compiler/tests/test_service_codegen.py (new)

  • Asserts service definitions do not alter message codegen output across all 7 language generators
  • Documents that generate_services() returns [] as a baseline for all generators
  • Verifies compile_file(..., grpc=True) succeeds and produces output for all languages using examples/service.fdl
  • Asserts key signatures (class HelloRequest, String name, etc.) are present in Java and Python generated output

Related issues

Copilot AI review requested due to automatic review settings March 29, 2026 11:29
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds IR-level validation and compiler/codegen smoke tests to cover gRPC service schema support in the Fory compiler, filling the remaining testing gaps for Issue #3277.

Changes:

  • Add IR validation for duplicate service/method names and enforce RPC request/response types are messages.
  • Add IR validation tests across FDL / proto / fbs, including streaming RPC cases.
  • Add codegen/compile smoke tests ensuring service definitions don’t affect message codegen and --grpc compilation succeeds.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
compiler/fory_compiler/ir/validator.py Adds _check_services() and wires it into schema validation.
compiler/fory_compiler/tests/test_ir_service_validation.py New tests covering duplicate names, type restrictions, and streaming RPC validation.
compiler/fory_compiler/tests/test_service_codegen.py New smoke tests to ensure services don’t change message codegen and compile_file(..., grpc=True) emits output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Compiler][gRPC] Test plan and cross-language smoke tests

2 participants