Skip to content

Add validation support for connections drivers#11582

Open
dfalbel wants to merge 13 commits intomainfrom
feature/bigquery-connection-validation
Open

Add validation support for connections drivers#11582
dfalbel wants to merge 13 commits intomainfrom
feature/bigquery-connection-validation

Conversation

@dfalbel
Copy link
Contributor

@dfalbel dfalbel commented Jan 28, 2026

Summary

Adds connection validation support, allowing drivers to return validation errors that are displayed inline in the connection modal with an animated error overlay.

image

Release Notes

New Features

  • Added validation support for connection drivers with inline error display

Bug Fixes

  • N/A

QA Notes

@:connections

  1. Open the Connections pane and click "New Connection"
  2. Select BigQuery (Application Default Credentials)
  3. Clear the Project ID field and observe the error message appears
  4. Enter a valid project ID and verify the error clears
  5. Test the Service Account driver similarly with the keyfile path

@github-actions
Copy link

github-actions bot commented Jan 28, 2026

E2E Tests 🚀
This PR will run tests tagged with: @:critical @:connections

readme  valid tags

@dfalbel dfalbel changed the title Add BigQuery connection driver with validation support Add validation support for connections drivers Jan 28, 2026
dfalbel and others added 6 commits January 28, 2026 17:06
Update generateCode to return {valid, code, errorMessage} for validation.
When project ID is empty, the Connect button is disabled and shows a red
border on the code editor to indicate an error state.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Display validation errors at the bottom of the code editor as an
overlay with a grow-up animation. Removed previous box-shadow
approach in favor of an absolutely positioned message element.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace { valid: boolean; code: string; errorMessage?: string } with
string | { code: string; errorMessage: string }. A string return indicates
valid code, while the object form indicates validation failure with an error
message. This removes the redundant valid field.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Prevents long error messages from breaking the layout by truncating
with ellipsis.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use vscode.l10n.t() for all user-facing error messages.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Contributor

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 adds validation support for connection drivers, enabling drivers to return validation errors that are displayed inline in the connection modal dialog with an animated error overlay. The implementation extends the generateCode method to optionally return an object containing both code and an error message, which triggers visual feedback and disables the Connect button.

Changes:

  • Extended the generateCode interface to support returning validation errors alongside code
  • Updated UI to display validation errors with an animated overlay and disable the Connect button when errors are present
  • Implemented validation for BigQuery drivers to check for required Project ID field

Reviewed changes

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

Show a summary per file
File Description
src/vs/workbench/services/positronConnections/common/interfaces/positronConnectionsDriver.ts Updated generateCode return type to support error messages
src/vs/workbench/contrib/positronConnections/browser/components/newConnectionModalDialog/createConnectionState.tsx Added state management for validation errors, updated button styling and disabled state
src/vs/workbench/contrib/positronConnections/browser/components/newConnectionModalDialog/createConnectionState.css Added error message styling with animation and adjusted footer button layout
src/vs/workbench/api/common/positron/extHost.positron.protocol.ts Updated protocol interface for validation support
src/positron-dts/positron.d.ts Updated public API type definitions
extensions/positron-connections/src/drivers/bigquery.ts Implemented validation for Project ID in both BigQuery drivers

dfalbel and others added 3 commits January 29, 2026 08:03
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Daniel Falbel <dfalbel@gmail.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dfalbel dfalbel marked this pull request as ready for review January 30, 2026 17:32
@dfalbel dfalbel requested a review from dhruvisompura January 30, 2026 17:33
Copy link
Contributor

@dhruvisompura dhruvisompura left a comment

Choose a reason for hiding this comment

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

I had a few comments about the code but the changes work as described!

The animation to show the error message is really slick. You could consider adding a similar transition when the error message disappears.

dfalbel and others added 4 commits February 3, 2026 09:46
Co-authored-by: Dhruvi Sompura <dhruvi.sompura@posit.co>
Signed-off-by: Daniel Falbel <dfalbel@gmail.com>
The MainThreadDriverAdapter was using getters for generateCode, connect,
etc. which created new function references on every access. This caused
React's useEffect to re-run continuously since generateCode was in its
dependency array.

Changed to create stable function references once in the constructor.

Also fixed Form component to:
- Pass inputs state instead of metadata.inputs
- Use immutable updates instead of mutating input objects

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace keyframe animation with CSS transitions so the error banner
animates both on entry and exit. The element is now always in the DOM
but hidden via transform/opacity, allowing CSS transitions to handle
both directions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dfalbel dfalbel requested a review from dhruvisompura February 3, 2026 14:47
Copy link
Contributor

@dhruvisompura dhruvisompura left a comment

Choose a reason for hiding this comment

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

This is looking amazing! 🚀

I have one very small nit left but feel free to merge this once that is resolved. It shouldn't need a re-review!

const editorOptions = useMemo(() => ({
const editorOptions: IEditorOptions = {
readOnly: true,
cursorBlinking: 'solid' as const
Copy link
Contributor

Choose a reason for hiding this comment

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

small nit: I don't think you need the as const here anymore now that this is typed!

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.

2 participants