Skip to content

fix: honor create dry-run with explicit types#326

Merged
theFong merged 1 commit into
brevdev:mainfrom
dims:fix-gpucreate-dry-run
Mar 10, 2026
Merged

fix: honor create dry-run with explicit types#326
theFong merged 1 commit into
brevdev:mainfrom
dims:fix-gpucreate-dry-run

Conversation

@dims
Copy link
Copy Markdown
Contributor

@dims dims commented Mar 10, 2026

A user running brev create --dry-run --type ... expects a safe preview of what the CLI would try, but today that path can still provision a real instance. In practice that means surprise spend, confusing behavior, and loss of trust in a flag that is supposed to be non-destructive. This PR fixes that command flow so dry-run consistently stays dry, even when instance types are supplied explicitly, and adds a regression test to keep it that way.

Summary

  • short-circuit brev create --dry-run before any provisioning path, even when instance types come from --type or stdin
  • print the explicit instance specs during dry-run instead of falling through into RunGPUCreate
  • add a regression test covering --type ... --dry-run

Root cause

dry-run only returned early when no explicit instance types were provided. If --type was set, the command skipped the old dry-run branch and went on to create a real instance.

Validation

  • go test ./pkg/cmd/gpucreate/...
  • go test ./pkg/cmd/gpusearch/...
  • built the patched CLI locally and verified:
    • /tmp/brev-local --no-check-latest create codex-dry-run-live-check --type hyperstack_H100 --dry-run --detached
    • /tmp/brev-local --no-check-latest create codex-dry-run-live-filter --gpu-name H100 --min-vram 80 --dry-run
  • confirmed brev ls remained empty after both live checks

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
@dims dims requested a review from a team as a code owner March 10, 2026 20:45
Copilot AI review requested due to automatic review settings March 10, 2026 20:45
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes brev create --dry-run so it reliably short-circuits before any provisioning logic, including when instance types are explicitly provided via --type (or stdin), and adds a regression test to prevent the issue from returning.

Changes:

  • Move the dry-run early return to occur immediately after parsing instance types (before any provisioning path can run).
  • Enhance dry-run output to print explicit instance specs directly when they’re provided.
  • Add a regression test ensuring --type ... --dry-run does not create workspaces.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pkg/cmd/gpucreate/gpucreate.go Ensures --dry-run always returns early; prints explicit instance specs when provided.
pkg/cmd/gpucreate/gpucreate_test.go Adds a test that verifies dry-run with explicit types does not provision.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dims
Copy link
Copy Markdown
Contributor Author

dims commented Mar 10, 2026

cc @theFong

@theFong theFong merged commit e98788b into brevdev:main Mar 10, 2026
12 of 13 checks passed
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.

3 participants