openclaw - 💡(How to fix) Fix No tests for `takeCliRootOptionValue` — key parsing logic unverified [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#83884Fetched 2026-05-20 03:47:38
View on GitHub
Comments
1
Participants
2
Timeline
8
Reactions
1
Timeline (top)
labeled ×5commented ×1mentioned ×1subscribed ×1

Fix Action

Fix / Workaround

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


Standardized clawpatch finding. Persistent in v2026.5.18 (not resolved by upgrading from v2026.5.12). Finding ID: fnd_sig-feat-cli-command-0c37e1d71a-_be9d4df4fb.

Code Example

export function takeCliRootOptionValue(
  raw: string,
  next: string | undefined,
): { value: string | null; consumedNext: boolean }
RAW_BUFFERClick to expand / collapse

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

  • src/cli/root-option-value.ts:1-20 (takeCliRootOptionValue)
export function takeCliRootOptionValue(
  raw: string,
  next: string | undefined,
): { value: string | null; consumedNext: boolean }

Reasoning

takeCliRootOptionValue is the sole entry point for parsing root-level CLI option tokens (e.g. --flag=value, --flag value, --flag with no value). It has three distinct branches (equals form, value-token next, empty), edge cases around trimming and empty strings, and—as noted above—a truncation bug with embedded =. No test files are listed for it. Regressions in this function directly affect all root option parsing across the entire CLI.

Recommendation

Add a colocated src/cli/root-option-value.test.ts covering: equals-form with simple value; equals-form with embedded =; equals-form with empty value; next-token form where isValueToken returns true; next-token form where it returns false; undefined next.

Why existing tests miss this

No test files are associated with this feature in the provided listing; the function's narrow, utility nature may have led maintainers to skip direct coverage in favour of integration-level CLI tests.

Suggested regression test

import { takeCliRootOptionValue } from './root-option-value'; describe('takeCliRootOptionValue', () => { it('preserves value after second =', () => { expect(takeCliRootOptionValue('--opt=abc=def', undefined)).toEqual({ value: 'abc=def', consumedNext: false }); }); });

Minimum fix scope

New test file src/cli/root-option-value.test.ts with unit cases for all branches.


Standardized clawpatch finding. Persistent in v2026.5.18 (not resolved by upgrading from v2026.5.12). Finding ID: fnd_sig-feat-cli-command-0c37e1d71a-_be9d4df4fb.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix No tests for `takeCliRootOptionValue` — key parsing logic unverified [1 comments, 2 participants]