mochengqian opened a new issue, #145:
URL: https://github.com/apache/dubbo-go-pixiu-samples/issues/145
**问题描述**:
在 `http/grpc` 样例中,`pixiu/conf.yaml` 的 `dgp.filter.http.grpcproxy`
仍然保留了一个不存在的 descriptor 路径 `samples/http/grpc/pixiu/proto`。仓库实际目录只有
`http/grpc/proto`,所以这是一个配置漂移;目前之所以没有立刻暴露,是因为 `descriptor_source_strategy: auto`
的 fallback 把它掩盖了。
同时,`http/grpc` 的负向路径验收不够严格。`unsupported HTTP method`
这类请求应该被明确拒绝,但在我复现时,`DELETE /api/v1/provider.UserProvider/GetUser` 仍然可能表现为
2xx,说明样例没有把 method 边界约束住。`invalid JSON`、`wrong service prefix`、`unknown path`
这些负向路径也应该有强断言,否则样例很容易在 CI 上“看起来可用,实际边界行为不稳”。
**预期行为**:
- `http/grpc` 的配置不应依赖不存在的 descriptor path。
- 样例应只接受预期的 `GET/POST` 路径语义。
- `invalid JSON`、`unsupported method`、`wrong service prefix`、`unknown path`
这些负向路径应明确返回非 2xx。
- 负向测试不能再接受 `2xx + 空 body` 或 `2xx + parse-error body` 这类错误行为。
**复现步骤**:
```bash
cd dubbo-go-pixiu-samples
# 1. 检查配置漂移
git show HEAD:http/grpc/pixiu/conf.yaml | sed -n '40,44p'
test -d samples/http/grpc/pixiu/proto
test -d http/grpc/proto
# 2. 运行样例测试
go run ./tools/sampletester -sample http/grpc
```
**环境信息**:
- dubbo-go-pixiu-samples:当前基线 `HEAD`
- Go:1.25.0
- 操作系统:macOS
- 复现方式:`sampletester` + 配置路径检查
**关键日志**:
```text
HEAD:http/grpc/pixiu/conf.yaml
descriptor_source_strategy: auto
path: samples/http/grpc/pixiu/proto
test -d samples/http/grpc/pixiu/proto -> false
test -d http/grpc/proto -> true
```
以及收紧负向断言后暴露的回归日志:
```text
=== RUN TestUnsupportedHTTPMethodIsNotSuccess
pixiu_test.go:132:
Error Trace: .../http/grpc/test/pixiu_test.go:132
Error: Should be true
Messages: unsupported HTTP method should not return 2xx
```
**初步分析**:
`descriptor_source_strategy: auto` 下面保留了一个不存在的 file path,这属于样例配置漂移,不应该继续靠
fallback 掩盖。另一方面,`http/grpc` 的测试只覆盖 happy path 不够,应该把 method / path / JSON
边界收紧成明确的非 2xx 断言,否则样例很容易在后续改动里退化。
--
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]