Skip to content

feat: support reflection-backed Triple IDL unary invocation - #1639

Merged
robocanic merged 6 commits into
apache:developfrom
AsperforMias:fix-idl-generic-invoke
Nov 22, 2026
Merged

robocanic merged 6 commits into
apache:developfrom
AsperforMias:fix-idl-generic-invoke

Conversation

@AsperforMias

Copy link
Copy Markdown
Contributor

Please provide a description of this PR:

Support Triple IDL unary calls through the existing generic invoke API. The current Hessian-based path cannot construct the protobuf messages required by IDL services.

Determine IDL mode from service provider metadata bound to the selected instance. Resolve descriptors through server reflection, validate catalog input/output type names against the reflected method, and use dynamic protobuf messages with protobuf JSON encoding.

Keep legacy non-IDL metadata without ProviderAppName usable. Other applications' IDL modes do not affect the selected provider; conflicting or unknown modes within the bound provider set are rejected. Explicit IDL metadata without a matching instance binding is not used for invocation.

Reflection and invocation share one gRPC connection, closed on success, failure, or cancellation. Business calls preserve attachments and group/version routing headers; reserved attachment keys are rejected. Reflection requests do not carry business routing headers.

The implementation is unary-only, bounds descriptor retrieval, and rejects known TLS/authentication configurations that this path cannot configure. No dependencies or SDK versions are changed.

Validation:

  • The original IDL regression fails before the change and passes afterward.
  • Targeted tests, race tests, vet, and lint for new changes pass.
  • Regression coverage includes legacy non-IDL metadata, provider-mode isolation, signature mismatches, security markers, descriptor limits, attachments, cancellation, and connection closure.
  • Real Admin API calls pass against Nacos- and ZooKeeper-discovered Go Triple providers, including non-empty group/version and attachment echo. All six non-IDL time-argument checks pass.
  • The full test suite still fails only at the existing TestObservabilityInstanceDashboardDispatch/metric assertion.

Server reflection and bound IDL metadata are required. Streaming and TLS/authentication are not implemented. Reflection cannot distinguish divergent schemas for versions of the same service within one process. Java interoperability and UI validation remain unverified.

To help us figure out who should review this PR, please put an X in all the areas that this PR affects.

  • Docs
  • Installation
  • User Experience
  • Dubboctl
  • Console
  • Core Component

Please check any characteristics that apply to this pull request.

@robocanic robocanic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

invokeIDLService loses the reflected type registry at the protobuf JSON boundary. For example, a provider can declare fixture.Payload in the reflected service file and return it inside a google.protobuf.Any. Both protojson calls here use the default global type registry, which does not contain the provider’s dynamic type. A valid request with this @type fails before dispatch; on the response path the RPC can succeed and Admin still returns an encoding error, potentially prompting the caller to repeat a completed operation.

I reproduced both codec failures with a private descriptor registry and type.googleapis.com/fixture.Payload. Using dynamicpb.NewTypes(files) as the Resolver on both UnmarshalOptions and MarshalOptions made both operations succeed. Please wire the resolver into both calls and add a unary echo regression with an Any carrying a reflected application type that is absent from protoregistry.GlobalTypes.

@AsperforMias

Copy link
Copy Markdown
Contributor Author

is there any problem unresolved?

@robocanic

Copy link
Copy Markdown
Contributor

在 0a54879 上复测后,同一份 proto 中定义的 Any 载荷已经能正常编解码。还剩一个会影响正常调用的场景:载荷类型定义在独立的 proto 文件里,服务端反射能按名称查到它,但服务 proto 没有直接或间接导入它。这是合法用法,因为声明 google.protobuf.Any 字段只需要导入 any.proto。

我把现有测试里的 fixture.Payload 移到单独的 payload.proto,保留它在服务端反射注册表中的注册,得到两个结果:

  • 请求的 Any 携带 fixture.Payload 时,Admin 返回 InvalidArgument,provider 收到 0 次业务调用。
  • 响应的 Any 携带同一类型时,provider 已成功执行 1 次,Admin 随后返回 IDL response encoding failed。对有副作用的方法,用户看到失败后重试,可能导致业务重复执行。

原因是 dynamicpb.NewTypes(files) 目前只包含服务描述符及其导入的文件。建议请求解码和响应编码共用一个支持按需查询的 resolver:本地找不到类型时,从 Any 的 type URL 取出 Protobuf 全名,通过现有反射连接发起 FileContainingSymbol 查询,补齐该类型及其依赖后继续编解码。补查沿用现有超时和描述符数量、大小限制。可以把上述独立文件场景加进回归测试,并在响应侧同时断言 Admin 成功返回、provider 只执行一次。

@AsperforMias

AsperforMias commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

A UI check for the note in the description that UI validation is unverified: the service debug page of the console (Vite dev server against each branch's backend) calling greet.GreetService/Greet with group gv-group and version gv-version on a Go Triple IDL provider with server reflection, discovered through ZooKeeper.

develop this PR
develop this PR

develop returns InternalError and its server log shows invalid_argument: unmarshal into []interface {}: []interface {} doesn't implement proto.Message. This PR returns {"greeting": "Ada"} and sends the group and version with the call.

The browser console shows Cannot read properties of undefined (reading 'toUrl') on both branches in the Vite dev server, so it is unrelated to this PR.

An Any field only needs any.proto, so its payload type can live in a
file the service does not import. Such a type failed to decode in the
request, and in the response after the method had already run. Resolve
a missing type by its name over the same reflection connection, under
the same descriptor and request limits, and keep rejecting import
cycles. A reflection failure during the lookup is reported as such, not
as invalid JSON, and the response error says the call ran when the
response still cannot be encoded.
@AsperforMias

Copy link
Copy Markdown
Contributor Author

done

@sonarqubecloud

Copy link
Copy Markdown

@robocanic
robocanic merged commit eed23c8 into apache:develop Nov 22, 2026
7 checks passed
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.

2 participants