Skip to content

feat: add region-aware instance search and creation - #456

Open
theFong wants to merge 2 commits into
mainfrom
codex/create-region-selection
Open

feat: add region-aware instance search and creation#456
theFong wants to merge 2 commits into
mainfrom
codex/create-region-selection

Conversation

@theFong

@theFong theFong commented Aug 22, 2026

Copy link
Copy Markdown
Member

Summary

  • add --region/-r to GPU and CPU search with case-insensitive partial matching for discovery
  • add exact, case-insensitive placement selection to brev create through --region or --location, plus optional --sub-location
  • include CPU types in create-time validation so types such as n2d-standard-2 can be placed in us-west2
  • validate requested locations before provisioning and list the supported locations on mismatch
  • expose default location and sub-location in search tables and JSON
  • show selected or default placement in create dry-run and pre-create output
  • resolve authenticated cloud credentials by instance type and location
  • safely override or clear launchable sub-locations when the CLI location changes

Issue

Fixes #454

This covers the issue end to end: the request fields are populated, CPU locations are validated, default placement is visible before provisioning, and the reported n2d-standard-2 / us-west2 / us-west2-a path has a mocked request-level regression test.

Compatibility

  • brev search and brev create without placement flags retain their existing selection behavior
  • piped tables keep TYPE and TARGET_DISK as the first two columns; PROVIDER also remains third
  • new JSON fields are additive and omitted when unavailable
  • search remains forgiving for discovery, while create requires an exact catalog location
  • GetCloudCredID preserves first-match behavior when no location is requested
  • fallback chains remain usable when at least one candidate supports the requested location
  • private launchable types absent from the authenticated catalog retain their configured credential

Dedupe investigation

The issue suggestion to revisit uniqueInstanceType=true was reviewed. This PR leaves it unchanged: validation uses the public catalog available_locations, and authenticated selection already matches both type and location across the returned credential entries. Changing server response cardinality without a reproduced failure would expand the scope and risk of this fix.

Validation

  • go test -count=1 ./pkg/cmd/gpusearch ./pkg/cmd/gpucreate
  • go test -race ./pkg/cmd/gpusearch ./pkg/cmd/gpucreate
  • go vet ./pkg/cmd/gpusearch ./pkg/cmd/gpucreate
  • golangci-lint run ./pkg/cmd/gpusearch ./pkg/cmd/gpucreate
  • go build ./...
  • go test -count=1 ./pkg/integration

No real instance was provisioned while validating this change.

Prior work

This is a clean refresh of #393 against current main, building on the original region-flag work by @hakhandelwal11. The older PR is intentionally left open for maintainers to handle.

@theFong
theFong requested a review from a team as a code owner August 22, 2026 21:42
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.

brev create cannot set region: location/subLocation exist in the request struct but are only populated via launchables

1 participant