Repository navigation
Conversation
Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>
Collaborator
Author
|
补测试(自动巡检,head 为什么补:原有的 补了什么:新增
本地验证(Go 1.26.11):
只加了测试文件,没改实现和已有测试。CI 里之前失败的 |
fx-kurumi
commented
Nov 14, 2026
fx-kurumi
left a comment
Collaborator
Author
There was a problem hiding this comment.
审查 head 1a2ebbea(含补测提交 1a2ebbe):通过(本账号创建的 PR,只能用 Comment 提交,结论等同 Approve)。
internal/repo/users.go:updatedSecret(current, value, clear)的优先级(清空优先 → 空白保留原值 → 其余去空白后覆盖)与原来四处 if/else 一致;CodeBuddy / Codex / Claude Code 三个字段和applyAgentCLICredentialUpdates里的cred.APIKey都传了各自的值与清空标志,没有串字段。Cursor 判断换 key 用的previousKey仍在赋值前取,行为不变。- 补测评论核对:新增的
TestUpdateUserCredentialsSecretWiring逐字段验证「只改一个、其余不动」和「同字段清空优先」,同时校验返回值和落库值,能钉住参数接错的情况,与评论里的变异分析对得上。 - 本地
go test ./internal/repo/通过。CIcore/browser审查时仍在跑,合并前请等它们变绿。
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.
Closes #767
改了什么
internal/repo/users.go:新增包内函数updatedSecret(current, value string, clear bool) string,集中表达凭据表单的密钥更新规则(清空优先;空白输入保持原值;否则用去掉首尾空白的新值覆盖)。UpdateUserCredentials中 CodeBuddy / Codex / Claude Code 三个 API Key,以及applyAgentCLICredentialUpdates中各 Agent CLI 凭据的APIKey,共 4 处重复的if clear {…} else if trimmed != "" {…}改为一行调用。internal/repo/users_updated_secret_test.go:表驱动覆盖清空、清空优先于新值、空/空白输入保持原值、去空白覆盖、空值时填入。为什么
同一条规则散落 4 处,后续新增凭据或调整规则时容易漏改;合并后
UpdateUserCredentials短了 12 行,读起来更集中在「改了哪些字段」上。影响范围
仅
internal/repo/users.go内部实现;对外接口、JSON 字段、存储与报错均不变(Cursor 换 key 时清空模型目录的判断仍基于previousKey,行为一致)。怎么验证的
gofmt -l internal/repo/:无输出go vet ./internal/repo/:通过go test ./internal/repo/:ok agentflow/internal/repo 5.259sTestUpdatedSecret、TestAgentCLICredentialsRoundTrip、TestProviderUserCredentials均 PASS🤖 Generated with Claude Code