Repository navigation
test(cli): keep parser coverage without formatter self-comparison - #133771
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 12:06 AM ET / 04:06 UTC. ClawSweeper reviewWhat this changesThis PR replaces a CLI inventory test’s synthetic JSON formatter self-comparison with a check that every command declaring its own Merge readinessKeep open. No blocking finding: the change correctly limits this inventory test to Commander parser acceptance, while OpenClaw’s real entrypoints and dedicated tests retain JSON failure-envelope coverage; current main still has the self-comparison this PR removes. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw’s CLI registers Commander command trees, then its top-level entrypoint parses a selected command and formats failures for terminal or JSON output. This test enumerates the registered tree to guard the declared parser options without becoming the failure-output owner. flowchart LR
Registry[Command registry] --> Tree[Registered command tree]
Tree --> Parser[Commander parser]
Parser --> Action[Injected test action]
Entry[CLI entrypoint] --> Formatter[JSON failure formatter]
Formatter --> Output[Terminal or JSON output]
Before merge
Agent review detailsSecurityNone. PR surfaceTests -17. Total -17 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Land the focused test refactor while retaining the dedicated formatter, parse-error, and real-entrypoint failure tests as the canonical JSON-output coverage. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a test-only PR. Source inspection establishes the intended parser and formatter boundaries; no reported end-user failure needs reproduction. Is this the best way to solve the issue? Yes. The parser inventory now proves the contract it can independently observe, while the real CLI entrypoint and dedicated failure-output tests continue to own JSON failure behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 607821e11d1d. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
The registered-command test replaced real actions with synthetic failures, injected its own JSON formatter, then compared that formatter with itself. It could verify parser acceptance but could not independently detect broken JSON failure output.
Why This Change Was Made
Keep real command registration and declared output-flag parsing, and assert that each parser reaches the original synthetic failure. Remove the injected formatter/runtime and name the test for the parser contract it actually checks. Simplify the adjacent required-argument fixture's identical variadic and nonvariadic branches.
User Impact
No CLI behavior or JSON schema changes. The preceding inventory still checks route-first JSON support. Independent literal formatter/redaction assertions, asynchronous exit-finalization tests, and real entrypoint process tests for routed and Commander failures remain.
Evidence
Direct Commander source confirms that replacing action handlers bypasses the original commands, and the retained throw preserves hook ordering. The real CLI entrypoints own JSON error output; their callbacks and existing process assertions were inspected. No test execution is removed.
All 58 focused tests passed before and after across command registration/parsing, literal failure formatting, and one-shot exit behavior. Codex autoreview found no accepted actionable findings. The changed-file gate passed, including dead-export scans, core-test typechecking, formatting, lint, and repository guards. Tests +5/-22 lines (net -17); production and test support unchanged.