Skip to content

fix(cloud): wrap unguarded Cloud SDK calls so 409/422 details surface - #1372

Merged
Aaron ("AJ") Steers (aaronsteers) merged 1 commit into
release-candidate/v1from
devin/1791942697-sdkerror-wrap
Oct 16, 2026
Merged

Aaron ("AJ") Steers (aaronsteers) merged 1 commit into
release-candidate/v1from
devin/1791942697-sdkerror-wrap

Conversation

@aaronsteers

Copy link
Copy Markdown
Member

Summary

What 14 Cloud API calls in airbyte/_util/api_util.py now catch SDKError and raise _wrap_sdk_error(e)
Why Without a guard, a 4xx escaped as a raw SDKError, bypassing parse_cloud_error. MCP telemetry showed raw SDKError on cancel_cloud_sync (409 "Job is not currently running") and update_cloud_connector_config (422 schema validation)
Effect Callers get AirbyteCloudError / AirbyteMissingResourceError / AirbyteConnectorNotReadyError with the problem detail as the message, plus request URL and status in context

Changes

  1. Wrapped calls, using the pattern already used elsewhere in the module:
    try:
        response = airbyte_instance.jobs.cancel_job(...)
    except SDKError as e:
        raise _wrap_sdk_error(e) from e
  2. Functions covered: cancel_job, create_source, patch_source, delete_source, create_destination, patch_destination, delete_destination, delete_connection, create/list/get/update/delete_custom_yaml_source_definition, list_organizations_for_user.
  3. Tests: 409 on cancel_job and 422 on patch_source (via responses) assert the parsed detail message, the SDKError cause, and the status in context. Both fail without the fix.

Review Spotlight

Breaking for direct callers of these 14 airbyte._util.api_util functions: code that did except SDKError around them now gets AirbyteCloudError subclasses, with the original SDKError as __cause__. Nothing in airbyte/ catches SDKError from these functions. The MCP error path (_cloud_error_info) already walks __cause__, so MCP messages keep the parsed problem.

Test plan

  • ruff check / ruff format: clean.
  • pytest tests/unit_tests/test_cloud_api_util.py test_mcp_tool_errors.py test_mcp_cloud.py test_cloud_connections.py: 569 passed.

Link to Devin session: https://app.devin.ai/sessions/8fbdc1e4380941958b0bed24914614f2
Open in Devin Desktop: https://app.devin.ai/desktop/session/8fbdc1e4380941958b0bed24914614f2?variant=devin
Requested by: Aaron ("AJ") Steers (@aaronsteers)

… surface

Co-Authored-By: AJ Steers <aj@airbyte.io>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@github-actions

Copy link
Copy Markdown

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

💡 Show Tips and Tricks

Testing This PyAirbyte Version

You can test this version of PyAirbyte using the following:

# Run PyAirbyte CLI from this branch:
uvx --from 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1791942697-sdkerror-wrap' pyairbyte --help

# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1791942697-sdkerror-wrap'

PR Slash Commands

Airbyte Maintainers can execute the following slash commands on your PR:

  • /fix-pr - Fixes most formatting and linting issues
  • /uv-lock - Updates uv.lock file
  • /test-pr - Runs tests with the updated PyAirbyte
  • /prerelease - Builds and publishes a prerelease version to PyPI
📚 Show Repo Guidance

Helpful Resources

Community Support

Questions? Join the #pyairbyte channel in our Slack workspace.

📝 Edit this welcome message.

Copilot AI 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.

🟢 Approval recommended

The wrappers consistently follow the established error-conversion pattern and the reported failure paths have focused regression coverage.

0 open findings

What changed in this PR

Wraps previously unguarded Cloud SDK calls so API errors surface as structured PyAirbyte exceptions.

Changes:

  • Wraps SDKError across 14 Cloud API operations.
  • Adds regression tests for 409 and 422 problem details.
File Description
airbyte/​_util/​api_util.py Converts raw SDK failures into structured Cloud errors.
tests/​unit_tests/​test_cloud_api_util.py Tests error detail, cause, and status preservation.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-code-quality

github-code-quality Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: Python

Python / code-coverage/pytest-no-creds

The overall line coverage in commit b9fb8a4 in the devin/1791942697-sdk... branch is 79%. The line coverage in commit d9f652f in the release-candidate/v1 branch is 65%.

Show a line coverage summary of the most impacted files.
File release-candidate/v1 d9f652f devin/1791942697-sdk... b9fb8a4 +/-
airbyte/_util/api_util.py 36% 66% +30%
airbyte/mcp/cloud.py 52% 83% +31%
airbyte/cloud/connectors.py 34% 75% +41%
airbyte/mcp/_datadog.py 0% 50% +50%
airbyte/mcp/_user_identity.py 0% 93% +93%
airbyte/_direct...ctors/models.py 0% 94% +94%
airbyte/mcp/_telemetry.py 0% 94% +94%
airbyte/mcp/_sso_auth.py 0% 96% +96%
airbyte/cloud/models.py 0% 97% +97%
airbyte/mcp/int...nc_status_ui.py 0% 97% +97%

Python / code-coverage/pytest

The overall line coverage in commit b9fb8a4 in the devin/1791942697-sdk... branch is 81%. The line coverage in commit d9f652f in the release-candidate/v1 branch is 71%.

Show a line coverage summary of the most impacted files.
File release-candidate/v1 d9f652f devin/1791942697-sdk... b9fb8a4 +/-
airbyte/cloud/connectors.py 51% 80% +29%
airbyte/mcp/cloud.py 52% 83% +31%
airbyte/mcp/_datadog.py 0% 50% +50%
airbyte/mcp/int..._registry_ui.py 0% 92% +92%
airbyte/mcp/_user_identity.py 0% 93% +93%
airbyte/_direct...ctors/models.py 0% 94% +94%
airbyte/mcp/_telemetry.py 0% 94% +94%
airbyte/mcp/_sso_auth.py 0% 96% +96%
airbyte/cloud/models.py 0% 97% +97%
airbyte/mcp/int...nc_status_ui.py 0% 97% +97%

Python / code-coverage/pytest-unit

The overall line coverage in commit b9fb8a4 in the devin/1791942697-sdk... branch is 75%. Line coverage data for the release-candidate/v1 branch is not yet available.

Show a line coverage summary of the most covered files.
File release-candidate/v1 devin/1791942697-sdk... b9fb8a4 +/-
airbyte/cloud/models.py — 97% —
airbyte/mcp/_sso_auth.py — 96% —
airbyte/_direct...ctors/models.py — 94% —
airbyte/cloud/client.py — 90% —
airbyte/exceptions.py — 89% —
airbyte/mcp/cloud.py — 83% —
airbyte/progress.py — 80% —
airbyte/cloud/connectors.py — 75% —
airbyte/shared/...ql_processor.py — 68% —
airbyte/_util/api_util.py — 66% —

Updated October 14, 2026 02:10 UTC

@aaronsteers
Aaron ("AJ") Steers (aaronsteers) marked this pull request as ready for review October 16, 2026 01:59

@devin-ai-integration devin-ai-integration Bot 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@aaronsteers
Aaron ("AJ") Steers (aaronsteers) merged commit d39d804 into release-candidate/v1 Oct 16, 2026
34 checks passed
@aaronsteers
Aaron ("AJ") Steers (aaronsteers) deleted the devin/1791942697-sdkerror-wrap branch October 16, 2026 02:22
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