Skip to content

feat(THU-615): require successful connection test before saving a model#1006

Open
raivieiraadriano92 wants to merge 2 commits into
mainfrom
raivieiraadriano92/thu-615-test-api-key-on-save-when-adding-it-to-an-existing-model
Open

feat(THU-615): require successful connection test before saving a model#1006
raivieiraadriano92 wants to merge 2 commits into
mainfrom
raivieiraadriano92/thu-615-test-api-key-on-save-when-adding-it-to-an-existing-model

Conversation

@raivieiraadriano92

@raivieiraadriano92 raivieiraadriano92 commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Extracts the model-connection-test logic from the Add Model dialog into a reusable useModelConnectionTest hook and wires it into the Edit Model flow, so users editing an existing model (e.g. updating its API key or URL) can verify the credentials before saving — same Test Model button, success/error cards, and 10s timeout as the add path. Any edit to the model id, URL, or API key invalidates a prior successful test.

Fixes THU-615.


Note

Medium Risk
Changes when models can be persisted and sends credentials through a live API probe; misconfigured or flaky tests could block legitimate saves, though behavior matches the prior add flow.

Overview
Add and edit model flows now require a successful connection test before Add Model or Save is enabled. Connection testing is extracted into reusable useModelConnectionTest (10s timeout, same generateText probe as before) instead of living in the page reducer.

The edit model dialog gains the same Test Model UI and status cards as add. Save stays disabled until the form is dirty and the latest test succeeded. Changing model id, URL, or API key resets test state; in-flight tests use a run id so stale results cannot mark success after credentials change.

Add-dialog reducer drops connection-test actions/state; canTestModelConnection centralizes when the test button shows.

Reviewed by Cursor Bugbot for commit 3028a9a. Bugbot is set up for automated code reviews on this repo. Configure here.

@raivieiraadriano92 raivieiraadriano92 self-assigned this Jun 18, 2026
@github-actions

Copy link
Copy Markdown

Semgrep Security Scan

No security issues found.

@raivieiraadriano92 raivieiraadriano92 marked this pull request as ready for review June 18, 2026 21:29

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ae0f71b. Configure here.

Comment thread src/settings/models/index.tsx
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown

Preview environment deployed 🚀

Service URL
Marketing / blog / docs https://thunderbolt-pr-1006.preview.thunderbolt.io
App https://app-pr-1006.preview.thunderbolt.io
API https://api-pr-1006.preview.thunderbolt.io
Keycloak https://auth-pr-1006.preview.thunderbolt.io
PowerSync https://powersync-pr-1006.preview.thunderbolt.io

Stack: preview-pr-1006 · Commit: 3028a9a1f964cf38318a1564a2596f1c02d93e08

Auto-destroys on PR close/merge. Login via the bundled Keycloak realm — demo@thunderbolt.io / demo by default.

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown

PR Metrics

Metric Value
Lines changed (prod code) +195 / -102
JS bundle size (gzipped) 🟢 682.3 KB → 682.1 KB (-184 B, -0.0%)
Test coverage 🟢 78.09% → 78.10% (+0.0%)
Performance (preview) Preview not ready — Render deploy may have timed out
Accessibility
Best Practices
SEO

Updated Thu, 18 Jun 2026 21:52:36 GMT · run #1958

@raivieiraadriano92 raivieiraadriano92 changed the title feat: require successful connection test before saving a model feat(THU-615): require successful connection test before saving a model Jun 19, 2026
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.

1 participant