-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
No tests cover parseRootCommand or the command-dispatch switch in main() #83879
Copy link
Copy link
Closed
Labels
P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.Low-priority cleanup, docs, polish, ergonomics, or speculative work.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.no-staleExclude from stale automationExclude from stale automation
Description
Metadata
Metadata
Assignees
Labels
P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.Low-priority cleanup, docs, polish, ergonomics, or speculative work.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.no-staleExclude from stale automationExclude from stale automation
Type
Fields
Priority
None yet
Severity: medium / Confidence: high / Category: test-gap
Triage: test-gap
Detected against: openclaw v2026.5.18 (latest stable at time of scan, 2026-05-18)
Tooling: clawpatch 0.3.0 + acpx/claude-sonnet-4-5 via Brad Mills protocol
Evidence
apps/macos/Sources/OpenClawMacCLI/EntryPoint.swift:11-28(OpenClawMacCLI.main)apps/macos/Sources/OpenClawMacCLI/EntryPoint.swift:32-36(parseRootCommand)Reasoning
The five supplied test files target
AgentEventStore,AgentWorkspace,AnyCodable,AppState, andAudioInputDeviceObserver— none touch the CLI entrypoint.parseRootCommandand theswitch command?.namedispatch inmain()are completely untested. Uncovered behaviors include: (1) zero-argument invocation returningniland printing usage; (2) unknown command correctly printing usage and callingexit(1); (3)args.dropFirst()correctly splitting subcommand arguments; (4) case sensitivity —Connectvsconnectfalls through to thedefaultbranch and exits with error, which may surprise users. Theexit(1)path is the only explicit non-zero exit in the file, so regressions in the dispatch table would be invisible.Recommendation
Extract
parseRootCommandto a separate, independently testable file and add unit tests covering: empty args → nil, single-word command with no further args, multi-word command splitting, unknown command, and each help alias. For the dispatch table, add a test that exercises the exit path for an unknown command and verifies the exit code is 1.Why existing tests miss this
There is no test file for
EntryPoint.swiftorOpenClawMacCLI. The adjacent test suite (OpenClawIPCTests) targets IPC and app-state components, not the CLI dispatch layer.Suggested regression test
struct ParseRootCommandTests { @test func
nil when no args() { #expect(parseRootCommand([]) == nil) } @test funcsplits subcommand and args() { let cmd = parseRootCommand(["connect", "--json"]); #expect(cmd?.name == "connect"); #expect(cmd?.args == ["--json"]) } @test funcunknown command exits non-zero() { ... spawn process with unknown subcommand, assert exit code == 1 } }Minimum fix scope
Move
parseRootCommandto a non-privatefunction (or internal module function) so it is accessible from tests, and add a newOpenClawMacCLITests.swifttest file covering the cases above.Standardized clawpatch finding. Persistent in v2026.5.18 (not resolved by upgrading from v2026.5.12). Finding ID:
fnd_sig-feat-cli-command-035db88068-_5c2e6185ed.