Skip to content

fix: sweep round 4: --text, exit codes by kind, one error shape, help that names vf, tables that fit, deletes that ask - #58

Open
Bradenream wants to merge 30 commits into
braden/sweep-p0from
braden/sweep-r4
Open

Bradenream wants to merge 30 commits into
braden/sweep-p0from
braden/sweep-r4

Conversation

@Bradenream

Copy link
Copy Markdown
Contributor

Stacked on #57. Fixes the CLI-owned majors from the round-3 usability sweep (105 unique issues, 41 major). Each fix is its own commit with tests that fail without it. Numbers below are the round-3 issue numbers.

Conversation

Errors and exit codes

Help

Output and scripting

Safety

Integration notes

Testing

  • Per commit: build, gofmt, scripts/vet.sh, go test ./..., TS suite (180 tests at the tip), go.mod unchanged.
  • Round 4 of the usability sweep ran against a build of this branch merged with the other open PRs. Its fix-verifier found 20 of 27 fixes holding fully and 7 partly, with none broken; the partial ones go into the next batch. Three problems it found in this batch are fixed here: the error() exit code, the hint for a positional ID, and form kinds renamed in help.

A turn printed every trace the runtime made: blocks, debug messages
carrying each tool's whole JSON schema, token accounting. One "hi"
printed 320 to 580 lines, with the agent's one-line reply two-thirds of
the way down. Four of the round-3 sweep's testers hit it, people and
agents alike, and dug the reply out with a --jq filter or by scrolling.

Pretty output now shows the turn as a chat reads: the agent's messages,
its buttons and cards as "[buttons: Yes | No]" and "[card: …]" (the
form run-script's digest uses), and whether the conversation ended.
The other traces are counted on one line. TOON, agent mode's default,
leads with the same replies under `agent`, then `ended`,
`needsRecompile` and the count. --show-debug adds the full traces
after the reply. -o json, --jq, YAML and table still print the response
as the API sent it, since scripts read those.

run-script needed nothing: its answer is already a digest of turns.
There was no plain way to talk to the agent. --action takes only JSON,
in one of fifteen request shapes, and its help shows a type union. The
form asked for the user ID and the version but never for the message,
then failed with "needs --action". The help's only example ended a
conversation. The round-3 sweep's newcomer couldn't send a message
without guessing {"type":"text","payload":"…"}.

--text "<message>" now sends exactly that, and can't be combined with
--action, which stays for every other action. At a terminal, when
nothing says what to send (no --text, --action or --body), the form asks
for the message with the other fields. Without one, the error offers
--text first. The help's first example sends typed words, the second a
launch.
…name their form

The help's example, --action '{"type":"end"}', failed every time with a
230 to 310-line error. Two things were wrong. The API wants
{"type":"end","payload":{"reason":"…"}}, though its spec says the
payload is optional. And the SDK read the bare action as a path request,
so vf sent {"type":"end","payload":{"label":""}}. Ending a conversation
matters: an evaluation runs only on a transcript that has ended. Three of
the round-3 sweep's testers hit it.

An end action without a reason now gets "Ended with vf conversation
send" (the API takes any reason) and goes out as an end action, from
--action, --body or stdin alike. The help's end example gives a reason.

The API's 422 for an action lists all fifteen forms' complaints, and only
the one whose type matched says what's wrong: a person saw "action:
Invalid input", an agent 300 lines of JSON. vf now keeps that form's
complaints, with full paths: "action.payload.reason: Invalid input for
type "end": expected string, …". An action whose type matches no form
gets one line naming the types there are.
Deletes never confirmed. `project delete`, `secret delete`, `environment
delete` and the 31 other delete commands sent their request at once, so
one Enter on the wrong picker row deleted an environment that was serving
traffic. The round-3 sweep's power user and release manager both hit it.

Every command named delete or delete-* now asks first, after the pickers
have filled its flags and before its request leaves:

  Delete environment "Production" (main)?
  This can't be undone.
    Yes   No

No is chosen, so Enter keeps it. It names the thing by the name a picker
showed or the home prompt knows, and by its ID otherwise. No, or Ctrl-C,
sends nothing and says "Canceled".

It asks only when a person can answer: stdin and stderr are a terminal,
agent mode is off and --no-interactive isn't set. Scripts, CI, agents and
pipes run as before, and --dry-run never asks. Each delete takes
-y/--yes to skip the question; -y is free on all 34 today, and a command
that uses it already gets --yes alone.

The deletes are found by name at startup (confirm.go), and the question
is asked from the HTTP client just before the first request that isn't a
read (client/confirm.go), so no generated command changes. --usage lists
--yes as well, which needed a fix in usage.AddFlags: it dropped a flag
line any sibling already had, so only the first delete at each depth got
it.
`vf environment merge` made the source's live version live on Main, for
all of Main's traffic, with no question asked. Its help said only "Merge
one environment into another.", which to a git user changes a branch.
The round-3 sweep's release manager merged Staging and found Main already
answering with Staging's behaviour.

The help now says what the API spec says: the target, normally main,
switches to the source's live version at once, with no publish step; it
takes what the source last published, not its draft; anything published
to the target since the source was cloned is replaced; and the previous
version stays in the target's history.

At a terminal it asks first, as deletes now do, naming both ends:

  Merge staging into main?
  staging's live version goes live on main now, for all of main's
  traffic. Its draft isn't included. Then staging is deleted.

The aliases come from the request being sent, so --body counts, and the
last sentence shows only with --remove-source-environment. -y/--yes
skips the question; scripts, CI, agents, pipes and --dry-run never see
it.
Every --jq result printed as JSON, so a string kept its quotes.
`ID=$(vf test create … --jq .test.id)` captured the quotes too, and the
next call failed with `No test exists with ID "\"6b0d…\""`. Multi-line
text came out on one line with \n escapes. Four of the round-3 sweep's
testers hit it; each script needed `| jq -r .`, the extra tool --jq is
meant to replace. --jq also ignored -o without saying so.

A string result now prints raw, one per line. An object, an array, a
number, a boolean or null still prints as JSON, and `| tojson` keeps a
string quoted. It is the same in agent mode, under every -o, and for
`vf docs search`. --jq's help, in --help and in --usage, now says how it
prints and that it overrides -o; so does the README.
A filter that parses can still fail on the data: `.variable.id.foo` on
a string. On `variable create` that exited 1 with `error_type: "error"`
and a bare "jq error: expected an object but got: string", after the
variable had been created. Nothing said so, and the response was gone.
An agent reads exit 1 as "nothing happened" and runs it again, which
gets a 409, or makes a second test or document. Found by the round-3
sweep's agent-errors tester.

Now the error says the request succeeded and, for a command that makes
or changes something, not to run it again. It gives the response's id,
or the response itself when there is no id. In agent mode the envelope
has `error_type: "jq_error"`, `request_succeeded`, `id` and `response`.
The command still exits non-zero, since the asked-for output wasn't
printed.

A filter that can't parse or compile was already refused before the
command's own request (413553b), but after forms, pickers and a draft's
compile, and `vf docs search` never checked. The root command now checks
it before any command runs, and `create-suite --wait` reuses that check
instead of keeping its own copy.
The table printer read columns off the Go structs. A list whose items
are one of several kinds is a Speakeasy union, a struct with a pointer
per kind, so `tool list`, `conversation send` and `test run get` printed
its wrapper fields, `UNKNOWNRAW  TYPE`, with no ID, no text and no log.
A field that is an object was skipped, so `document list` showed only
ID and FOLDERID: the name and type are under "data", the status under
"status". A time is a Go struct too, so CREATEDAT never appeared. Four
of the round-3 sweep's testers hit it.

The table is now built from the response's JSON, as -o json prints it,
so a union is the kind the API returned. Its columns are every row's
plain fields, plus the name, title, type, status, message or text of an
object field, one level down: `status: {"type": "SUCCESS"}` is a STATUS
column, a trace's payload.message a MESSAGE column. A column no row has
a value for is left out, id, name, type and status come first, and the
rest keep the API's order, taken from the Go type since the SDK's JSON
comes with sorted keys.
-o table printed every cell at full length, so at 72, 100 or 160
columns the rows wrapped mid-word and the columns stopped lining up. A
description with a newline broke its row in two, credits read
0.9714999999999999, and headers ran words together (REQUESTNAME).

At a terminal, the table is now fitted to its width: the widest columns
are cut with "…" (never below 16 cells or their header), an ID column is
never cut, and columns that don't fit even cut are left off the end and
named under the table, with -o json to see everything. Off a terminal
(a pipe, a file, agent mode) nothing is cut. Anywhere, a cell is one
line, a float keeps at most four decimals (three significant digits
when below 1), headers are words (REQUEST NAME, WORKFLOW ID), and a
projectID or other scope every row shares is left out as a column.
…mmand

The generator gives a flag the first letter of its name as a shorthand only
when no other flag on the command starts with it. So agent update, which
also has --prompt, --playbooks and --end-tool, had no -p or -e, and 47
commands with --project-id lacked -p and 36 with --environment-alias lacked
-e: playbook get, tool list, transcript grep, event get, workflow create and
more. `-p $P -e main`, learned on one command, failed on the next.

--project-id and --environment-alias now take -p and -e wherever no other
flag of the command has the letter, which today is every command they
appear on. Commands without those flags keep their letters (-e is
--evaluation-id in evaluation, --end-date in the workspace analytics
queries; -p is --phone-number-id in phone-number get), so no script that
uses them changes meaning.

The shorthandElsewhere test used agent update as its command without -p;
it now adds one of its own, since no real command lacks it any more.
Where the spec left a field undescribed, the generator wrote its type, which
help shows already, or a schema name:

  -p, --project-id string        [required]
      --timezone string          string value
      --overwrite string         JSON value (one of: boolean | StableDocumentController_createText_overwrite_enum)
      --body-param.boolean       StableEvaluationCreateRequest_Boolean variant as JSON
      --description string       An optional description … (default "null")

--project-id, --environment-alias and --user-id had no description on any
command, and six tool-message commands gave --project-id a neighbouring
field's text. The interactive form showed the same placeholders.

The description hook in RegisterFlags now gives the shared flags real
descriptions (where the project ID is in Creator, `vf project list`, `vf
environment list`, what a user ID is), an ID flag "The workflow's ID", and
--timezone, --cursor, --global and --include-* their meaning. A placeholder
with nothing better to say is dropped. A boolean-or-enum union reads "true
or false", a test checking every such enum's values in the SDK. A union's
JSON form flag is named by what the user types ("The boolean form as JSON").
(default "null") is no longer shown; the flag still sends null.

The form uses the same descriptions. Spec text that says something is kept
word for word, and so are "(options: …)" and "[required]".
The spec's descriptions and the server's messages are written for the MCP
server and the API too, so help and errors named things vf doesn't have:

  event create --workflow-id   "as a workflow ID from voiceflow_workflow.list"
  test run wait --run-ids      "the IDs create_run or create_many_runs returned"
  secret set-value -e          "Requires 'versionVariant'"
  a wait 404                   "Pass the run IDs vf_test_create_run … returned"
  agent patch-instructions     "oldString was not found in the current text"

8755ede rewrote one form in server messages, a sibling command's name
(search_instructions). flagutil/apinames.go now rewrites them all, in both
places: an MCP tool (voiceflow_x.y or vf_x_y) becomes the vf command with
the same words, an operation (create_run, add_blocks) the command with
those words in the command's group, and a camelCase API field the
command's flag for it (--environment-alias, --old-string, and a form's own
--body-param.number.maximum-value). A field in a JSON shape, a query string
or a list of options stays, as does any name with no command or flag.

Help is rewritten once at startup over the whole tree (namehelp.go), with
commands in single quotes since pflag reads backticks; server messages go
through the same code from hintfit.go. The TS check that backticked
descriptions survive word for word now allows an API name to appear as its
vf command or flag.
Each form of a union marks the fields it needs, and help listed every one
of them under Required Flags: 15 on `evaluation create`, across its
boolean, number and string forms, when one form is wanted. `test turn
create` required the agent turn's fields, which a user turn doesn't have.
An agent reading the help sent them all.

RegisterFlags now moves such a field from speakeasy:required to a
vf:required-with-form annotation naming its form, and its help says
"[required with --body-param.boolean.*]" among the optional flags. A form
given without one of its fields still fails, naming it, as before. Help
examples give the first form all its required fields rather than one.
`conversation send` fails without --action ("needs --action"), but help
listed it under Optional Flags with no [required] marker. The same held
for 18 other unions: --body-param on `evaluation create`, `tool create`,
`test turn create` and 13 more, and --step and --action on `workflow
insert-step` and `replace-action`. Such a flag isn't required in the
spec's sense, because a form's flags can give it instead, so nothing
marked it.

A union that isn't optional (flagutil.UnionNeedsAForm) is now annotated
speakeasy:required, so help, completion and the explorer list it with
the required flags. Its help ends "[required]", or, where it has forms,
"[required: this, or one form's --body-param.* flags]". Help examples
still give such a union its first form rather than a bare placeholder.

So that `conversation send --text` still works without --action, a flag can
now stand in for a required one (flagutil.StandIn): the example builder
and its test count it as given, and --action's help reads
"[required, or --text]".
Every generated command reads its values from flags, and cobra handed it
any other word as an argument, which it ignored. `vf conversation send …
"hello"` sent no text and failed on a missing --action; `vf variable list
-p X -e main extra-arg` and `vf version extra` ran as if the word weren't
there; `--name my agent` saved "my". Round-3 sweep #23 (human-poweruser:F6,
agent-errors:F14).

At startup, every leaf command without an Args validator now gets one
that rejects arguments: `vf conversation send takes no arguments (got
"hello"); pass values with flags`, a usage_error in both modes, and
nothing is sent. Commands that declare their own arguments (`docs search`,
`docs get`, `auth signup`), groups (unknownSubcommand's) and the root
(the home prompt's) are left alone. The help-example test now also checks
that no example passes a stray word.
The SDK decodes a body into its request type and drops every key the type
doesn't have, without a word. `vf test create --body '{"name":…,
"turns":[…]}'` made a test with no turns, a user turn given
`"payload":{"text":"hi"}` was sent with an empty response, and a tool
given `"target":{"type":"agent"}` was sent with `"target":{}`. Each exited
0. Round-3 sweep #22 (agent-qa:F1, agent-builder:F1).

When --body, stdin, a JSON flag or a union's JSON flag carries keys its
type doesn't have, vf now says so on stderr and lists the keys that level
takes:

  Warning: --body has keys vf test turn create doesn't take, so they
  weren't sent: payload.text
    payload takes: response, variableStates

In agent mode it is a JSON object (warning, warning_type
"unknown_body_keys", keys, hints), like the other events on stderr. The
command still runs. A key inside a union is checked against the form the
SDK chose, a map takes any key, and a type that keeps extra keys
(additionalProperties) keeps them. Six one-line hooks in metadata.go.
A union's forms were named but never described. `vf test turn create
--help` gave every turn as `payload: object`, each form's own flag said
only "StableTestTurnCreateRequest_User variant as JSON", and --usage
listed neither. The hint on a body vf couldn't build, "`--help` lists the
body's fields", pointed at that same help. Building a test from vf alone
was impossible. Round-3 sweep #6 (agent-qa:F2, agent-ci:F9,
human-poweruser:F7, fix-verifier:N13).

Each form's flag now gives the form's JSON, written from the SDK type,
with optional keys marked `?` and a form's "type" given as its value:

  --body-param.user   The user form as JSON: { testID: string, payload: {
                      response: string, variableStates: string | [{ id:
                      string, variableID?: string, value?: string }] } }
  --body-param.response  … payload: { type: "equal", value: string } |
                      { type: "llm_eval", prompt: string } }

The union's own flag names its forms and the key that picks one. --usage
shows the same text, and gains a line for each form's flag. A shape over
400 characters has its biggest nested objects shortened to {…}.

A body missing a field now gives the JSON of the form the field is in,
and the unknown-key warning says what help shows. The flags are
registered before the request type is named, so RegisterFlags remembers
the command and ValidateMeta describes it: one-line hooks in metadata.go
and schema.go.

Alongside -p/-e shorthands and required unions: the command is remembered
before the shorthands copy the metadata, and a form's JSON help keeps the
[required…] its flag already ended with.
A JSON flag that rejected its value offered one of three fixed examples,
picked by the kind of value: '[{"key":"value"}]' for every list and
'{"key":"value"}' for every object. --playbooks takes [{ playbookID, … }],
so following the hint sent a playbook with no ID; --traffic takes numbers,
so following it failed again. Every flag also ended "pass null to clear
the field", --traffic too, which is required, and --playbooks and --llm,
where null leaves the field out and clears nothing. Round-3 sweep #14.

The hints are now written from the field's Go type:

  --traffic takes { <key>: number }
  for example: --traffic '{"<key>":0}'
  --llm takes { priorityProcessing?: boolean, defaults?: { model?: … } }
  for example: --llm '{"defaults":{"model":"<model>"}}'

The example holds every required key, each with a placeholder, and is
offered only once the decoder has taken it. Null is offered only on a flag
that isn't required and where null is sent as null (an OptionalNullable,
or a pointer the SDK writes when empty). Shapes now mark a key `?` only
when the SDK may leave it out; a required key that may be null reads
`string | null`.

Help examples gave a required JSON flag `<value>`, which it rejects
(`vf conversation state update --storage <value>`); they now give its
example. The traffic split's example, '{"key":1314.98,"key1":2310.29}',
named no environment and didn't add up to 100; it is now
'{"production":90,"staging":10}'.
`vf conversation send … hello there` now says how to send the words as a
message, `--text 'hello there'`, ahead of the generic flags hint.
Every failure exited 1: main.go exited 1 for any error. A script or CI step
couldn't tell a mistyped flag from a 404, a timeout or a failed test without
parsing stderr, which had a different shape in every mode.

Now the code that reports an error decides its exit code, writes it into the
JSON error as exit_code, and returns the error carrying it; main exits with it.

  0  success
  1  any other failure, including API errors not listed here
  2  usage error, caught before any request: an unknown or invalid flag,
     a missing required flag, a bad argument
  3  authentication: not signed in, no token, HTTP 401, an expired session
  4  not found: HTTP 404
  5  timed out: --timeout, or a wait's --max-wait ran out with runs going
  6  a test run didn't pass: test run wait, wait-suite, create-suite --wait

cobra's argument-count errors and flagutil's unreadable-input errors (a
--body that isn't JSON, a --file that can't be read) are now usage errors
rather than "error", so they exit 2. A failure to start a suite under
create-suite --wait is explained like any command's, instead of as
test_suite_start_failed, so a bad --body exits 2 there too. A failed human
sign-in exits 3, as it does in agent mode.

vf --help ends with the table, the README's Error Handling section has it,
and create-suite's help says 6 and 5 instead of 1.
Error JSON had no stable top-level shape. An API error was its response
body with vf's keys mixed in, so its keys were whatever the API sent: path
and timestamp on a 404, details on a 422, "error": "Bad Request" from some
services. vf's status_code sat beside the body's statusCode, and on every
validation failure the API answers with HTTP 400 they disagreed:
"statusCode": 422 next to "status_code": 400. Local errors and
AgentModeError each had their own keys, and with -o json outside agent mode
error_type was missing and a local error was printed as text.

Now every error printed in agent mode or with -o json or --jq is one object
(internal/output/envelope.go), its keys in snake_case and in a fixed order:

  error        the headline a person sees, always
  error_type   always
  exit_code    always
  message      the API's own message, or the headline; always a string
  hints        always a list, empty when there is nothing to add
  explanation  when vf can tell why
  details      [{field, message, code}] for the fields the API refused
  docs_url
  status_code  the HTTP status, when a response came back
  body         the response body as the API sent it

The API's own keys, statusCode included, are kept under body, so nothing is
lost. JSON is no longer HTML-escaped. A flag error followed by -o json or
--agent-mode=false is reported the way those ask for, since vf now reads
the flags cobra stopped short of. A wait that hits an API error with -o json
adds its resume hint inside the JSON rather than as a line after it.

Agents that read statusCode at the top level should read status_code (or
body.statusCode for the API's own claim). The README and
internal/ui/DESIGN.md describe the envelope.

The --jq failure after a write (jqfail.go) uses the envelope as well, and
since --jq makes every error the envelope, its text-only branch is gone.
conversation send's narrowed end-action error reads details[].field.
Human mode explains a validation failure in terms of flags:

  Error: Couldn't search transcripts | HTTP 400 Bad Request
    - Validation failed
      take: Too small: expected number to be >=1 (--take)

Agent mode gave only the API's field path and "Validation failed", so an
agent had to map releaseName, versionVariant or take back to a flag itself.

Each entry in the envelope's details now has the flag that sets the field,
when the command has one, beside the field's path:

  {"field": "take", "flag": "--take", "message": "Too small: ...", "code": "too_small"}

The headline human mode shows ("Couldn't search transcripts · HTTP 400 Bad
Request") is the envelope's error since the previous commit.
A command missing several required flags named one per run, so it took
a run per flag to learn of them all:

  $ vf variable create -p p1 -n hi
  Error: vf variable create needs --environment-alias
  ...
  $ vf variable create -p p1 -n hi -e main
  Error: vf variable create needs --color-param

and the fix it showed dropped the flags already given ("Pass it: vf
variable create --environment-alias <value>").

BuildRequest now checks every flag before it fails, and the error names
them all, with one command line that keeps what was given and adds what
is missing:

  Error: vf variable create needs --environment-alias and --color-param
    Next:
      'vf environment list' shows the values --environment-alias takes
      Pass them: 'vf variable create --name hi --project-id p1 --environment-alias <value> --color-param <value>'

In agent mode and with -o json, details lists the missing flags too:
{"flag": "--environment-alias", "message": "required"}. A secret, or a
value long enough to bury the line, is shown as <as before>. One missing
flag reads as it did.
JSON given to a flag or on stdin that vf couldn't use was reported in the
decoder's words: Go and SDK type names, and the SDK's label for every
failure, "response body", though the request hadn't been sent and the
JSON was the user's own. None of it said which field was wrong:

  failed to parse --body as JSON: json: cannot unmarshal string into Go value of type int64
  failed to parse --body as JSON: json: cannot unmarshal array into Go value of type components.StableProjectUpdateRequest
  invalid value for --action: error unmarshalling json response body: invalid character 'W' looking for beginning of value
  invalid value for --action: error unmarshalling json response body: could not unmarshal `{...}` into any supported union types for AnyRequest
  decoder reported: cannot unmarshal string into Go value of type map[string]jsontext.Value

Now the error names the flag, says where the JSON breaks off or which
field has the wrong kind of value, and says what the flag takes:

  invalid --body: take should be a whole number, not "ten"
    --body takes an object: 'vf transcript search --help' shows what goes in it
  invalid --body: it isn't valid JSON at character 2: a key must be in double quotes
  invalid value for --action: it isn't JSON
    --action takes JSON, one of: { type: string, payload: string, ... } | ...
  invalid value for --body-param.user: testID should be text, not 5
  invalid value for --playbooks: ...
    item [0] should be an object, not "abc"

A body, from --body or stdin, that vf couldn't use is an invalid_body
error, and exits 2. The decoder's own error doesn't say which field it
was on, because the SDK decodes a body field by field, so vf finds the
first value whose kind isn't the kind its field takes.
`vf analytics query … --start-date 2026-06-01` was sent as typed, and
the API takes only a UTC time. What came back was two errors a date:

  endDate: Invalid ISO datetime (--end-date)
  endDate: Invalid string: must match pattern /^(?:(?:\d\d[2468][048]|…/

300 characters of regex each, passed on whole in agent mode. A start
after its end was sent too. Round-3 sweep #11.

Each query's --start-date and --end-date now take a day, sent as the
time it starts (2026-06-01T00:00:00.000Z) or, for an end, the time it
ends (…T23:59:59.999Z). A time with an offset is sent in UTC. Anything
else is refused before sending, with the format:

  --start-date takes a day (2026-06-01) or a UTC time (2026-06-01T09:30:00Z)

A start after the end is refused too, with the two swapped. Help and
--usage say what the flags take, and the help examples give days.

When the API still refuses a format, as for a date in --body, each field
gets one line naming it, in place of the regex:

  endDate: expected a UTC time such as 2026-06-01T09:30:00Z (--end-date)

One-line hooks in the generated query/root.go, and in explain.go and
output.go.

With one JSON shape for every error, the API's body under "body" gets the
same words in place of the regex as details does.
`vf conversation send` run without an action said it "needs --action", and
the command line it offered added `--action <value>`, which wants JSON. It
now says it needs "--text (or --action)", and the line adds `--text <value>`.
In JSON, the detail for --action says "required, or --text".
cobra.NoArgs says `unknown command "hello" for "vf unlink"`, as if the word
were a subcommand. rejectStrayArgs now replaces it, so a command that says
it takes no arguments gets the same error as one that says nothing.
gojq's error() carries jq's exit code 5, and the exit-code lookup found it
through the jq failure, so `--jq 'error("no id")'` exited 5, which vf's
table calls "timed out". A pipeline that retries timeouts would repeat a
write that went through. A failed filter now exits 1, in the envelope as
well. Found by the round-4 sweep's agent-ci tester.
`vf transcript get 6b0d…` was refused with a hint about quoting values
with spaces, which had nothing to do with it. When a command has one
required ID flag that wasn't given, a lone stray word is now offered as
that ID: `vf transcript get --transcript-id 6b0d…`. The quoting hint
shows only for several words. Found by the round-4 sweep's
human-poweruser tester.
Renaming API names in help reached the help a union's forms give from
their types, so `workflow replace-action --action` said it is named by its
"kind": --action.go-to-block, … or --action.call-forward, and the value to
type, goToBlock, was nowhere in help. That help names JSON keys and values
as they are typed, so the rename now leaves it alone. Found by the
round-4 sweep's fix-verifier.
Copilot AI balanced review requested due to automatic review settings November 30, 2026 20:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Interactive date entry can bypass reversed-range validation, and JSON/JQ output outside agent mode loses suite-specific error kinds and actionable hints.

2 open issues
3 files not reviewed
  • cmd/vf/main.go: Generated file
  • internal/cli/analytics/query/root.go: Generated file
  • internal/cli/conversation/send.go: Generated file
What changed in this PR

This PR extends vf’s usability improvements across shared CLI helpers and command handlers, making interactive commands clearer and scripted behavior more predictable.

Changes:

  • Adds plain-text conversation input, clearer flag and union help, aggregated missing-flag errors, and analytics date handling.
  • Standardizes exit codes and JSON errors, prints --jq strings raw, explains filter failures after writes, and improves table output. Exit codes and error shapes change scripting contracts.
  • Adds terminal confirmations for destructive operations, with regression coverage and updated documentation.
File Description
test/​union-variant-flags.test.ts Expects usage exit codes for invalid union fields.
test/​flag-errors.test.ts Updates JSON hints and help assertions.
test/​errors-teach.test.ts Covers classified exits and aggregated missing flags.
test/​dry-run.test.ts Expects usage exits for invalid requests.
test/​docs-command.test.ts Expects usage exits for rejected URLs.
test/​agent-mode-flag.test.ts Updates authentication and usage exit expectations.
README.md Documents raw jq strings, exit codes, and error envelopes.
internal/​usage/​ownhelp.go Includes runtime-authored flag help in usage schemas.
internal/​usage/​extra_flags.go Scopes duplicate-flag checks to each command.
internal/​usage/​extra_flags_test.go Covers flags shared by sibling commands.
internal/​ui/​DESIGN.md Documents the unified JSON error contract.
internal/​output/​validate.go Centralizes jq parsing and compilation checks.
internal/​output/​output.go Integrates error envelopes, jq diagnostics, and table sizing.
internal/​output/​jqraw.go Prints string filter results without JSON quotes.
internal/​output/​jqfail.go Reports successful requests when response filtering fails.
internal/​output/​jq.go Preserves filter input alongside runtime errors.
internal/​output/​hintfit.go Rewrites API names as CLI commands and flags.
internal/​output/​flagwarning.go Applies shared styling to flag warnings.
internal/​output/​fieldformat.go Simplifies verbose API format errors.
internal/​output/​explain_test.go Adapts assertions to structured error details.
internal/​output/​exitcode.go Defines failure-specific exit codes and wrappers.
internal/​output/​badbody.go Adds union-form JSON guidance to body errors.
internal/​output/​apinames_test.go Covers CLI naming in server error messages.
internal/​output/​agentmode.go Delegates agent errors to the unified envelope.
internal/​oauth/​present.go Assigns authentication exit codes to login failures.
internal/​interactive/​pickers.go Remembers selected resource names for confirmations.
internal/​interactive/​interactive.go Reuses improved descriptions in forms.
internal/​interactive/​confirm.go Adds default-No confirmation forms and name lookup.
internal/​interactive/​confirm_test.go Covers selected-name retention.
internal/​flagutil/​warning.go Emits human-readable or structured warnings.
internal/​flagutil/​unknownkeys_test.go Covers warnings for discarded JSON keys.
internal/​flagutil/​unionform.go Distinguishes required unions from conditional form fields.
internal/​flagutil/​standin.go Marks flags that satisfy another required flag.
internal/​flagutil/​shorthands.go Assigns available project and environment shorthands.
internal/​flagutil/​shape_test.go Covers type-derived JSON shapes and enum literals.
internal/​flagutil/​missing.go Collects missing required flags into one error.
internal/​flagutil/​missing_test.go Covers missing-flag aggregation.
internal/​flagutil/​jsonexample_test.go Covers type-specific JSON examples and null guidance.
internal/​flagutil/​jsonerror.go Uses type-derived hints and plain-language decoder errors.
internal/​flagutil/​forms.go Generates help describing each union form’s JSON.
internal/​flagutil/​description_test.go Covers clearer descriptions and boolean-enum assumptions.
internal/​flagutil/​apinames_test.go Covers API-to-CLI name rewriting.
internal/​client/​confirm.go Adds a pre-mutation confirmation hook.
internal/​client/​confirm_test.go Covers confirmation timing, refusal, and dry runs.
internal/​client/​client.go Installs the confirmation client wrapper.
internal/​cli/​waitexit_test.go Checks failed, unfinished, and missing-run exit codes.
internal/​cli/​unknownkeys_test.go Covers unknown-key warnings across command inputs.
internal/​cli/​test/​run/​wait_exit.go Updates comments describing verdict exit codes.
internal/​cli/​test/​run/​createsuite_wait.go Updates suite error handling and exit classification.
internal/​cli/​tableview_test.go Covers union, document, trace, and log tables.
internal/​cli/​strayargs.go Rejects unexpected arguments with corrective hints.
internal/​cli/​strayargs_test.go Covers argument rejection across the command tree.
internal/​cli/​shorthands_test.go Checks shorthand consistency and compatibility.
internal/​cli/​root.go Registers validation, confirmations, help rewriting, and exit documentation.
internal/​cli/​namehelp.go Rewrites help to name vf commands and flags.
internal/​cli/​namehelp_test.go Checks rewritten help preserves literal form kinds.
internal/​cli/​missingflags_test.go Covers combined errors and secret-safe rerun hints.
internal/​cli/​merge.go Explains immediate live effects and builds merge confirmations.
internal/​cli/​merge_test.go Covers merge warnings, confirmation gating, and request targets.
internal/​cli/​jsonhints_test.go Checks JSON suggestions across command flags.
internal/​cli/​jqraw_test.go Covers raw strings across output modes.
internal/​cli/​jqfail_test.go Covers filter preflight and post-write failure diagnostics.
internal/​cli/​forms_test.go Checks union-form help, usage, and error guidance.
internal/​cli/​flaghelp_test.go Checks meaningful flag descriptions across commands.
internal/​cli/​flagerrors.go Extends structured flag errors to JSON and jq modes.
internal/​cli/​exitcode.go Exposes exit classification and root help documentation.
internal/​cli/​exitcode_test.go Covers local error codes and help output.
internal/​cli/​examplehelp.go Makes examples account for unions, stand-ins, and JSON.
internal/​cli/​examplehelp_test.go Checks argument validity and conditional example requirements.
internal/​cli/​errors_test.go Adapts shorthand suggestions to the new defaults.
internal/​cli/​docs.go Uses shared raw-string jq rendering.
internal/​cli/​docs_test.go Expects unquoted documentation search results.
internal/​cli/​daterange_test.go Covers date normalization and simplified API errors.
internal/​cli/​conversationtext_test.go Covers text input, conflicts, and help examples.
internal/​cli/​conversation/​text.go Adds --text, message prompting, and missing-message guidance.
internal/​cli/​conversation/​text_test.go Covers when forms request a message.
internal/​cli/​conversation/​send.go Integrates text actions, end handling, and reply-focused output.
internal/​cli/​bodyerror_test.go Covers plain-language body and stdin errors.
internal/​cli/​analytics/​query/​root.go Installs date handling across analytics queries.
internal/​cli/​analytics/​query/​daterange.go Normalizes dates and checks range ordering.
cmd/​vf/​main.go Exits using the classified failure code.

Review effort: Balanced

Comment on lines +42 to +43
c.RunE = func(cmd *cobra.Command, args []string) error {
if from.given != "" && to.given != "" && from.at.After(to.at) {
// hints on stderr. Either way the process exits with errorType's code: 6 for
// runs that didn't pass, 5 for runs still going, 2 for a bad flag.
func suiteError(cmd *cobra.Command, errorType, message string, hints []string) error {
if output.IsAgentMode() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants