Repository navigation
🐛 fix(chroma): 修复部分版本 v2 无 databases 列表端点导致连接打不开 - #1557
Merged
AutumnNazi merged 1 commit intoOct 21, 2026
Merged
Conversation
部分 Chroma 版本的 v2 只提供 databases 的 POST(创建),对 GET 返回 405, 展开连接时 GetDatabases 直接失败,整个连接都打不开、表概览也无从进入。 给 doJSON 增加携带状态码的 chromaHTTPError,GetDatabases 仅对 405 退回单库模式 (与 v1 分支行为一致);503、网络中断等服务端故障仍向上传播,不把「服务不可用」 伪装成「只有一个库」。
Contributor
变更概览
模型评审未发现缺陷 CI 门禁
门禁已通过。 规约意见不会代替 CI 门禁。这条评论会在后续推送和测试完成后更新。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
部分 Chroma 版本的 v2 只提供 databases 的 POST(创建),对 GET 返回 405 Method Not Allowed:
GetDatabases因此直接失败,展开连接时报错,整个连接都打不开,表概览也无从进入。变更点
chroma_impl_http.go:新增chromaHTTPError,在doJSON的非 2xx 分支携带响应状态码;Error()文案与原实现完全一致,不改变既有错误信息的可读性chroma_impl_db.go:GetDatabases用errors.As取到状态码,仅当 405 时退回单库模式([c.database],与 v1 分支行为一致),并写一条 warn 日志说明降级原因这里刻意不对所有失败降级:仓库已有用例
TestChromaGetDatabasesV2PropagatesHTTPFailure明确要求服务端故障必须传播错误,把「服务不可用」伪装成「只有一个库」属于静默失败。影响范围
GetDatabases,其余 API 调用路径不变验证
新增用例
TestChromaGetDatabasesV2FallsBackWhenListEndpointUnsupported已做反向验证:把判断改成别的状态码后该用例失败,报错与线上一致(Chroma API GET /api/v2/tenants/default_tenant/databases 失败:Method Not Allowed)。go vet -tags gonavi_full_drivers ./internal/db/干净。说明:
./internal/db/全量跑存在 10 个 DuckDB / ClickHouse 存量失败用例,stash 掉本改动后同样失败,与本次修改无关。