Skip to content

[Graphite MQ] Draft PR GROUP:spec_30c4b6 (PRs 52) - #54

Closed
graphite-app[bot] wants to merge 1 commit into
masterfrom
gtmq_spec_30c4b6_1795708938839-817398dd-ebc7-4dee-b27a-ad8e3d110c79
Closed

graphite-app[bot] wants to merge 1 commit into
masterfrom
gtmq_spec_30c4b6_1795708938839-817398dd-ebc7-4dee-b27a-ad8e3d110c79

Conversation

@graphite-app

@graphite-app graphite-app Bot commented Nov 26, 2026

Copy link
Copy Markdown

This draft PR was created by the Graphite merge queue.
Trunk will be fast forwarded to the HEAD of this PR when CI passes, and the original PRs will be closed.

The following PRs are included in this draft PR:

…7) (#52)

Adds `--wait` to `vf test run create-suite`, so one command runs every test, a set of tests or the tests in some folders, waits until every run has finished, and exits non-zero unless every run passed. Linear: [COR-15957](https://linear.app/voiceflow/issue/COR-15957). The API side shipped in [creator-app #24901](https://app.graphite.com/github/pr/voiceflow/creator-app/24901), and the last regeneration added `create-suite`, `wait-suite` and `test folder list`.

## What changes

- `--wait` starts the suite, then waits for it in 45-second calls to the suite wait endpoint (the API caps one wait at 120 seconds) until every run has finished.
- `--max-wait` caps the total wait, 30 minutes by default. When it runs out, the suite keeps running, and the error names the `vf test run wait-suite` command to keep waiting and the `cancel` command to stop the runs.
- Output: progress on stderr (the `bulkID` when the suite starts, then a line like `1 of 4 passed, 1 failed, 2 still going` whenever the counts change). The final wait result (counts, and the runs that did not pass with their failed checks) goes to stdout in whatever `--output-format` is set.
- Exit code: 0 only when every run passed. 1 when a run failed or was canceled, or when `--max-wait` ran out. In agent mode those come as the usual error envelope, `test_suite_failed` or `test_suite_unfinished`, with hints, and progress comes as JSON events on stderr (`started` with the `bulkID`, `waiting`, `retrying`), like `vf auth login`, so all of stderr parses as JSON.
- A wait that hits a 5xx, a 429, no answer or an answer cut off mid-body is retried up to 3 times, 5 seconds apart, so one dropped request does not end a long wait.
- Once the suite has started, every failure names the `wait-suite` command that picks it up again, never "retry the command", which would start a second suite. An API error such as a 401 keeps its usual `error_type`, `status_code` and hints, and gets the resume command added. A failure after `--max-wait` has run out reports the last answer as unfinished. An answer that decodes to nothing stops the wait instead of being polled. Hints carry `--server-url` when it was passed, shell-quoted.
- In agent mode, stderr is JSON from start to finish: anything not reported explicitly goes through one guard that renders it as the error envelope.
- Each wait asks the API to hold for less when `--timeout` (flag, env or config) would otherwise cut the request off first.
- `--test-ids` and `--folder-ids` also take comma-separated IDs, with or without `--wait`. They are generated as repeatable string arrays, so `--test-ids a,b` used to send the single ID `"a,b"` and get a 404.
- IDs typed into the interactive prompt are split on commas too.
- Before the suite starts (with `--dry-run` too), `--wait` checks `--max-wait`, refuses a `--timeout` under 10 seconds since no wait fits in it, and parses and compiles `--jq`, which would otherwise fail only after the whole wait.
- Without `--wait` the generated command runs unchanged. `--max-wait` without `--wait` is refused.
- `--usage` lists `--wait` and `--max-wait`, in `vf --usage` and every schema between it and `create-suite --usage`.
- The token-format warning prints once per process rather than once per client, since `--wait` builds a client per wait so OAuth tokens refresh.

Logic lives in a new hand-written `internal/cli/test/run/createsuite_wait.go`. The generated `createsuite.go` gets one line (`addCreateSuiteWait(cmd)`), which wraps its `RunE`. The new hand-written `internal/usage/extra_flags.go` adds hand-written flags to the generated `--usage` schemas.

Unchanged: a flag value cobra cannot parse (`--max-wait abc`) still prints cobra's plain error, the same as for every vf command, before anything is sent.

The per-wait deadline is set on the context, because the generated `operations.WithOperationTimeout` checks for retry support instead of timeout support, so it refuses every operation without retries, `WaitSuite` included.

## Tests

- New `test/run-suite-wait.test.ts` (mock API), 22 tests. They cover:
  - Waiting through an unfinished answer and exiting 0; exiting 1 with the failed checks printed; `--max-wait` running out, with the keep-waiting hint.
  - Retries: a retried 502 and a retried cut-off answer. A 503 that outlasts the retries ends with the resume hint, not "retry the command". A failure after `--max-wait` reports the last answer.
  - Agent mode, where stderr has to be only JSON: progress events and the envelope; 401 and 404 keeping `authentication_error` / `not_found` plus the resume hint; an empty or `null` answer; a create answer with no `bulkID`; invalid flag values (`--max-wait`, `--timeout`, `--jq`); `--wait --dry-run` with a bad body.
  - Flags: `--jq` refused before start (syntax and unknown function); `--wait` checks under `--dry-run`; `--usage` at three levels; comma-separated `--test-ids` and `--folder-ids`.
  - These also catch a regeneration that drops the hook line.
- New `createsuite_wait_test.go`: ID splitting, shell quoting of hint values, per-wait length within the API's 5 to 120 seconds and within `--timeout`, which errors are retried, the progress line.
- `gofmt -l .` clean; `go test ./...` passes; behaviour tests (`VF_SKIP_INTEGRATION_TESTS=1 yarn test`): 127 passed; `yarn oxlint`: no new warnings.
- An independent review traced every error return and stderr write in agent mode, with repros against a mock server. Its findings are fixed and covered above.
- `go vet ./...` fails only on generated SDK files with unexported constant fields. It fails the same way on master (the `Vet` step is red on the last three master runs), and `go vet` is clean on the changed package.
- Live against a dev env: a folder suite (1 run) and two tests passed as `--test-ids a,b`, both with `--wait`. Both finished in under 35 seconds and exited 0.
- Not run: `speakeasy run`, to re-check that the hook line survives regeneration. The behaviour tests fail if it does not.
@graphite-app graphite-app Bot closed this Nov 26, 2026
@graphite-app
graphite-app Bot deleted the gtmq_spec_30c4b6_1795708938839-817398dd-ebc7-4dee-b27a-ad8e3d110c79 branch November 26, 2026 16:03
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.

1 participant