返回 Bug 清单
BUG-0795project-10高已修复test-flaky

CORS preflight exempt + WsHub dependency injection + websocket metrics isolation

发现:2026-10-09验证:2026-10-09置信度:70%

症状

commit da6aedeaba6f (2026-09-17) fix(phase4): CORS preflight exempt + WsHub dependency injection + websocket metrics isolation

根因

commit message 描述: fix(phase4): CORS preflight exempt + WsHub dependency injection + websocket metrics isolation

修复方案

修复 131 行,删除 47 行。改动文件: gateway/api-gateway/src/lib.rs, gateway/api-gateway/src/main.rs, gateway/api-gateway/tests/integration.rs, gateway/auth/src/lib.rs, gateway/websocket/src/lib.rs

错误签名

fix(phase4): CORS preflight exempt + WsHub dependency injection + websocket metrics isolation CORS preflight bug (浏览器不能用 API):
- auth_middleware 加 OPTIONS + Access-Control-Request-Method 联合豁免
- T1 CORS preflight 重新启用 → 200 + ACAO header
- T1b 防御测试: OPTIONS 不是 preflight → 仍需 auth

WsHub 依赖注入(干掉 static singleton anti-pattern):
- ws_handler 新签名: State(Arc<WsHub>) + WebSocketUpgrade
- ws_handler_global 旧入口保留(deprecated)
- handle_command 参数从 WsHub 改 Arc<WsHub>
- GatewayState 加 ws_hub: Arc<WsHub> 字段
-

技术信息

来源项目

project-10

涉及文件

gateway/api-gateway/src/lib.rs, gateway/api-gateway/src/main.rs, gateway/api-gateway/tests/integration.rs +3

标签

git-sweep, auto-ingested, project-10, mcp-reported, source-agent