Repository navigation
fix: sweep P0s: auto-compile, test wait exit codes, help examples, list flags, forms, -o table, error hints - #57
Open
Bradenream wants to merge 10 commits into
Open
Bradenream wants to merge 10 commits into
Bradenream wants to merge 10 commits into
Conversation
`vf test run wait` and `vf test run wait-suite` printed the runs' results and exited 0 whatever they were, while `create-suite --wait` exits 1 when a run fails. A pipeline that started runs and then waited for them went green on failing tests. Now, once the result is printed, the command exits 1 when a run failed or was canceled, a run was still going when the wait stopped, or a run ID wasn't found. The error says which, with the command to read a failed run's logs or keep waiting. -o json and --jq skip decoding the response, so the verdict reads the raw body and puts it back to be printed unchanged. wait-suite is judged by the same suiteOutcome as create-suite --wait.
…mmas A list flag took each value as is. But the generated examples write lists as JSON (`--run-ids '["a","b"]'`), `--expected-actions` says "Send [] when it has none", and `test run create-suite --test-ids` splits commas. So `--run-ids '["a"]'` sent the one ID `["a"]` and `--run-ids a,b` the one ID `a,b`. The server answered that none existed, and the error blamed the project ID. Now a value that starts with [ is read as a JSON array of strings, and `[]` sends an empty list, even to a required flag. A list of IDs or names (--*-ids, --exclude-id, --*-order, --expected-steps, --kinds, --levels...) also splits on commas. Lists of free text (URL patterns, written words) keep their commas. Every list flag's help says how to pass several values.
The generator builds an example from the SDK's resource name, not from the command's place in the tree. So the 78 commands three levels down showed commands that don't exist: `vf query project-transcript-count`, `vf run wait`, `vf function-variable create`. Some examples left out a required flag (document create-text's --file), left a flag with no value (workflow delete-block's --expected-steps), or ran a multi-word value on unquoted (agent add-workflow's --description). fixExamples rewrites each example once, at startup: the command words become the command's real path, a multi-word value is quoted, a flag with no value gets a placeholder, and each required flag missing is added. Of a union's variants, which are all marked required but are alternatives, only the first is added, and none when the example already sets the union. A test parses every example in the tree with its own command.
huh v0.6 doesn't wrap a field's description. The form's viewport wrapped it after the field's border was drawn, so the extra lines lost the border, and the form, sized by the unwrapped lines, cut off the bottom of the field. At 72 columns `event create` showed --goes-to's description and none of its options, `secret create` hid its input line, and "Fill in N optional field(s)?" hid Yes and No. Keys still reached the hidden field, so people typed blind and a hidden select submitted its first option. The theme now wraps descriptions to the width a field has inside its border. A select's height, which huh counts from the top of its title, now includes the title and description lines, so all the options it was sized for show.
Almost every response wraps its data in an object: {"environments": [...]},
{"project": {...}}, {"transcripts": [...], "returned": 1, "hasMore": false}.
The table printer only knew a bare list, record or map, so `environment
list -o table` and `project get -o table` failed with "no displayable fields
found", and `transcript search -o table` printed returned and hasMore and
exited 0 without a single transcript.
Now a response holding one list prints it as rows, with its other plain
fields under them. A wrapper around one record prints the record. A response
holding several lists fails and names them, and every table error says to
use -o json or -o yaml, so no rows are dropped unseen.
explainAPI starts from what each status usually means. The usability sweep
found five places where that sent people the wrong way:
- A 404 blamed only the scope flags, never the ID of the thing looked up.
`event get --event-id <typo>` said to check --project-id, and `test run
wait --run-ids <bad>` blamed the project. Now the resource's own ID flags
come first: "Check --event-id ev1: it may be wrong, or not be in
--project-id p1, --environment-alias main."
- A 404 whose body is "Cannot PATCH /v1/..." is a route the server doesn't
have, not a wrong ID. `function patch-code` failed that way every time and
said to recheck three correct IDs. It is now unsupported_command, says the
server has no such route, and blames no flag.
- A 500 that said what was wrong with the input ("Could not resolve 'nope'
environment alias") said "It's usually temporary. Run it again in a
minute". A 500 with a specific message now says it will likely fail the
same way. A generic or passing one (timeout, unavailable) still says to
retry.
- A 409 or 403 with its own reason ("oldString was not found in the current
text", "Main environment cannot be deleted") got "a name that's already
taken" or "your account isn't allowed". The stock text now only appears
when the message is about a name or about access.
- The commands in hints left out the scope flags they need, so pasting
`vf event list` or `vf event get --event-id ev1` asked for a project. Both
the 404/409 list hint and the next steps after a create now carry the -p
and -e they were given, outside the home prompt where context fills them.
A server message that names an MCP tool beside the command
(search_instructions) now names the vf command (`vf agent
search-instructions`).
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved correctness issues break JSON-array flags, silently omit table data and required parent IDs in follow-up commands, and let wait commands exit successfully after response-decoding failures.
5 open issues
JSON decode failures incorrectly produce a passing verdict · New JSON array selectors are broken by legacy preprocessing · New Generated next-step tips omit required parent resource IDs · New Table output drops nested records when list fields are present · New Table output omits fields from union-valued tool rows · New
6 files not reviewed
internal/cli/root.go: Generated fileinternal/cli/test/run/wait.go: Generated fileinternal/cli/test/run/waitsuite.go: Generated fileinternal/flagutil/metadata.go: Generated fileinternal/interactive/interactive.go: Generated fileinternal/output/output.go: Generated file
What changed in this PR
This PR follows up on #55 and #56 with usability fixes for the Voiceflow CLI, focusing on reliable CI results, usable command examples, and clearer terminal output.
Changes:
- Makes test-wait commands return failure when runs do not pass and adds JSON-array/comma parsing for list flags.
- Repairs generated help examples and adjusts forms to keep inputs visible beneath long descriptions.
- Adds table support for wrapped responses and makes error hints and suggested commands more specific.
| File | Description |
|---|---|
internal/output/tableview.go |
Adds table handling for wrapped lists and records. |
internal/output/tableview_test.go |
Tests supported wrappers and multiple-list errors. |
internal/output/output.go |
Routes table output through the new handler. |
internal/output/hintfit.go |
Adds resource-aware hints and scoped command suggestions. |
internal/output/hintfit_test.go |
Tests hint accuracy and scope propagation. |
internal/output/explain.go |
Integrates more specific API-error explanations. |
internal/output/created.go |
Carries scope flags into post-create suggestions. |
internal/interactive/pickers.go |
Accounts for headings when sizing selection fields. |
internal/interactive/interactive.go |
Applies description wrapping and selection sizing. |
internal/interactive/formwrap.go |
Calculates description width and selection height. |
internal/interactive/formwrap_test.go |
Checks input and option visibility beneath long descriptions. |
internal/flagutil/metadata.go |
Integrates list parsing and list-format help. |
internal/flagutil/listflags.go |
Parses JSON arrays and selected comma-separated lists. |
internal/flagutil/listflags_test.go |
Tests list parsing, empty arrays, and help text. |
internal/cli/waitexit_test.go |
Tests wait-command outcomes across output formats. |
internal/cli/test/run/waitsuite.go |
Returns the suite verdict after printing results. |
internal/cli/test/run/wait.go |
Returns the run verdict after printing results. |
internal/cli/test/run/wait_exit.go |
Evaluates outcomes while preserving raw response output. |
internal/cli/tableview_test.go |
Tests wrapped table responses through CLI commands. |
internal/cli/root.go |
Registers startup repair of help examples. |
internal/cli/examplehelp.go |
Repairs command paths, quoting, and required flags. |
internal/cli/examplehelp_test.go |
Checks example parsing and rewrite behavior. |
Review effort: Balanced
| return false | ||
| } | ||
| res.Body = io.NopCloser(bytes.NewReader(raw)) | ||
| return json.Unmarshal(raw, v) == nil |
|
|
||
| func buildStringArrayField(cmd *cobra.Command, v reflect.Value, m FlagMeta) error { | ||
| val, changed := GetStringArrayFlag(cmd, m.FlagName) | ||
| val, explicit, err := ListValues(m.FlagName, val) // listflags.go: JSON arrays and commas |
| if err != nil || target == nil { | ||
| return next | ||
| } | ||
| for _, name := range scopeFlags { |
| names[i] = jsonName(v.Type().Field(field)) | ||
| } | ||
| return fmt.Errorf("-o table shows one list, and this response holds %d: %s. Use -o json or -o yaml to see them all", len(lists), strings.Join(names, ", ")) | ||
| case len(lists) == 1: |
| } | ||
| return fmt.Errorf("-o table shows one list, and this response holds %d: %s. Use -o json or -o yaml to see them all", len(lists), strings.Join(names, ", ")) | ||
| case len(lists) == 1: | ||
| if err := tableError(printTableRows(out, v.Field(lists[0]))); err != nil { |
A conversation runs the environment's last compiled build, and nothing compiled it after an edit. So `agent update` then `conversation run-script` talked to the old agent. In the usability sweep, agents and newcomers alike read the old replies as "my prompt and tool don't work", and spent credits finding out. The only sign was `needsRecompile: true` atop hundreds of lines. Nothing says the draft is stale before a run, so vf now compiles it whenever a conversation with the draft starts: before every `run-script`, and before a `send` with a launch action. A later `send` keeps its build, but if its turn still ran a stale one (an edit mid-conversation, or a conversation started with text), vf compiles right after the answer is printed and warns, so the next turn runs the edits. The answer is read before it is printed, from the raw body under -o json and --jq. - `--no-compile` talks to the last build as it is. - The published version is a release, and is never compiled. - A draft that won't compile stops the conversation before it spends credits, and says to fix the agent or add --no-compile. - At a terminal, "✓ Compiled the draft of main (1.2s), so this runs your latest edits" says it happened. Agent mode stays quiet on success. The body-peeking helper the wait verdict used moves to output.PeekJSON so both share it.
Every unknown short flag got "Did you mean `--jq`?". The suggestion compared names by edit distance, and a one-letter name is within two edits of "jq". Eight of the round-3 sweep's testers hit it, mostly as `-p` or `-e` on a command that has only --project-id or --environment-alias. Plain master printed cobra's "unknown shorthand flag", so this was a regression from the usage-error explanations. A short flag is now looked up by what that letter stands for on vf's other commands: `vf agent update -p` suggests --project-id. When the command has no such flag, nothing is suggested. A typo in a long name now changes at most half of it, so `--pi` no longer suggests --jq either.
… too Sixteen commands take a body that is a union as a whole: `test turn create`, `test check create`, `workflow update-step`, `agent add-tool-message` and others. Their flag, --body-param, fills the body itself, so its field path is "Body", and the check for body flags only counted fields under "Body.". Given --body-param.user, those commands still read stdin: `sleep 15 | vf test turn create …` waited 10s and failed, and a `while read` loop ran once, because vf swallowed its remaining lines. The round-3 sweep's fix verifier found it. The body's own field now counts as a body flag.
Seven examples failed as written with "the body is none of its forms": test check create/update, test turn update, tool create/update, evaluation update and workflow update-branch. Their whole body is a union, and its flag isn't marked required, because any one of several flags fills it. So fixExamples added nothing. RegisterFlags now marks a union that isn't optional (unionform.go), and the example gets that union's first form: a field of the variant where there is one, or the variant as JSON.
Bradenream
added a commit
that referenced
this pull request
Nov 30, 2026
"That compile is required … Nothing errors" and "the step is yours to remember" stop being true once vf compiles the draft before a conversation (#57). Keep the step and the reason for it, which hold either way: a conversation runs the draft as last compiled, and a missed compile looks like a successful edit.
This was referenced Nov 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Stacked on #56, which is stacked on #55. The base is
braden/teach-errors, so this diff shows only these 10 commits. Retarget once #56 merges.These are the top-priority fixes from the usability sweeps. Commits 8–10 fix what the third sweep found in this stack. Each commit builds and passes CI on its own, and each has a test that fails without its fix.
fix(test): wait and wait-suite exit non-zero unless every run passedtest run waitandwait-suiteexited 0 on failed runs, so CI went green on failing testsfix(flagutil): list flags take a JSON array, and lists of IDs take commas--run-ids '["a","b"]'(the help's own syntax) sent one ID,["a","b"]fix(cli): every help example runs as writtenvf query …,vf run wait). Others left out a required flagfix(interactive): a long description no longer hides a field's inputfix(output): -o table shows the rows a response wraps, or says why not-o tablefailed on most lists, andtranscript search -o tableexited 0 with no rowsfix(output): point an API error's hints at the real causefeat(conversation): compile the draft before a conversation runs itenvironment compilefix(cli): an unknown short flag suggests what it means elsewhere--jq?" (from #56)fix(flagutil): body flags turn stdin off on whole-body union commands toosleep 15 | vf test turn create …waited 10s and failedfix(cli): help examples give a whole-body union one of its formsDetails
1.
test run waitexits 1 unless every run passed-o jsonand--jq, which skip decoding the response. The verdict reads the raw body and puts it back unchanged.wait-suiteuses the samesuiteOutcomeascreate-suite --wait, so the three commands now agree.2. List flags take JSON arrays and commas
[is read as a JSON array of strings.[]sends an empty list, as--expected-actionsasks for.--*-ids,--exclude-id,--*-order,--expected-steps,--kinds,--levels.--exclude(URL patterns) and--remove(written words).3. Help examples
examplehelp.go) rewrites every generated example:4. Forms
┃border, so the field was taller than the form allowed for, and the bottom got cut off.event create's--goes-toshows all its options.secret createshows its input line.5.
-o table-o json.6. Error hints
Check --event-id ev1: it may be wrong, or not be in --project-id p1, --environment-alias main.Cannot PATCH /v1/…is nowunsupported_command: the server has no such route. This is whatfunction patch-codehits every time.-p/-e, so they run when pasted.search_instructions→vf agent search-instructions.7. Conversations compile the draft first
agent updatethenrun-scripttalked to the old agent. The only sign wasneedsRecompile: trueat the top of hundreds of lines.run-scriptsendwith alaunchactionsendturns keep their build. If a turn still ran a stale one (an edit mid-conversation, or a conversation that opened withtext), vf compiles right after the answer and warns, so the next turn runs the edits. Works with-o jsonand--jq.--no-compiletalks to the last build as it is. The published version is never compiled.✓ Compiled the draft of main (1.2s), so this runs your latest edits. Agent mode stays quiet on success.8. Unknown short flags
jq.-psuggests the long flag that-pstands for on other commands, if this command has it:-z, which stands for nothing, suggests nothing.9. Stdin on whole-body unions
bodyFlagsGivenonly looked at flags under the body (Body.…). A body that is a union as a whole is filled by a flag whose field isBodyitself, so--body-param.user …didn't count.test turn create,test check create,workflow update-step,evaluation createand the*-tool-messagecommands.sleep 12 | vf test turn create … --body-param.user '{…}' --dry-run: 10.0s before, 0.03s after.10. Examples for whole-body unions
vf test check create --project-id <id> --environment-alias <value>failed.RegisterFlagsnow marks a union that isn't optional (unionform.go, a one-line hook inmetadata.go). The example gets its first form: a field of the variant where there is one, else the variant as JSON:TestEveryExampleRunsAsWrittennow fails when a union that needs a form has none. Without the fix it names exactly the 7 commands.With #30 and #35
vf environment compileand says why, without "required" or "Nothing errors".textaction runs one turn on the old build before vf compiles.Testing
go build, gofmt (1.25 and 1.27),scripts/vet.sh,go test ./...yarn oxlintgo.mod/go.sumtest run waitin pretty,-o json,--jqand agent mode-o tabletext-first conversation. The tests cover the order of requests.Not in this PR
conversation send:{"type":"end"}is mangled, there's no--message, and it prints hundreds of trace lines.-o yaml: changes key names.docs/: was already behind the command tree before this PR. Regenerating it touches 104 files of earlier work, so it's left for its own change.