open-code-review icon indicating copy to clipboard operation
open-code-review copied to clipboard

refactor(test): unify config compat helpers to use cobra subcommand tree

Open DoTuanAnh2k1 opened this issue 4 months ago • 2 comments

runConfig and parseConfigArgs in compat_test.go still did manual arg slicing and hand-written subcommand dispatch, while the other compat helpers (runSession, parseReviewFlags, parseScanFlags) were already migrated to cobra in #625. That duplicated the routing the production config command defines with cobra, so the two could drift.

This rebuilds runConfig as a fresh cobra tree that mirrors the production command (set = ExactArgs(2), unset = ExactArgs(1), provider/model = NoArgs), matching the runSession pattern, and drops parseConfigArgs, configAction, and configParseError, which are then unused.

The parseConfigArgs unit tests are removed along with the helper; the same dispatch behavior (unknown subcommand, missing args, provider/model with args, empty args) is already covered by the runConfig tests in config_dispatch_test.go and config_cmd_test.go. Behavior is unchanged and the full suite passes. go test ./... and make check pass.

Closes #638


Disclosure: prepared with AI assistance.

DoTuanAnh2k1 avatar Jul 31 '26 15:07 DoTuanAnh2k1

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jul 31 '26 15:07 CLAassistant

✅ OpenCodeReview: No supported files changed.

github-actions[bot] avatar Jul 31 '26 18:07 github-actions[bot]