fix(cli): correct three refusals from #5008

Merged
IM
5d ago
+111-30

Summary

Follow-up to #5008, from its review:

  • An int flag refusal said Expected integer, but the parser floors any number in range (open --timeout 1.5 runs with 1). It now says Expected number >= 1 (rounded down to an integer); accepted values do not change. Env and config refusals still say integer, since they refuse a fraction.
  • gesture drag read "," and "170," as coordinates, because an empty segment became 0. Such endpoints now reach the selector checks.
  • The daemon's fill decoder answered every decode error with a generic message. Fill positionals sent straight to the daemon now get the CLI's refusal: its message, hint and details.reason fill_target_missing. A --text-stdin or --record-as fill keeps the reason, with a message that does not echo its positionals. Untyped decode failures keep the generic response.

Before / after

Base aecafaf30, head d3228751f. Output of the CLI parser, the drag payload reader and selector parser, and the daemon fill decoder:

$ open com.example.app --timeout 0.5
base: Invalid timeout: 0.5. Expected integer >= 1.
head: Invalid timeout: 0.5. Expected number >= 1 (rounded down to an integer).
$ gesture drag "170," @e2
base: drag_endpoint_is_coordinates: gesture drag takes a @ref or selector for source and destination, not coordinates: "170,".
head: Invalid selector term "170,", expected key=value
$ fill 136849        # positionals sent straight to the daemon
base: fill requires x y text, @ref text, or selector text   (no reason)
head: fill_target_missing: fill needs <target> <text> but got one value, "136849". If a ref variable expanded to nothing, ...

Validation

  • Head d3228751f, check:affected --run --head, exactCommit: true: format, lint, typecheck, layering, fallow, build and vitest-related (441 tests) pass.
  • New tests cover --timeout 1.5 staying accepted and floored, ",", "170," and "170 , " drag endpoints, and fill with only its text through the daemon interaction handler, with and without --text-stdin/--record-as. Each fails with its fix reverted.
  • The fill_target_missing row in error-reasons.md stays put: scripts/reasons/generate.ts orders rows by table file path, then line.

Proof this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.