Aias00 opened a new pull request, #980:
URL: https://github.com/apache/dubbo-go-pixiu/pull/980

   ## 动机
   
   生产代码中存在大量 `panic("implement me")` 
占位符,一旦未实现的代码路径被触发,会导致整个网关进程崩溃。这是最高优先级的生产稳定性问题。
   
   ## 改动
   
   ### 生产代码(12 处 panic → 安全返回)
   
   | 文件 | 方法 | 改动 |
   |---|---|---|
   | `admin/dao/impl/guest.go` | `CheckLogin()` | 无操作 + TODO 注释 |
   | `pkg/cmd/gateway.go` | `DefaultDeployer.stop()` | → `return 
fmt.Errorf("stop: not implemented")` |
   | `pkg/adapter/springcloud/.../nacos.go` | `Register()` / `UnRegister()` / 
`StartPeriodicalRefresh()` | → `return fmt.Errorf(...)` |
   | `pkg/adapter/springcloud/.../nacos.go` | `Get(s string)` | → `return 
nil`(零值安全) |
   | `pkg/adapter/dubboregistry/.../application_service_listener.go` | 
`WatchAndHandle()` | → `logger.Warnf(...)` |
   | `pkg/adapter/dubboregistry/.../service_listener.go` | `WatchAndHandle()` | 
→ `logger.Warnf(...)` |
   | `pkg/adapter/dubboregistry/.../registry.go` | `DoUnsubscribe()` | → 
`return errors.New(...)` |
   | `pkg/client/triple/triple.go` | `Apply()` / `MapParams()` | → `return 
errors.New(...)`(已标记 Deprecated) |
   | `pkg/client/mq/mq.go` | `Apply()` | → `return perrors.New(...)` |
   
   ### EmptyNetworkFilter(8 处 panic → 安全返回)
   
   | 方法 | 改动 |
   |---|---|
   | `OnDecode` / `OnEncode` / `OnData` / `OnTripleData` / `OnUnaryRPC` | → 
`return nil/0, errors.New(...)` |
   | `OnStreamRPC` | → `return errors.New(...)` |
   | `ServeHTTP` | → `stdHttp.Error(w, ..., 501)` |
   | `Close` | → `return nil`(安全无操作) |
   
   ### 测试 Mock(19 处 panic → no-op / 错误返回)
   
   - `baseregistry_test.go`: 3 处 → 无操作或 `return nil`
   - `client_test.go`: 13 处 → 描述性错误或零值返回
   
   ## 改动原则
   
   - **有 error 返回值的方法** → 返回描述性 error,调用方可 `if err != nil` 处理
   - **无返回值的方法(void)** → 记日志或无操作,绝不崩溃
   - **`EmptyNetworkFilter`** → 返回零值 + error;`ServeHTTP` 返回 HTTP 501;`Close` 
安全返回 nil
   - **测试 mock** → 返回零值,避免意外调用时崩溃
   
   ## 验证
   
   - `go build ./...` ✅
   - `go vet ./...` ✅
   - `go test ./pkg/adapter/llmregistry/... ./pkg/adapter/mcpserver/...` ✅
   
   🤖 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: [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