Repository navigation
fix(cloud): tolerate undecodable mappers and unknown statuses in connection/job lookups - #1335
Conversation
Co-Authored-By: AJ Steers <[email protected]>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. 💡 Show Tips and TricksTesting This PyAirbyte VersionYou 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/1791249227-graceful-connection-decode' pyairbyte --help
# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1791249227-graceful-connection-decode'PR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
📚 Show Repo GuidanceHelpful ResourcesCommunity SupportQuestions? Join the #pyairbyte channel in our Slack workspace. |
Co-Authored-By: AJ Steers <[email protected]>
Code Coverage OverviewLanguages: Python Python / code-coverage/pytest-no-credsThe overall line coverage in commit 05673e8 in the Show a line coverage summary of the most impacted files.
Python / code-coverage/pytestThe overall line coverage in commit 05673e8 in the Show a line coverage summary of the most impacted files.
Python / code-coverage/pytest-unitThe overall line coverage in commit 05673e8 in the Show a line coverage summary of the most covered files.
Updated |
…cked) Co-Authored-By: AJ Steers <[email protected]>
get_connection / list_connectionsCo-Authored-By: AJ Steers <[email protected]>
|
Devin, update this PR from the base branch. Note the related PR has mergec. |
…/1791249227-graceful-connection-decode Co-Authored-By: AJ Steers <[email protected]> # Conflicts: # airbyte/mcp/cloud.py # tests/unit_tests/test_cloud_api_util.py
9bd5637
into
release-candidate/v1
Summary
👉 TL;DR: Cloud connection and job lookups no longer fail outright when the bundled
airbyte-apiSDK (0.53.0) can't decode part of the response. This covers 1Password's Marketo/PartnerStack connections (field-filteringmappers),lockedconnections, and job statuses the SDK doesn't define.When the SDK raises
ValueErrorwhile decoding, we log a warning, re-fetch the raw Public API JSON, and decode it leniently: we dropconfigurations.streams[*].mappers, and we keep any status value the SDK enum doesn't define as a plain string. This PR adds no SDK monkeypatching. Thequeuedjob status is now registered on the SDK enum by #1334 (merged), soqueueddecodes on the first request.Changes
get_connection/list_connections: onValueError, fall back toGET /connections/{id}(or the per-pageGET /connections) and_lenient_decode_connection.get_job_info/get_job_logs: onValueError, fall back toGET /jobs/{id}(or the per-pageGET /jobs) and_lenient_decode_job. Pagination is unchanged and reads from either source._get_public_api_json: a bounded-timeoutrequestsGET using_config_api_headers. HTTP 404 raisesAirbyteMissingResourceErrorand 403 keeps the existing forbidden guidance, both matching_wrap_sdk_error._decode_with_unknown_status: decodes with a known placeholder status, then callsdataclasses.replace(status=raw_status)._lenient_decode_connectionand_lenient_decode_job.ConnectionStatus.LOCKEDadded.JobStatusEnum.QUEUEDcame from fix(cloud): support thequeuedjob status #1334. Both are additive, and both values are in the platform spec.responses-mocked so the real SDK decode raises):field-filteringmapper (get + list)lockedconnectionAirbyteMissingResourceErrorReview Spotlight
_decode_with_unknown_status/_lenient_decode_connection/_lenient_decode_jobat the bottom ofairbyte/_util/api_util.py.get_job_logsrestructure: SDK and fallback paths both feedpage_data/next_page.Risks
statusmay hold a rawstrinstead of an SDK enum. PublicCloudConnectionInfo/CloudJobInfodeliberately keep closed status enums, so a status unknown to our public enums still raises there; we'll add new values as the platform introduces them.ValueErrorfrom the SDK call. If the lenient re-decode also fails, that error propagates as before.Follow-ups
airbyte-server-models( refactor(cloud): replace Speakeasyairbyte-apiSDK with generatedairbyte-server-models#1148 ). Theairbyte-api1.0.1 bump ( chore: adapt PyAirbyte to airbyte-api==1.0.1 breaking changes #1048 ) still fails withCould not find discriminator field algorithm.Test plan
uv run ruff check . && uv run ruff format --check .uv run pyrefly check: 0 errorsuv run pytest tests/unit_tests/test_cloud_api_util.py -q: 108 passed (after mergingrelease-candidate/v1)Link to Devin session: https://app.devin.ai/sessions/b71c6ee648ab4a67b4e68990fc713daf
Open in Devin Desktop: https://app.devin.ai/desktop/session/b71c6ee648ab4a67b4e68990fc713daf?variant=devin
Requested by: Aaron ("AJ") Steers (@aaronsteers)