Skip to content

Test connections via workers instead of the API server#68113

Open
anishgirianish wants to merge 1 commit into
apache:mainfrom
anishgirianish:ui-async-connection-test
Open

Test connections via workers instead of the API server#68113
anishgirianish wants to merge 1 commit into
apache:mainfrom
anishgirianish:ui-async-connection-test

Conversation

@anishgirianish

@anishgirianish anishgirianish commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Follow-up to #62343, which moved connection testing to workers but left the UI on the old sync endpoint.

This wires the Connections "Test" button to the new worker flow: enqueue the test, then poll until it finishes. The result shows up as a toast (with the worker's message) and the usual green/red icon. Clicking Test while one is already running shows an "already in progress" message.

related: #62343


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

Note

✅ Ready for review · @anishgirianish@potiuk · 2026-06-12 13:30 UTC

Thanks @anishgirianish — all checks are green and this PR is marked ready for maintainer review. The ball is with the maintainers now; a maintainer will take the next look.

Automated triage — may be imperfect.

@boring-cyborg boring-cyborg Bot added area:translations area:UI Related to UI/UX. For Frontend Developers. translation:default labels Jun 5, 2026
@anishgirianish anishgirianish marked this pull request as ready for review June 11, 2026 01:20
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label Jun 12, 2026

@pierrejeambrun pierrejeambrun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR, tested and working as expected.

I don't think we can do this before all executor support the async connection testing flow. Otherwise it will just break the feature for people using the celery executor for instance.

We also need to update the documentation, for instance here /Users/pierrejeambrun/Documents/astronomer/git-repositories/airflow-agents/agent-1/airflow-core/docs/howto/connection.rst,

When testing in the Airflow UI, the test executes from the webserver so this feature is subject to network egress rules setup for your webserver.

For security reasons, the test connection functionality is disabled by default across Airflow UI, API

Etc...

Also a few suggestions / comments.

Comment on lines +56 to +58
"testInProgress": {
"title": "A connection test is already in progress"
},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't need to do this with a specific message and error handler.

Just use a common handler that will display the error message from the server

{
    "detail": "An active connection test already exists for connection_id `test_failing`."
}

You can take a look at other similar hooks

};

const { isPending, mutate } = useTestConnection((result) => {
const { isPending, test } = useTestConnection((result) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

mutate is fine it's the common convention in the code base.

Suggested change
const { isPending, test } = useTestConnection((result) => {
const { isPending, mutate } = useTestConnection((result) => {

Comment on lines 44 to 49
toaster.create({
description: res.message,
title: translate("connections.testError.title"),
title:
(error as ApiError).status === 409
? translate("connections.testInProgress.title")
: translate("connections.testError.title"),
type: "error",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can reuse createErrorToaster.

undefined,
{
enabled: token !== undefined,
refetchInterval: (query) => (isActive(query.state.data?.state) ? POLL_INTERVAL : false),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Refresh interval should come from useAutoRefresh. (To be consistent in timing with other request in the application)

type ConnectionStatus = boolean | undefined;

const ACTIVE_STATES = new Set(["pending", "queued", "running"]);
const POLL_INTERVAL = 2000;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

CF comment bellow.

@pierrejeambrun pierrejeambrun changed the title UI: Test connections via workers instead of the API server Test connections via workers instead of the API server Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:translations area:UI Related to UI/UX. For Frontend Developers. ready for maintainer review Set after triaging when all criteria pass. translation:default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants