Skip to content

feat: accept environment presets when creating a SQL session - #102

Merged
ClayMav merged 2 commits into
mainfrom
feat/connect-environment-presets
Dec 2, 2026
Merged

ClayMav merged 2 commits into
mainfrom
feat/connect-environment-presets

Conversation

@ClayMav

@ClayMav ClayMav commented Dec 1, 2026

Copy link
Copy Markdown
Member

Summary

Studio Code will run each SQL file on a SQL session created with that file's saved execution settings, and those settings include environment presets (WBC-1737). Until now connect() could only pass the runtime size and version.

connect() now takes optional environment_preset_id and environment_override_preset_id. They go into the session-creation request as environmentPresetId and environmentOverridePresetId, the fields the API already accepts on KubeAppAPIPayload (studio-backend services/api/src/dependencies/models.py:80-83).

A field is sent only when it's set and not empty. Callers that don't use it send exactly the same body as before. An empty ID is omitted because the server treats it as the organization default, but sending it would still change session reuse and keep the session out of the warm pool.

Related Issues

Relates to WBC-1737 (Studio Code SQL execution).


Requester Checklist

Complete these before marking Ready for Review

  • I have self-reviewed my own code
  • I have added/updated tests that prove my fix/feature works
  • I have included visual proof (screenshot, video, or test output) if applicable
  • All CI checks are passing
  • PR size is S/M, OR I have justified the size and added a walkthrough
  • I have updated documentation if needed

Visual Proof

uv run pytest tests/: 371 passed. TestConnectEnvironmentPresets covers four cases:

  • both presets set are sent;
  • each preset set alone is sent alone;
  • each preset passed as None or "" is omitted;
  • with neither set, the body is exactly {runtimeId, shutdownAfterInactiveSeconds, version, sessionType}, as on main.

The forwarding test fails on origin/main.

Adversarial review: OpenAI GPT-6.2 Sol at xhigh.

  • Empty IDs changed session reuse: confirmed and fixed.
  • The README misstated the version default when a preset pins a version: confirmed and fixed.
  • SQL sessions don't install a preset's libraries, and a preset edited under the same ID still matches an existing session: both are server-side, not in this driver. Studio Code's backend will handle them (reject presets with libraries; key sessions by the preset's revision).

Size Justification (if L/XL)

N/A. Size S.


Reviewer Checklist

If these are not met, close the tab — this PR is not ready for review

  • Requester checklist above is complete
  • All CI checks are passing
  • Tests adequately cover the changes

Made with Claude Opus 5.5 in Claude Code (T3 Code).

connect() takes environment_preset_id and environment_override_preset_id
and sends them as environmentPresetId and environmentOverridePresetId only
when set, so existing requests are unchanged.
An empty string resolves to the organization default on the server but still
changed the session reuse identity and pool eligibility.
@ClayMav ClayMav added the please-rubber-stamp Safe changes eligible for a quick review label Dec 1, 2026
@ClayMav
ClayMav requested a review from a team December 1, 2026 00:44
@ClayMav

ClayMav commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

@salty-hambot review

@salty-hambot salty-hambot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Reviewed by Salty Hambot 🤖🧂 at 7513d9c

No issues found.
💰 $0.0705 · 48.5k in / 1.2k out tokens · ⏱️ 11.1s · us.openai.gpt-6-sol high, prompt coverage-v1
💬 To request a re-review, comment @salty-hambot review

@ClayMav
ClayMav marked this pull request as ready for review December 2, 2026 21:23

@peterfoldes peterfoldes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rubber stamp 🧂 — CI green, salty-hambot clean, no open threads.

@ClayMav
ClayMav merged commit be47f81 into main Dec 2, 2026
7 checks passed
@ClayMav
ClayMav deleted the feat/connect-environment-presets branch December 2, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

please-rubber-stamp Safe changes eligible for a quick review

Development

Successfully merging this pull request may close these issues.

2 participants