feat: add any_of strategy to CheckStream for dynamic check stream selection#997
Draft
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Draft
feat: add any_of strategy to CheckStream for dynamic check stream selection#997devin-ai-integration[bot] wants to merge 1 commit intomainfrom
any_of strategy to CheckStream for dynamic check stream selection#997devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Conversation
…ection Adds a new optional 'strategy' field on the low-code CheckStream component. - strategy: all (default) preserves existing behavior: every listed stream must be available for the check to pass. - strategy: any_of passes as soon as any listed stream is available, and only fails if every listed stream is unavailable. Short-circuits on the first success, aggregates failure reasons otherwise. This unblocks connectors where different users have scope for different streams (e.g. permission-scoped OAuth tokens) and a single hardcoded check stream would otherwise produce misleading failures. Resolves airbytehq/airbyte-internal-issues#16231 Co-Authored-By: bot_apk <apk@cognition.ai>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. 💡 Show Tips and TricksTesting This CDK VersionYou can test this version of the CDK using the following: # Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@devin/1776813694-check-stream-any-of-strategy#egg=airbyte-python-cdk[dev]' --help
# Update a connector to use the CDK from this branch ref:
cd airbyte-integrations/connectors/source-example
poe use-cdk-branch devin/1776813694-check-stream-any-of-strategyPR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new optional
strategyfield on the low-codeCheckStreamcomponent so that manifest authors can list multiple candidate check streams and have the check pass as soon as any of them is available, rather than requiring every listed stream to be available.This is phase 1 from airbytehq/airbyte-internal-issues#16231 ("Option 1 —
any_ofstrategy onCheckStream"), the recommended starting point in the design discussion. It unblocks the permission-scope class of check failures (HubSpot, Salesforce, GitHub org-scoped tokens, etc.) without requiring any protocol changes.Resolves airbytehq/airbyte-internal-issues#16231:
What changed
CheckStreamgains an optionalstrategyfield with two values:all(default) — current behavior: every listed stream must be available.any_of— passes on the first available stream (short-circuits), and only fails if every listed stream is unavailable. Failure message aggregates the per-stream reasons so users can see why each candidate was rejected.declarative_component_schema.yaml) and the generated pydantic model (declarative_component_schema.py) were updated to expose the new field.model_to_component_factory.create_check_streamthreads the new field through.strategyonly affects staticstream_names;dynamic_streams_check_configscontinue to useall-style semantics within a group.Declarative-First Evaluation
This change is a declarative-first improvement: it extends the existing
CheckStreamdeclarative component with a new field rather than introducing any custom Python component. No custom component is added, introduced, or required. The new behavior is entirely opt-in via manifest.Breaking Change Evaluation
Not breaking. The new field is optional and defaults to
all, which is identical to the pre-change behavior. No schema, spec, stream, or state format changes. Standard non-breaking versioning applies (the CDK usessemantic-pr-release-drafterdriven by thefeat:prefix, so this will land as a MINOR bump).Test Coverage
Added unit tests in
unit_tests/sources/declarative/checks/test_check_stream.py:test_check_stream_strategy_defaults_to_all— default preservedtest_check_stream_rejects_unsupported_strategy— validation for unknown valuestest_check_stream_any_of_returns_success_when_first_stream_is_available— short-circuits on first successtest_check_stream_any_of_returns_success_when_later_stream_is_availabletest_check_stream_any_of_fails_only_when_all_streams_are_unavailable— aggregated failure message references each rejected candidatetest_check_stream_all_strategy_fails_if_any_stream_is_unavailable—allsemantics preservedAnd factory-level tests in
test_model_to_component_factory.py:test_create_check_stream— strategy defaults to"all"when the manifest omits the fieldtest_create_check_stream_with_any_of_strategy— manifeststrategy: any_ofround-trips through the factoryAll 39 tests in
unit_tests/sources/declarative/checks/test_check_stream.pypass locally. Ruff check/format and mypy are clean on the touched files.Review & Testing Checklist for Human
strategyenum + default onCheckStreamindeclarative_component_schema.yamlmatches the design intent from airbytehq/airbyte-internal-issues#16231 (phase 1).any_offailure message format is acceptable for end users (currently:None of the configured check streams were available. Stream X is not available: ...; Stream Y is not available: ...).declarative_component_schema.pyis equivalent to whatbin/generate-component-manifest-dagger.shwould regenerate from the YAML — I couldn't run the Dagger-based regeneration in this environment, so I mirrored the existing pattern used forScopesJoinStrategymanually.strategy: any_ofon one of the connectors cited in the issue (HubSpot / Salesforce / GitHub) to validate the end-to-end UX.Notes
stream_name not in source.streams(config)) is kept as-is for both strategies: if a manifest author lists a stream that is not part of the resolved catalog, we still raiseValueError. This is a manifest-author bug, distinct from the user-side availability problem theany_ofstrategy targets.use_for_checktag, and the protocol-levelconfigured_catalogchange) are intentionally left for follow-up PRs per the proposed phasing in the issue.Link to Devin session: https://app.devin.ai/sessions/aad1e769a24649299440898c94ce2a03