Re: [PR] feat(triple): dispatch non-IDL wrapper decoding by SerializeType [dubbo-go]

2026-08-17 Thread via GitHub


Alanxtl merged PR #3550:
URL: https://github.com/apache/dubbo-go/pull/3550


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



Re: [PR] feat(triple): dispatch non-IDL wrapper decoding by SerializeType [dubbo-go]

2026-08-17 Thread via GitHub


sonarqubecloud[bot] commented on PR #3550:
URL: https://github.com/apache/dubbo-go/pull/3550#issuecomment-5313381794

   ## [![Quality Gate 
Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png
 'Quality Gate 
Passed')](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3550) 
**Quality Gate passed**  
   Issues  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [1 New 
issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3550&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png
 '') [0 Accepted 
issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3550&issueStatuses=ACCEPTED)
   
   Measures  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3550&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0.0% Coverage on New 
Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3550&metric=new_coverage&view=list)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0.0% Duplication on New 
Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3550&metric=new_duplicated_lines_density&view=list)
  
 
   
   [See analysis details on SonarQube 
Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3550)
   
   


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



Re: [PR] feat(triple): dispatch non-IDL wrapper decoding by SerializeType [dubbo-go]

2026-08-17 Thread via GitHub


eye-gu commented on code in PR #3550:
URL: https://github.com/apache/dubbo-go/pull/3550#discussion_r3794658960


##
protocol/triple/triple_protocol/codec.go:
##
@@ -351,7 +305,11 @@ func (c *protoWrapperCodec) Unmarshal(binary []byte, 
message any) error {
if err := proto.Unmarshal(binary, &wrapperResp); err == nil {
// Check if it's a valid response wrapper (has serializeType or 
non-empty data)
if len(wrapperResp.Data) > 0 {
-   return c.innerCodec.Unmarshal(wrapperResp.Data, message)
+   inner, err := 
resolveInnerCodec(wrapperResp.SerializeType)

Review Comment:
   已修复



##
protocol/triple/triple_protocol/codec.go:
##
@@ -619,6 +581,103 @@ func copySlice(inSlice, outSlice reflect.Value) error {
return nil
 }
 
+// tripleServerCodecSession is a per-request Codec for the triple server that
+// handles both IDL and Non-IDL formats.
+//
+// SerializeType is request-scoped state that the Codec interface
+// (Marshal/Unmarshal) has no channel to surface. The session object IS that
+// channel: Unmarshal captures SerializeType from the TripleRequestWrapper in a
+// single decode, and Marshal reads it to wrap the response in a
+// TripleResponseWrapper.
+type tripleServerCodecSession struct {
+   delegate Codec  // IDL path codec, resolved from 
Content-Type
+   serializeTypestring // captured by Unmarshal when Non-IDL; read 
by Marshal
+   allowedSerializeType string // provider "serialization" param; 
effective allowlist = {hessian2} ∪ {this}. TODO: support Java's multi-valued 
prefer-serialization
+}
+
+var _ Codec = (*tripleServerCodecSession)(nil)
+
+func (s *tripleServerCodecSession) Name() string { return s.delegate.Name() }
+
+// checkAllowed enforces the provider-side serialization allowlist.
+// hessian2 is always allowed (Non-IDL interop default); any other name must
+// match the provider's configured serialization.
+func (s *tripleServerCodecSession) checkAllowed(codecName string) error {
+   if codecName == codecNameHessian2 || codecName == 
s.allowedSerializeType {
+   return nil
+   }
+   return fmt.Errorf("serialize type %q not allowed by provider (allowed: 
%s, %s)",
+   codecName, codecNameHessian2, s.allowedSerializeType)
+}
+
+func (s *tripleServerCodecSession) Unmarshal(data []byte, message any) error {
+   if _, isProto := message.(proto.Message); isProto {
+   // IDL: standard proto message.
+   return s.delegate.Unmarshal(data, message)
+   }
+   // Non-IDL: decode the TripleRequestWrapper once, capturing 
SerializeType
+   // for the subsequent response Marshal and decoding the inner args in 
the
+   // same pass.
+   var reqWrapper interoperability.TripleRequestWrapper
+   if err := proto.Unmarshal(data, &reqWrapper); err != nil {
+   return fmt.Errorf("unmarshal triple wrapper request: %w", err)
+   }
+   s.serializeType = reqWrapper.SerializeType
+   inner, err := resolveInnerCodec(reqWrapper.SerializeType)
+   if err != nil {
+   return fmt.Errorf("unmarshal triple wrapper request: %w", err)
+   }
+   if err := s.checkAllowed(inner.Name()); err != nil {
+   return fmt.Errorf("unmarshal triple wrapper request: %w", err)
+   }
+   return unmarshalWrapperRequestArgs(&reqWrapper, inner, message)
+}
+
+func (s *tripleServerCodecSession) Marshal(message any) ([]byte, error) {
+   if _, isProto := message.(proto.Message); isProto {
+   // IDL: standard proto message.
+   return s.delegate.Marshal(message)
+   }
+   // Non-IDL: wrap the response in a TripleResponseWrapper whose Data is
+   // serialized with the inner codec resolved from the request's 
SerializeType.
+   inner, err := resolveInnerCodec(s.serializeType)
+   if err != nil {
+   return nil, fmt.Errorf("marshal triple wrapper response: %w", 
err)
+   }
+   data, err := inner.Marshal(message)

Review Comment:
   已修复



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



Re: [PR] feat(triple): dispatch non-IDL wrapper decoding by SerializeType [dubbo-go]

2026-08-17 Thread via GitHub


Alanxtl commented on PR #3550:
URL: https://github.com/apache/dubbo-go/pull/3550#issuecomment-5313337741

   update to latest develop to fix the ci fail


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



Re: [PR] feat(triple): dispatch non-IDL wrapper decoding by SerializeType [dubbo-go]

2026-08-17 Thread via GitHub


sonarqubecloud[bot] commented on PR #3550:
URL: https://github.com/apache/dubbo-go/pull/3550#issuecomment-5313319230

   ## [![Quality Gate 
Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png
 'Quality Gate 
Passed')](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3550) 
**Quality Gate passed**  
   Issues  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [1 New 
issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3550&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png
 '') [0 Accepted 
issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3550&issueStatuses=ACCEPTED)
   
   Measures  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3550&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0.0% Coverage on New 
Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3550&metric=new_coverage&view=list)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0.0% Duplication on New 
Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3550&metric=new_duplicated_lines_density&view=list)
  
 
   
   [See analysis details on SonarQube 
Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3550)
   
   


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



Re: [PR] feat(triple): dispatch non-IDL wrapper decoding by SerializeType [dubbo-go]

2026-08-02 Thread via GitHub


AlexStocks commented on code in PR #3550:
URL: https://github.com/apache/dubbo-go/pull/3550#discussion_r3699002080


##
protocol/triple/triple_protocol/codec.go:
##
@@ -619,6 +581,103 @@ func copySlice(inSlice, outSlice reflect.Value) error {
return nil
 }
 
+// tripleServerCodecSession is a per-request Codec for the triple server that
+// handles both IDL and Non-IDL formats.
+//
+// SerializeType is request-scoped state that the Codec interface
+// (Marshal/Unmarshal) has no channel to surface. The session object IS that
+// channel: Unmarshal captures SerializeType from the TripleRequestWrapper in a
+// single decode, and Marshal reads it to wrap the response in a
+// TripleResponseWrapper.
+type tripleServerCodecSession struct {
+   delegate Codec  // IDL path codec, resolved from 
Content-Type
+   serializeTypestring // captured by Unmarshal when Non-IDL; read 
by Marshal
+   allowedSerializeType string // provider "serialization" param; 
effective allowlist = {hessian2} ∪ {this}. TODO: support Java's multi-valued 
prefer-serialization
+}
+
+var _ Codec = (*tripleServerCodecSession)(nil)
+
+func (s *tripleServerCodecSession) Name() string { return s.delegate.Name() }
+
+// checkAllowed enforces the provider-side serialization allowlist.
+// hessian2 is always allowed (Non-IDL interop default); any other name must
+// match the provider's configured serialization.
+func (s *tripleServerCodecSession) checkAllowed(codecName string) error {
+   if codecName == codecNameHessian2 || codecName == 
s.allowedSerializeType {
+   return nil
+   }
+   return fmt.Errorf("serialize type %q not allowed by provider (allowed: 
%s, %s)",
+   codecName, codecNameHessian2, s.allowedSerializeType)
+}
+
+func (s *tripleServerCodecSession) Unmarshal(data []byte, message any) error {
+   if _, isProto := message.(proto.Message); isProto {
+   // IDL: standard proto message.
+   return s.delegate.Unmarshal(data, message)
+   }
+   // Non-IDL: decode the TripleRequestWrapper once, capturing 
SerializeType
+   // for the subsequent response Marshal and decoding the inner args in 
the
+   // same pass.
+   var reqWrapper interoperability.TripleRequestWrapper
+   if err := proto.Unmarshal(data, &reqWrapper); err != nil {
+   return fmt.Errorf("unmarshal triple wrapper request: %w", err)
+   }
+   s.serializeType = reqWrapper.SerializeType
+   inner, err := resolveInnerCodec(reqWrapper.SerializeType)
+   if err != nil {
+   return fmt.Errorf("unmarshal triple wrapper request: %w", err)
+   }
+   if err := s.checkAllowed(inner.Name()); err != nil {
+   return fmt.Errorf("unmarshal triple wrapper request: %w", err)
+   }
+   return unmarshalWrapperRequestArgs(&reqWrapper, inner, message)
+}
+
+func (s *tripleServerCodecSession) Marshal(message any) ([]byte, error) {
+   if _, isProto := message.(proto.Message); isProto {
+   // IDL: standard proto message.
+   return s.delegate.Marshal(message)
+   }
+   // Non-IDL: wrap the response in a TripleResponseWrapper whose Data is
+   // serialized with the inner codec resolved from the request's 
SerializeType.
+   inner, err := resolveInnerCodec(s.serializeType)
+   if err != nil {
+   return nil, fmt.Errorf("marshal triple wrapper response: %w", 
err)
+   }
+   data, err := inner.Marshal(message)

Review Comment:
   [P0] 非 IDL 响应把内部 `[]any` 容器写进了 wrapper
   
   生产链路的 `wrapTripleResponse` 固定构造 `[]any{result}`,handler 再通过 
`conn.Send(response.Any())` 把这个切片传到这里;当前实现却把整个 `message` 交给 inner 
codec。使用相同生产形状的 WSL/Go 1.25.1 overlay 已稳定复现:MsgPack 将 array 解码到 string reply 
时返回类型错误,Hessian2 在 `copySlice` 对 string 调用 `reflect.MakeSlice` 并 panic。新增 
round-trip 测试直接向 session 传标量,绕过了真实形状。
   
   请在编码前严格解包单元素 response container,并明确定义 0/多元素和 nil 返回;补从 Triple 
Invoker/handler 公共入口覆盖 Hessian2、MsgPack、具体类型指针和 `*any` 的端到端测试。



##
protocol/triple/triple_protocol/codec.go:
##
@@ -351,7 +305,11 @@ func (c *protoWrapperCodec) Unmarshal(binary []byte, 
message any) error {
if err := proto.Unmarshal(binary, &wrapperResp); err == nil {
// Check if it's a valid response wrapper (has serializeType or 
non-empty data)
if len(wrapperResp.Data) > 0 {
-   return c.innerCodec.Unmarshal(wrapperResp.Data, message)
+   inner, err := 
resolveInnerCodec(wrapperResp.SerializeType)

Review Comment:
   [P1] 空 Data 也必须先校验 `SerializeType`
   
   当前只在 `Data` 非空时调用 `resolveInnerCodec`;`TripleResponseWrapper{SerializeType: 
"unknown", Data: nil}` 会命中后续分支直接返回成功。WSL overlay 已复现 `Unmarshal` 返回 nil,违反 
Issue #3496 对 unknown/disabled type 明确报错的验收条件,调用方也无法区分真实 void 与损坏协议响应。
   
   请在判断空 Data 前先解析并校验非空 `SerializeType`,再按已知类型处理 void/null;补 

Re: [PR] feat(triple): dispatch non-IDL wrapper decoding by SerializeType [dubbo-go]

2026-08-02 Thread via GitHub


eye-gu commented on code in PR #3550:
URL: https://github.com/apache/dubbo-go/pull/3550#discussion_r3698519331


##
protocol/triple/triple_protocol/protocol_triple.go:
##
@@ -162,7 +160,6 @@ func (h *tripleHandler) NewConn(
contentType,
)
codec := h.Codecs.Get(codecName)
-   backupCodec := h.Codecs.Get(h.FallbackCodecName)

Review Comment:
   已修改. backupCodec来源于serialization配置,作为序列化白名单了



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



Re: [PR] feat(triple): dispatch non-IDL wrapper decoding by SerializeType [dubbo-go]

2026-08-02 Thread via GitHub


eye-gu commented on code in PR #3550:
URL: https://github.com/apache/dubbo-go/pull/3550#discussion_r3698516988


##
protocol/triple/triple_protocol/inner_codec.go:
##
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package triple_protocol
+
+import (
+   "fmt"
+)
+
+// innerCodecRegistry is the allowed-set of Triple non-IDL inner serialization
+// codecs. The name key MUST match the SerializeType string the client writes
+// into TripleRequestWrapper.SerializeType / 
TripleResponseWrapper.SerializeType
+// (e.g. "hessian2", "msgpack"). An absent entry is a disabled serialization.
+type innerCodecRegistry struct {
+   items map[string]Codec
+}
+
+var innerCodecs = &innerCodecRegistry{items: make(map[string]Codec)}
+
+// SetInnerCodec registers an inner codec under the given name.
+//
+// SetInnerCodec is init-only: it MUST be called exclusively from package 
init().
+func SetInnerCodec(name string, c Codec) {
+   innerCodecs.items[name] = c
+}
+
+// GetInnerCodec looks up a registered inner codec by name.
+// Returns (nil, false) when the name is unknown or disabled (unregistered).
+func GetInnerCodec(name string) (Codec, bool) {
+   c, ok := innerCodecs.items[name]
+   return c, ok
+}
+
+// innerCodecNames returns the registered inner codec names, for error
+// diagnostics. Order is unspecified.
+func innerCodecNames() []string {
+   names := make([]string, 0, len(innerCodecs.items))
+   for n := range innerCodecs.items {
+   names = append(names, n)
+   }
+   return names
+}
+
+// resolveInnerCodec looks up the inner codec registered under serializeType
+// in the inner codec registry. An empty serializeType defaults to hessian2 for
+// backward compatibility.
+//
+// Dubbo Java writes "hessian4" into the wrapper (TripleConstants.HESSIAN4)
+// while its on-wire encoding is Hessian2-compatible; the Java receiver maps it
+// back to "hessian2" in ReflectionPackableMethod.convertHessianFromWrapper. Go
+// mirrors that single alias so a Java non-IDL client is not rejected.
+func resolveInnerCodec(serializeType string) (Codec, error) {
+   if serializeType == "" || serializeType == "hessian4" {
+   serializeType = codecNameHessian2
+   }
+   c, ok := GetInnerCodec(serializeType)
+   if !ok {
+   return nil, fmt.Errorf("unsupported or disabled serialize type 
%q (registered: %v)",
+   serializeType, innerCodecNames())
+   }
+   return c, nil
+}

Review Comment:
   已修改. 不过看了java的dubbo实现,序列化白名单是prefer.serialization+serialization+ hessian2, 
少了prefer.serialization



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



Re: [PR] feat(triple): dispatch non-IDL wrapper decoding by SerializeType [dubbo-go]

2026-08-02 Thread via GitHub


eye-gu commented on code in PR #3550:
URL: https://github.com/apache/dubbo-go/pull/3550#discussion_r3698510177


##
protocol/triple/triple_protocol/inner_codec.go:
##
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package triple_protocol
+
+import (
+   "fmt"
+)
+
+// innerCodecRegistry is the allowed-set of Triple non-IDL inner serialization
+// codecs. The name key MUST match the SerializeType string the client writes
+// into TripleRequestWrapper.SerializeType / 
TripleResponseWrapper.SerializeType
+// (e.g. "hessian2", "msgpack"). An absent entry is a disabled serialization.
+type innerCodecRegistry struct {
+   items map[string]Codec
+}
+
+var innerCodecs = &innerCodecRegistry{items: make(map[string]Codec)}
+
+// SetInnerCodec registers an inner codec under the given name.
+//
+// SetInnerCodec is init-only: it MUST be called exclusively from package 
init().
+func SetInnerCodec(name string, c Codec) {
+   innerCodecs.items[name] = c
+}
+
+// GetInnerCodec looks up a registered inner codec by name.
+// Returns (nil, false) when the name is unknown or disabled (unregistered).
+func GetInnerCodec(name string) (Codec, bool) {
+   c, ok := innerCodecs.items[name]
+   return c, ok
+}
+
+// innerCodecNames returns the registered inner codec names, for error
+// diagnostics. Order is unspecified.
+func innerCodecNames() []string {
+   names := make([]string, 0, len(innerCodecs.items))
+   for n := range innerCodecs.items {
+   names = append(names, n)
+   }
+   return names
+}
+
+// resolveInnerCodec looks up the inner codec registered under serializeType
+// in the inner codec registry. An empty serializeType defaults to hessian2 for
+// backward compatibility.
+//
+// Dubbo Java writes "hessian4" into the wrapper (TripleConstants.HESSIAN4)
+// while its on-wire encoding is Hessian2-compatible; the Java receiver maps it
+// back to "hessian2" in ReflectionPackableMethod.convertHessianFromWrapper. Go
+// mirrors that single alias so a Java non-IDL client is not rejected.
+func resolveInnerCodec(serializeType string) (Codec, error) {
+   if serializeType == "" || serializeType == "hessian4" {
+   serializeType = codecNameHessian2
+   }
+   c, ok := GetInnerCodec(serializeType)
+   if !ok {
+   return nil, fmt.Errorf("unsupported or disabled serialize type 
%q (registered: %v)",
+   serializeType, innerCodecNames())
+   }
+   return c, nil
+}
+
+func init() {
+   SetInnerCodec(codecNameHessian2, &hessian2Codec{})
+   SetInnerCodec(codecNameMsgPack, &msgpackCodec{})
+}

Review Comment:
   已修改



##
protocol/triple/triple_protocol/inner_codec.go:
##
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package triple_protocol
+
+import (
+   "fmt"
+)
+
+// innerCodecRegistry is the allowed-set of Triple non-IDL inner serialization
+// codecs. The name key MUST match the SerializeType string the client writes
+// into TripleRequestWrapper.SerializeType / 
TripleResponseWrapper.SerializeType
+// (e.g. "hessian2", "msgpack"). An absent entry is a disabled serialization.
+type innerCodecRegistry struct {
+   items map[string]Codec
+}
+
+var innerCodecs = &innerCodecRegistry{items: make(map[string]Codec)}
+
+// SetInnerCodec registers an inner codec under the given name.
+//
+// SetInnerCodec is init-only: it 

Re: [PR] feat(triple): dispatch non-IDL wrapper decoding by SerializeType [dubbo-go]

2026-08-02 Thread via GitHub


eye-gu commented on code in PR #3550:
URL: https://github.com/apache/dubbo-go/pull/3550#discussion_r3698509112


##
protocol/triple/triple_protocol/inner_codec.go:
##
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package triple_protocol
+
+import (
+   "fmt"
+)
+
+// innerCodecRegistry is the allowed-set of Triple non-IDL inner serialization
+// codecs. The name key MUST match the SerializeType string the client writes
+// into TripleRequestWrapper.SerializeType / 
TripleResponseWrapper.SerializeType
+// (e.g. "hessian2", "msgpack"). An absent entry is a disabled serialization.
+type innerCodecRegistry struct {
+   items map[string]Codec
+}
+
+var innerCodecs = &innerCodecRegistry{items: make(map[string]Codec)}
+
+// SetInnerCodec registers an inner codec under the given name.
+//
+// SetInnerCodec is init-only: it MUST be called exclusively from package 
init().
+func SetInnerCodec(name string, c Codec) {

Review Comment:
   改了. 之前考虑是可以给用户扩展,像filter



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



Re: [PR] feat(triple): dispatch non-IDL wrapper decoding by SerializeType [dubbo-go]

2026-08-02 Thread via GitHub


sonarqubecloud[bot] commented on PR #3550:
URL: https://github.com/apache/dubbo-go/pull/3550#issuecomment-5156763442

   ## [![Quality Gate 
Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png
 'Quality Gate 
Passed')](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3550) 
**Quality Gate passed**  
   Issues  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [2 New 
issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3550&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png
 '') [0 Accepted 
issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3550&issueStatuses=ACCEPTED)
   
   Measures  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3550&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0.0% Coverage on New 
Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3550&metric=new_coverage&view=list)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0.0% Duplication on New 
Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3550&metric=new_duplicated_lines_density&view=list)
  
 
   
   [See analysis details on SonarQube 
Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3550)
   
   


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



Re: [PR] feat(triple): dispatch non-IDL wrapper decoding by SerializeType [dubbo-go]

2026-07-27 Thread via GitHub


zouyx commented on code in PR #3550:
URL: https://github.com/apache/dubbo-go/pull/3550#discussion_r3662655087


##
protocol/triple/triple_protocol/inner_codec.go:
##
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package triple_protocol
+
+import (
+   "fmt"
+)
+
+// innerCodecRegistry is the allowed-set of Triple non-IDL inner serialization
+// codecs. The name key MUST match the SerializeType string the client writes
+// into TripleRequestWrapper.SerializeType / 
TripleResponseWrapper.SerializeType
+// (e.g. "hessian2", "msgpack"). An absent entry is a disabled serialization.
+type innerCodecRegistry struct {
+   items map[string]Codec
+}
+
+var innerCodecs = &innerCodecRegistry{items: make(map[string]Codec)}
+
+// SetInnerCodec registers an inner codec under the given name.
+//
+// SetInnerCodec is init-only: it MUST be called exclusively from package 
init().
+func SetInnerCodec(name string, c Codec) {
+   innerCodecs.items[name] = c
+}
+
+// GetInnerCodec looks up a registered inner codec by name.
+// Returns (nil, false) when the name is unknown or disabled (unregistered).
+func GetInnerCodec(name string) (Codec, bool) {
+   c, ok := innerCodecs.items[name]
+   return c, ok
+}
+
+// innerCodecNames returns the registered inner codec names, for error
+// diagnostics. Order is unspecified.
+func innerCodecNames() []string {
+   names := make([]string, 0, len(innerCodecs.items))
+   for n := range innerCodecs.items {
+   names = append(names, n)
+   }
+   return names
+}
+
+// resolveInnerCodec looks up the inner codec registered under serializeType
+// in the inner codec registry. An empty serializeType defaults to hessian2 for
+// backward compatibility.
+//
+// Dubbo Java writes "hessian4" into the wrapper (TripleConstants.HESSIAN4)
+// while its on-wire encoding is Hessian2-compatible; the Java receiver maps it
+// back to "hessian2" in ReflectionPackableMethod.convertHessianFromWrapper. Go
+// mirrors that single alias so a Java non-IDL client is not rejected.
+func resolveInnerCodec(serializeType string) (Codec, error) {
+   if serializeType == "" || serializeType == "hessian4" {
+   serializeType = codecNameHessian2
+   }
+   c, ok := GetInnerCodec(serializeType)
+   if !ok {
+   return nil, fmt.Errorf("unsupported or disabled serialize type 
%q (registered: %v)",
+   serializeType, innerCodecNames())
+   }
+   return c, nil
+}

Review Comment:
   我也是有这个疑问



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



Re: [PR] feat(triple): dispatch non-IDL wrapper decoding by SerializeType [dubbo-go]

2026-07-27 Thread via GitHub


Alanxtl commented on code in PR #3550:
URL: https://github.com/apache/dubbo-go/pull/3550#discussion_r3662574075


##
protocol/triple/triple_protocol/inner_codec.go:
##
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package triple_protocol
+
+import (
+   "fmt"
+)
+
+// innerCodecRegistry is the allowed-set of Triple non-IDL inner serialization
+// codecs. The name key MUST match the SerializeType string the client writes
+// into TripleRequestWrapper.SerializeType / 
TripleResponseWrapper.SerializeType
+// (e.g. "hessian2", "msgpack"). An absent entry is a disabled serialization.
+type innerCodecRegistry struct {
+   items map[string]Codec
+}
+
+var innerCodecs = &innerCodecRegistry{items: make(map[string]Codec)}
+
+// SetInnerCodec registers an inner codec under the given name.
+//
+// SetInnerCodec is init-only: it MUST be called exclusively from package 
init().
+func SetInnerCodec(name string, c Codec) {
+   innerCodecs.items[name] = c
+}
+
+// GetInnerCodec looks up a registered inner codec by name.
+// Returns (nil, false) when the name is unknown or disabled (unregistered).
+func GetInnerCodec(name string) (Codec, bool) {
+   c, ok := innerCodecs.items[name]
+   return c, ok
+}
+
+// innerCodecNames returns the registered inner codec names, for error
+// diagnostics. Order is unspecified.
+func innerCodecNames() []string {
+   names := make([]string, 0, len(innerCodecs.items))
+   for n := range innerCodecs.items {
+   names = append(names, n)
+   }
+   return names
+}
+
+// resolveInnerCodec looks up the inner codec registered under serializeType
+// in the inner codec registry. An empty serializeType defaults to hessian2 for
+// backward compatibility.
+//
+// Dubbo Java writes "hessian4" into the wrapper (TripleConstants.HESSIAN4)
+// while its on-wire encoding is Hessian2-compatible; the Java receiver maps it
+// back to "hessian2" in ReflectionPackableMethod.convertHessianFromWrapper. Go
+// mirrors that single alias so a Java non-IDL client is not rejected.
+func resolveInnerCodec(serializeType string) (Codec, error) {
+   if serializeType == "" || serializeType == "hessian4" {
+   serializeType = codecNameHessian2
+   }
+   c, ok := GetInnerCodec(serializeType)
+   if !ok {
+   return nil, fmt.Errorf("unsupported or disabled serialize type 
%q (registered: %v)",
+   serializeType, innerCodecNames())
+   }
+   return c, nil
+}

Review Comment:
   这里再加一下注释吧,有一种情况是provider配置了使用hessian2,但是如果客户端发SerializeType = 
msgpack,也是可以正常解析的,因为全局注册了SetInnerCodec(codecNameMsgPack, &msgpackCodec{})
   
   可能不完全符合使用者预期



##
protocol/triple/triple_protocol/inner_codec.go:
##
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package triple_protocol
+
+import (
+   "fmt"
+)
+
+// innerCodecRegistry is the allowed-set of Triple non-IDL inner serialization
+// codecs. The name key MUST match the SerializeType string the client writes
+// into TripleRequestWrapper.SerializeType / 
TripleResponseWrapper.SerializeType
+// (e.g. "hessian2", "msgpack"). An absent entry is a disabled serialization.
+type innerCodecRegistry struct {
+   items map[string]Codec
+}
+
+var innerCodecs = &innerCodecRegistry{items: make(map[string]Codec)}
+
+// SetInnerCodec registers an inner codec under the given name.
+//
+// 

Re: [PR] feat(triple): dispatch non-IDL wrapper decoding by SerializeType [dubbo-go]

2026-07-27 Thread via GitHub


Alanxtl commented on code in PR #3550:
URL: https://github.com/apache/dubbo-go/pull/3550#discussion_r3662499337


##
protocol/triple/triple_protocol/protocol_triple.go:
##
@@ -162,7 +160,6 @@ func (h *tripleHandler) NewConn(
contentType,
)
codec := h.Codecs.Get(codecName)
-   backupCodec := h.Codecs.Get(h.FallbackCodecName)

Review Comment:
   那现在是不需要backupCodec 机制了吗



##
protocol/triple/triple_protocol/inner_codec.go:
##
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package triple_protocol
+
+import (
+   "fmt"
+)
+
+// innerCodecRegistry is the allowed-set of Triple non-IDL inner serialization
+// codecs. The name key MUST match the SerializeType string the client writes
+// into TripleRequestWrapper.SerializeType / 
TripleResponseWrapper.SerializeType
+// (e.g. "hessian2", "msgpack"). An absent entry is a disabled serialization.
+type innerCodecRegistry struct {
+   items map[string]Codec
+}
+
+var innerCodecs = &innerCodecRegistry{items: make(map[string]Codec)}
+
+// SetInnerCodec registers an inner codec under the given name.
+//
+// SetInnerCodec is init-only: it MUST be called exclusively from package 
init().
+func SetInnerCodec(name string, c Codec) {
+   innerCodecs.items[name] = c
+}
+
+// GetInnerCodec looks up a registered inner codec by name.
+// Returns (nil, false) when the name is unknown or disabled (unregistered).
+func GetInnerCodec(name string) (Codec, bool) {
+   c, ok := innerCodecs.items[name]
+   return c, ok
+}
+
+// innerCodecNames returns the registered inner codec names, for error
+// diagnostics. Order is unspecified.
+func innerCodecNames() []string {
+   names := make([]string, 0, len(innerCodecs.items))
+   for n := range innerCodecs.items {
+   names = append(names, n)
+   }
+   return names
+}
+
+// resolveInnerCodec looks up the inner codec registered under serializeType
+// in the inner codec registry. An empty serializeType defaults to hessian2 for
+// backward compatibility.
+//
+// Dubbo Java writes "hessian4" into the wrapper (TripleConstants.HESSIAN4)
+// while its on-wire encoding is Hessian2-compatible; the Java receiver maps it
+// back to "hessian2" in ReflectionPackableMethod.convertHessianFromWrapper. Go
+// mirrors that single alias so a Java non-IDL client is not rejected.
+func resolveInnerCodec(serializeType string) (Codec, error) {
+   if serializeType == "" || serializeType == "hessian4" {
+   serializeType = codecNameHessian2
+   }
+   c, ok := GetInnerCodec(serializeType)
+   if !ok {
+   return nil, fmt.Errorf("unsupported or disabled serialize type 
%q (registered: %v)",
+   serializeType, innerCodecNames())
+   }
+   return c, nil
+}
+
+func init() {
+   SetInnerCodec(codecNameHessian2, &hessian2Codec{})
+   SetInnerCodec(codecNameMsgPack, &msgpackCodec{})
+}

Review Comment:
   init块放到func SetInnerCodec(name string, c Codec) {这行的上面



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



Re: [PR] feat(triple): dispatch non-IDL wrapper decoding by SerializeType [dubbo-go]

2026-07-27 Thread via GitHub


Copilot commented on code in PR #3550:
URL: https://github.com/apache/dubbo-go/pull/3550#discussion_r3659329481


##
protocol/triple/triple_protocol/inner_codec.go:
##
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package triple_protocol
+
+import (
+   "fmt"
+)
+
+// innerCodecRegistry is the allowed-set of Triple non-IDL inner serialization
+// codecs. The name key MUST match the SerializeType string the client writes
+// into TripleRequestWrapper.SerializeType / 
TripleResponseWrapper.SerializeType
+// (e.g. "hessian2", "msgpack"). An absent entry is a disabled serialization.
+type innerCodecRegistry struct {
+   items map[string]Codec
+}
+
+var innerCodecs = &innerCodecRegistry{items: make(map[string]Codec)}
+
+// SetInnerCodec registers an inner codec under the given name.
+//
+// SetInnerCodec is init-only: it MUST be called exclusively from package 
init().
+func SetInnerCodec(name string, c Codec) {
+   innerCodecs.items[name] = c
+}
+
+// GetInnerCodec looks up a registered inner codec by name.
+// Returns (nil, false) when the name is unknown or disabled (unregistered).
+func GetInnerCodec(name string) (Codec, bool) {
+   c, ok := innerCodecs.items[name]
+   return c, ok
+}
+
+// innerCodecNames returns the registered inner codec names, for error
+// diagnostics. Order is unspecified.
+func innerCodecNames() []string {
+   names := make([]string, 0, len(innerCodecs.items))
+   for n := range innerCodecs.items {
+   names = append(names, n)
+   }
+   return names
+}

Review Comment:
   The error message prints `innerCodecNames()` in unspecified (map iteration) 
order, which makes log output and tests/debugging nondeterministic. Sorting the 
returned names (or formatting them deterministically) would provide stable 
diagnostics.



##
protocol/triple/triple_protocol/inner_codec.go:
##
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package triple_protocol
+
+import (
+   "fmt"
+)
+
+// innerCodecRegistry is the allowed-set of Triple non-IDL inner serialization
+// codecs. The name key MUST match the SerializeType string the client writes
+// into TripleRequestWrapper.SerializeType / 
TripleResponseWrapper.SerializeType
+// (e.g. "hessian2", "msgpack"). An absent entry is a disabled serialization.
+type innerCodecRegistry struct {
+   items map[string]Codec
+}
+
+var innerCodecs = &innerCodecRegistry{items: make(map[string]Codec)}
+
+// SetInnerCodec registers an inner codec under the given name.
+//
+// SetInnerCodec is init-only: it MUST be called exclusively from package 
init().
+func SetInnerCodec(name string, c Codec) {
+   innerCodecs.items[name] = c
+}

Review Comment:
   `SetInnerCodec` doesn’t validate that `c` is non-nil and that `c.Name()` 
matches the registry key. That can lead to hard-to-trace failures later (e.g., 
`resolveInnerCodec` returns a codec whose `Name()` differs from the request 
`SerializeType`, and `tripleServerCodecSession.Marshal` writes `SerializeType: 
inner.Name()` back on the wire). Consider rejecting nil codecs and enforcing 
`c.Name() == name` (or explicitly documenting/encoding the key rather than 
`inner.Name()`).



##
protocol/triple/triple_protocol/inner_codec.go:
##
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See 

Re: [PR] feat(triple): dispatch non-IDL wrapper decoding by SerializeType [dubbo-go]

2026-07-27 Thread via GitHub


zouyx commented on code in PR #3550:
URL: https://github.com/apache/dubbo-go/pull/3550#discussion_r3659206962


##
protocol/triple/triple_protocol/inner_codec.go:
##
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package triple_protocol
+
+import (
+   "fmt"
+)
+
+// innerCodecRegistry is the allowed-set of Triple non-IDL inner serialization
+// codecs. The name key MUST match the SerializeType string the client writes
+// into TripleRequestWrapper.SerializeType / 
TripleResponseWrapper.SerializeType
+// (e.g. "hessian2", "msgpack"). An absent entry is a disabled serialization.
+type innerCodecRegistry struct {
+   items map[string]Codec
+}
+
+var innerCodecs = &innerCodecRegistry{items: make(map[string]Codec)}
+
+// SetInnerCodec registers an inner codec under the given name.
+//
+// SetInnerCodec is init-only: it MUST be called exclusively from package 
init().
+func SetInnerCodec(name string, c Codec) {

Review Comment:
   根据这个注释所说的内容,需要写成 public 方法吗?



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



Re: [PR] feat(triple): dispatch non-IDL wrapper decoding by SerializeType [dubbo-go]

2026-07-27 Thread via GitHub


sonarqubecloud[bot] commented on PR #3550:
URL: https://github.com/apache/dubbo-go/pull/3550#issuecomment-5089465321

   ## [![Quality Gate 
Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png
 'Quality Gate 
Passed')](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3550) 
**Quality Gate passed**  
   Issues  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [1 New 
issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3550&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png
 '') [0 Accepted 
issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3550&issueStatuses=ACCEPTED)
   
   Measures  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3550&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0.0% Coverage on New 
Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3550&metric=new_coverage&view=list)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0.0% Duplication on New 
Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3550&metric=new_duplicated_lines_density&view=list)
  
 
   
   [See analysis details on SonarQube 
Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3550)
   
   


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



Re: [PR] feat(triple): dispatch non-IDL wrapper decoding by SerializeType [dubbo-go]

2026-07-26 Thread via GitHub


codecov-commenter commented on PR #3550:
URL: https://github.com/apache/dubbo-go/pull/3550#issuecomment-5087717368

   ## 
[Codecov](https://app.codecov.io/gh/apache/dubbo-go/pull/3550?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   :x: Patch coverage is `74.68354%` with `20 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 55.29%. Comparing base 
([`53d81d1`](https://app.codecov.io/gh/apache/dubbo-go/commit/53d81d17c0f658b7151fb8c44f0d80371ef047e7?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`b3f25d9`](https://app.codecov.io/gh/apache/dubbo-go/commit/b3f25d926312fa3d998c381dfbb286c57d41483f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/dubbo-go/pull/3550?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[protocol/triple/triple\_protocol/codec.go](https://app.codecov.io/gh/apache/dubbo-go/pull/3550?src=pr&el=tree&filepath=protocol%2Ftriple%2Ftriple_protocol%2Fcodec.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHJvdG9jb2wvdHJpcGxlL3RyaXBsZV9wcm90b2NvbC9jb2RlYy5nbw==)
 | 61.22% | [13 Missing and 6 partials :warning: 
](https://app.codecov.io/gh/apache/dubbo-go/pull/3550?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   | 
[protocol/triple/triple\_protocol/protocol\_triple.go](https://app.codecov.io/gh/apache/dubbo-go/pull/3550?src=pr&el=tree&filepath=protocol%2Ftriple%2Ftriple_protocol%2Fprotocol_triple.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHJvdG9jb2wvdHJpcGxlL3RyaXBsZV9wcm90b2NvbC9wcm90b2NvbF90cmlwbGUuZ28=)
 | 88.88% | [1 Missing :warning: 
](https://app.codecov.io/gh/apache/dubbo-go/pull/3550?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   
   Additional details and impacted files
   
   
   
   ```diff
   @@ Coverage Diff @@
   ##   develop#3550  +/-   ##
   ===
   + Coverage55.23%   55.29%   +0.06% 
   ===
 Files  462  463   +1 
 Lines3600536038  +33 
   ===
   + Hits 1988619927  +41 
   + Misses   1456214556   -6 
   + Partials  1557 1555   -2 
   ```
   
   
   [:umbrella: View full report in Codecov by 
Harness](https://app.codecov.io/gh/apache/dubbo-go/pull/3550?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   
   :loudspeaker: Have feedback on the report? [Share it 
here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:rocket: New features to boost your workflow: 
   
   - :snowflake: [Test 
Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, 
report on failures, and find test suite problems.
   


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



Re: [PR] feat(triple): dispatch non-IDL wrapper decoding by SerializeType [dubbo-go]

2026-07-26 Thread via GitHub


sonarqubecloud[bot] commented on PR #3550:
URL: https://github.com/apache/dubbo-go/pull/3550#issuecomment-5087698841

   ## [![Quality Gate 
Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png
 'Quality Gate 
Passed')](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3550) 
**Quality Gate passed**  
   Issues  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [1 New 
issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3550&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png
 '') [0 Accepted 
issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3550&issueStatuses=ACCEPTED)
   
   Measures  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3550&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0.0% Coverage on New 
Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3550&metric=new_coverage&view=list)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0.0% Duplication on New 
Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3550&metric=new_duplicated_lines_density&view=list)
  
 
   
   [See analysis details on SonarQube 
Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3550)
   
   


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