internal/core/router
RouteSnapshot
GORMRepository.ActiveSnapshot
base_url
route_not_configured
route_unavailable
go test -race -count=1 ./internal/core/router
CHORUS_TEST_DSN
go build ./...
go vet ./...
go test -count=1 ./...
python dev_scripts/harness.py check --strict
python -m unittest discover -s tests -v
9b2827a
main
在 internal/core 和相应 repository 边界实现能力匹配、活动路由快照、正权重无放回候选、max_failover、稳定错误码、retryable 分类和数据库熔断 runtime 契约。
不实现具体 Provider HTTP 协议、管理 API/UI、portal 页面或真实探测。
internal/core 不得 import gin 或 go-admin,只依赖 GORM/标准库。候选仅来自启用、能力匹配、未熔断成员;同一 ProviderModel 在单个 generation 至多一次。429/5xx/超时/连接错误换家;400/401/内容策略立即返回,401 同时打开后续任务避开该成员的 circuit。数据库 runtime 负责跨 worker 排除,gobreaker 仅作进程内快速保护。
failover_exhausted
9b2827a727da31d75d2013bae74bff12f4d0f8e7
1b86d4431eac6e73dcb293f5ba81208127dae040
docs/task/
No dependencies set.
The note is not visible to the blocked user.
基本信息
原始需求
实施记录(2026-08-21)
internal/core/router:能力映射、无密钥RouteSnapshot编码与 generation 字段写入、加权无放回候选、最大故障转移、稳定路由错误码和 retryable 行为。GORMRepository.ActiveSnapshot:按活动绑定、路由池、模板、启用成员与显式能力查询;它不选择 Providerbase_url、API Key 或密文。无绑定返回route_not_configured,无可用成员返回route_unavailable。go test -race -count=1 ./internal/core/router;隔离 MySQL 8 的CHORUS_TEST_DSN路由快照测试;go build ./...、go vet ./...、go test -count=1 ./...、python dev_scripts/harness.py check --strict、python -m unittest discover -s tests -v(42 项)。9b2827a,已推送至main。文档影响
交付文档影响
变更控制
依赖与并行
目标与范围
在 internal/core 和相应 repository 边界实现能力匹配、活动路由快照、正权重无放回候选、max_failover、稳定错误码、retryable 分类和数据库熔断 runtime 契约。
不实现具体 Provider HTTP 协议、管理 API/UI、portal 页面或真实探测。
已确认方案
internal/core 不得 import gin 或 go-admin,只依赖 GORM/标准库。候选仅来自启用、能力匹配、未熔断成员;同一 ProviderModel 在单个 generation 至多一次。429/5xx/超时/连接错误换家;400/401/内容策略立即返回,401 同时打开后续任务避开该成员的 circuit。数据库 runtime 负责跨 worker 排除,gobreaker 仅作进程内快速保护。
验收标准
route_not_configured、route_unavailable、failover_exhausted和 retryable 红线稳定且脱敏。验证
用户验收(2026-08-21)
9b2827a727da31d75d2013bae74bff12f4d0f8e7,已推送至main。1b86d4431eac6e73dcb293f5ba81208127dae040;未导出docs/task/。