test: 补齐所有命令的标志注册测试,堵住系统性漏洞#38
Merged
Merged
Conversation
bigmanBass666
force-pushed
the
fix/flag-registration-tests
branch
from
July 16, 2026 19:06
5e759f5 to
ebafbb6
Compare
added 2 commits
July 17, 2026 03:25
审计发现 9 个标志(start/provider/key/config)没有注册测试。 CLAUDE.md 测试规则第 4 条强化为: "每个 init() 中注册的标志必须在对应 *_cmd_test.go 中有 Lookup 测试, 与标志代码在同一个 PR 中加入" 新增测试文件: - start_cmd_test.go: --provider, --all, --log-format - config_cmd_test.go: --path - provider_cmd_test.go: --target, --port, --genai, --cooldown-sec, --max-retries, --default 现在所有 12 个 CLI 标志各有对应的注册测试。
之前"手动验收"项过于笼统("验证了行为"),新增按改动类型 分列的验证命令表,使 AI 无法在模糊描述中跳过验证: | 改动类型 | 验证命令 | |---------|---------| | CLI 标志 | akswitch <cmd> --help | grep <flag> | | CLI 命令 | akswitch <cmd> --help | | 日志格式 | akswitch logs --verbose | | 逻辑修复 | 真实场景验证 |
bigmanBass666
force-pushed
the
fix/flag-registration-tests
branch
from
July 16, 2026 19:26
1e18d9c to
ffce345
Compare
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.
问题
PR #33 合并后
--log-format标志注册行因 CRLF 替换失败丢失,但没有任何测试抓住。审计发现start/provider/key/config共 9 个 CLI 标志没有任何注册测试。修复
CLAUDE.md 规则强化(第 4 条)
补齐测试
start_cmd_test.go--provider,--allconfig_cmd_test.go--pathprovider_cmd_test.go--target,--port,--genai,--cooldown-sec,--max-retries,--default现在全部 12 个 CLI 标志各有对应的注册测试。新增标志必须同 PR 加入对应测试。