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


##########
protocol/triple/triple_protocol/handler_stream_test.go:
##########
@@ -0,0 +1,158 @@
+/*
+ * 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 (
+       "errors"
+       "io"
+       "net/http"
+       "testing"
+)
+
+import (
+       
"dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol/internal/assert"
+       pingv1 
"dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol/internal/gen/proto/connect/ping/v1"
+)

Review Comment:
   This file has two separate import blocks. `gofmt` typically consolidates 
these into a single import block with a blank line between stdlib and module 
imports, which keeps formatting consistent across the repo.



##########
protocol/triple/triple_protocol/client_stream.go:
##########
@@ -72,7 +72,8 @@ func (c *ClientStreamForClient) Send(request any) error {
 }
 
 // CloseAndReceive closes the send side of the stream and waits for the
-// response.
+// response. If closing the send side or receiving the response fails, the
+// receive side is closed before the error is returned.

Review Comment:
   The doc comment says the receive side "is closed" before returning an error, 
but the implementation ignores any error returned by CloseResponse. To avoid 
overstating the guarantee, consider wording this as a best-effort close (i.e., 
CloseResponse is called before returning).



##########
protocol/triple/triple_protocol/client_stream_test.go:
##########
@@ -107,3 +108,197 @@ type nopStreamingClientConn struct {
 func (c *nopStreamingClientConn) Receive(msg any) error {
        return nil
 }
+
+// stubStreamingClientConn is a configurable StreamingClientConn used to
+// exercise close paths, error propagation and empty metadata without
+// involving a real transport.
+type stubStreamingClientConn struct {
+       StreamingClientConn
+
+       sendErr      error
+       receiveErr   error
+       closeReqErr  error
+       closeRespErr error
+       requestHdr   http.Header
+       responseHdr  http.Header
+       responseTrlr http.Header
+
+       sendCalls      int
+       receiveCalls   int
+       closeReqCalls  int
+       closeRespCalls int
+}
+
+func (c *stubStreamingClientConn) Send(any) error {

Review Comment:
   `stubStreamingClientConn` embeds `StreamingClientConn`, so any promoted 
methods that aren’t explicitly overridden (e.g., `Spec()` / `Peer()`) will call 
through a nil embedded interface and panic if they’re ever used. Since this 
stub is assigned to a `StreamingClientConn`, it’s safer to implement `Spec` and 
`Peer` directly on the stub.



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