refactor(hub): 拆分 agent_team 仓储并下沉 SafeGo,清偿 lint 欠账 - #1670
Conversation
三块低风险结构拆解,零行为变化:
1. repository/agent_team.go(564 行、49 个声明)按聚合拆为 7 个文件:
teams / runs / assignments / tasks / artifacts / events / usage。
纯文件切分,声明对账 49/49 无丢失无重复。
2. middleware.SafeGo 下沉到 internal/safego 叶子包:解除 service 层
(agent_dispatch)对 HTTP 中间件包的依赖,service 目录现已不再
import middleware。新增 safego 冒烟测试(panic 恢复路径此前无直接
覆盖)。
3. 清偿 lint 欠账(ratchet 由 fail 转 PASS,43 findings 全部
baseline 注册):
- 修复 5 处 QF1008(Dialector 嵌入选择器):agent_team_usage /
audit / agent / message 两处——其中 audit/message 是拆分后从
max-same-issues 封顶下浮出的存量 findings
- 重命名 client_auth_test.go 测试夹具常量 tokenHash → blacklistKey,
消除 3 处 G101 硬编码凭据误报
验证:go build/vet/staticcheck 全绿;go test ./... -short -race 通过;
verify-hub-layering / verify-hub-pure-packages / outbound-client-hygiene /
dto-contract / openapi-contract / config-domain-ssot / hub-lint-ratchet
全部 PASS。
Co-authored-by: Cursor <cursor@vectorcontrol.tech>
|
Warning Review limit reached
Next review available in: 104 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (16)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
hub-server 三块低风险结构拆解(探查报告中 hub Top 4/8 项),零行为变化:
repository/agent_team.go564 行 → 7 个聚合文件:agent_team_teams/runs/assignments/tasks/artifacts/events/usage.go。纯文件切分,声明级脚本迁移 + 49/49 对账,无丢失无重复。middleware.SafeGo下沉internal/safego叶子包:解除 service 层(agent_dispatch)对 HTTP 中间件包的依赖——internal/service/现已完全不再 importmiddleware(探查报告中的分层违规 Top 8)。补 2 个 panic 恢复冒烟测试(此前无直接覆盖)。max-same-issues封顶下浮出的存量 findings(master 上被 agent_team.go 的同类 findings 遮蔽)client_auth_test.go夹具常量tokenHash→blacklistKey,消除 3 处 G101 误报(master 上 ratchet 已红,本 PR 顺带还清)Test plan
go build/go vet/ staticcheck 全绿go test ./... -count=1 -short -race -coverprofile通过(CI 同款)verify-hub-layering/verify-hub-pure-packages/verify-outbound-client-hygiene/verify-dto-contract/verify-openapi-contract/verify-config-domain-ssot/verify-hub-lint-ratchet全部 PASS后续队列
service/agent_dispatch.go8 文件散装 →dispatchsvc包收敛(hub Top 1)app/events.gopending 重放下沉(hub Top 2)ws类型上渗治理(hub Top 3)