Skip to content

feat: accept str|enum for region/runtime and make them optional#67

Merged
ClayMav merged 1 commit into
mainfrom
clay/byoc-optional-region-runtime
May 28, 2026
Merged

feat: accept str|enum for region/runtime and make them optional#67
ClayMav merged 1 commit into
mainfrom
clay/byoc-optional-region-runtime

Conversation

@ClayMav
Copy link
Copy Markdown
Member

@ClayMav ClayMav commented May 27, 2026

Summary

connect() now accepts str | Region | None and str | Runtime | None for region / runtime:

  • Strings pass through untouched — new or BYOC regions (e.g. region="byoc-acme-us-east-1") work without an SDK release. Enum values are normalized to their string form.
  • Optional — when omitted, the SDK no longer injects the hardcoded aws-us-west-2 / tiny. The field is dropped from the request (requests omits None query params; runtimeId is sent null) so the API applies the organization's configured default.
  • Adds a connect() docstring documenting the override-vs-default semantics, plus a README note.

Why: part of the BYOC region rollout — lets users rely on their org's default region/runtime and use arbitrary region strings. This is the reference implementation of the Python pattern (also used by the Airflow provider and MCP server).

Depends on: wherobots/studio-backend#2208 (makes region/runtime optional on POST /sql/session). Must be deployed before this is released.

Related Issues


Requester Checklist

  • I have self-reviewed my own code
  • I have added/updated tests that prove my fix/feature works
  • I have included visual proof (test output below)
  • All CI checks are passing (pending CI)
  • PR size is S/M
  • I have updated documentation if needed (docstring + README)

Visual Proof

```
tests/test_driver.py::TestConnectRegionRuntime::test_omitted_region_runtime_not_sent PASSED
tests/test_driver.py::TestConnectRegionRuntime::test_enum_region_runtime_serialized PASSED
tests/test_driver.py::TestConnectRegionRuntime::test_string_region_runtime_passthrough PASSED
12 passed in 13.14s (9 existing + 3 new)
pre-commit: ruff / ruff-format / codespell all Passed
```

`connect()` now accepts a plain string for `runtime` and `region` in addition
to the `Runtime`/`Region` enums; strings are passed to the API untouched, so
new or BYOC regions (e.g. "byoc-acme-us-east-1") work without an SDK release.

When either is omitted, the SDK no longer injects the hardcoded
`aws-us-west-2` / `tiny` defaults — the field is dropped from the request
(`requests` omits None query params; `runtimeId` is sent null) so the API
applies the organization's configured default. Enum values are normalized to
their string form. Adds a docstring documenting the new behavior.

Requires the studio-backend API change that makes region/runtime optional on
POST /sql/session.
Copy link
Copy Markdown

@salty-hambot salty-hambot Bot left a comment

Choose a reason for hiding this comment

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

Reviewed by Salty Hambot 🤖🧂

Clean implementation — one legit catch: the old WARNING block in the README now contradicts the new org-default behavior and should be cleaned up before merge.

1 finding(s) posted · 1 filtered as false positives.
💬 To request a re-review, comment @salty-hambot review

Comment thread README.md
```

`runtime` and `region` are optional and accept either the provided enums (handy
for autocomplete) or a plain string — strings are passed to the API as-is, so
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

note: The new paragraph is correctly placed, but the existing README still has a > [!WARNING] block (in the "Runtime and region selection" section) that warns users the region parameter will become mandatory in a future SDK version. With this PR, the behavior is now the opposite — omitting region is intentional and org-default-driven. That stale warning will confuse anyone who reads past the basic usage section. Consider removing or updating it in the same PR.

@ClayMav ClayMav merged commit 41b3bbd into main May 28, 2026
7 checks passed
@ClayMav ClayMav deleted the clay/byoc-optional-region-runtime branch May 28, 2026 16:32
@ClayMav ClayMav mentioned this pull request May 28, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants