Skip to content

feat: make use_parent_params configurable #633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 1, 2025

Conversation

ChristoGrab
Copy link
Collaborator

@ChristoGrab ChristoGrab commented Jul 1, 2025

What

In version 6.43.1 we introduced the use_parent_parameters param to allow parent parameters to take precedence over component parameters when propagating them in a component. However, because we set use_parent_parameters to always be true for dynamic streams, connectors that need to override parent parameters dynamically can no longer do so. This PR makes the parameter configurable in the manifest. We still default to True as I do not want to risk breaking connectors that are already using the parent_param logic.

How

  • Added use_parent_parameters to the DeclarativeDynamicStream schema, making it configurable in the manifest.

Summary by CodeRabbit

  • New Features

    • Added a new option to control whether parent parameters are prioritized over component parameters when configuring dynamic streams. This option defaults to prioritizing parent parameters for compatibility.
  • Tests

    • Introduced new test cases to verify parameter precedence behavior based on the new configuration option in both static and dynamic stream scenarios.

Important

Auto-merge enabled.

This PR is set to merge automatically when all requirements are met.

@github-actions github-actions bot added the enhancement New feature or request label Jul 1, 2025
@ChristoGrab ChristoGrab marked this pull request as ready for review July 1, 2025 22:28
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds configurability for the use_parent_parameters flag in dynamic streams, allowing connectors to override the default parent-parameter precedence.

  • Introduces a new use_parent_parameters field in the Python and YAML schemas (defaulting to True).
  • Updates the manifest loader to read the flag from each dynamic definition instead of hardcoding True.
  • Adds unit tests covering use_parent_parameters behavior.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
unit_tests/sources/declarative/parsers/test_manifest_component_transformer.py Adds tests for use_parent_parameters configuration
airbyte_cdk/sources/declarative/models/declarative_component_schema.py Defines new Pydantic field use_parent_parameters
airbyte_cdk/sources/declarative/manifest_declarative_source.py Reads use_parent_parameters from dynamic definitions
airbyte_cdk/sources/declarative/declarative_component_schema.yaml Adds use_parent_parameters to the JSON schema default
Comments suppressed due to low confidence (2)

unit_tests/sources/declarative/parsers/test_manifest_component_transformer.py:773

  • These print statements do not verify behavior; replace them with explicit assertions to validate expected output.
    print("use_parent_parameters=True:", result_true)

airbyte_cdk/sources/declarative/manifest_declarative_source.py:558

  • The variable dynamic_definition is not defined in this scope; it should be dynamic_stream to match the loop variable.
                use_parent_parameters = dynamic_definition.get("use_parent_parameters", True)

Copy link
Contributor

coderabbitai bot commented Jul 1, 2025

📝 Walkthrough

Walkthrough

A new boolean property, use_parent_parameters, was introduced to the DynamicDeclarativeStream schema and corresponding model. The internal logic in ManifestDeclarativeSource now reads and uses this property to control parameter precedence during dynamic stream configuration. Additional unit tests were added to verify the behavior of this flag.

Changes

File(s) Change Summary
airbyte_cdk/sources/declarative/declarative_component_schema.yaml Added use_parent_parameters boolean property to DynamicDeclarativeStream schema.
airbyte_cdk/sources/declarative/models/declarative_component_schema.py Added use_parent_parameters optional boolean field to DynamicDeclarativeStream model.
airbyte_cdk/sources/declarative/manifest_declarative_source.py Updated _dynamic_stream_configs to use use_parent_parameters from dynamic definition.
unit_tests/sources/declarative/parsers/test_manifest_component_transformer.py Added tests for use_parent_parameters flag and its effect on parameter precedence.

Sequence Diagram(s)

sequenceDiagram
    participant ManifestDeclarativeSource
    participant ManifestComponentTransformer

    ManifestDeclarativeSource->>ManifestDeclarativeSource: Read dynamic_definition
    ManifestDeclarativeSource->>ManifestDeclarativeSource: Extract use_parent_parameters (default True)
    ManifestDeclarativeSource->>ManifestComponentTransformer: propagate_types_and_parameters(..., use_parent_parameters)
    ManifestComponentTransformer-->>ManifestDeclarativeSource: Return transformed component with correct parameter precedence
Loading

Possibly related PRs

Suggested reviewers

  • maxi297 (Would you like to take a look at these schema and propagation logic changes, wdyt?)

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f2f17f7 and 951053d.

📒 Files selected for processing (1)
  • unit_tests/sources/declarative/parsers/test_manifest_component_transformer.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • unit_tests/sources/declarative/parsers/test_manifest_component_transformer.py
⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: Check: source-hardcoded-records
  • GitHub Check: Check: source-pokeapi
  • GitHub Check: Check: source-amplitude
  • GitHub Check: Check: source-shopify
  • GitHub Check: Check: source-intercom
  • GitHub Check: SDM Docker Image Build
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
  • GitHub Check: Pytest (Fast)
  • GitHub Check: Analyze (python)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
airbyte_cdk/sources/declarative/declarative_component_schema.yaml (1)

4238-4242: Nice addition — a small doc tweak?

use_parent_parameters is well-defined and the default keeps us backward-compatible 👍.
Would it help future authors if we also add an examples: array (e.g., - false) so generated docs show the toggle in action, wdyt?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1733ec3 and f2f17f7.

📒 Files selected for processing (4)
  • airbyte_cdk/sources/declarative/declarative_component_schema.yaml (1 hunks)
  • airbyte_cdk/sources/declarative/manifest_declarative_source.py (1 hunks)
  • airbyte_cdk/sources/declarative/models/declarative_component_schema.py (2 hunks)
  • unit_tests/sources/declarative/parsers/test_manifest_component_transformer.py (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: ChristoGrab
PR: airbytehq/airbyte-python-cdk#58
File: airbyte_cdk/sources/declarative/yaml_declarative_source.py:0-0
Timestamp: 2024-11-18T23:40:06.391Z
Learning: When modifying the `YamlDeclarativeSource` class in `airbyte_cdk/sources/declarative/yaml_declarative_source.py`, avoid introducing breaking changes like altering method signatures within the scope of unrelated PRs. Such changes should be addressed separately to minimize impact on existing implementations.
airbyte_cdk/sources/declarative/manifest_declarative_source.py (3)
Learnt from: ChristoGrab
PR: airbytehq/airbyte-python-cdk#58
File: airbyte_cdk/sources/declarative/yaml_declarative_source.py:0-0
Timestamp: 2024-11-18T23:40:06.391Z
Learning: When modifying the `YamlDeclarativeSource` class in `airbyte_cdk/sources/declarative/yaml_declarative_source.py`, avoid introducing breaking changes like altering method signatures within the scope of unrelated PRs. Such changes should be addressed separately to minimize impact on existing implementations.
Learnt from: aaronsteers
PR: airbytehq/airbyte-python-cdk#58
File: airbyte_cdk/cli/source_declarative_manifest/_run.py:62-65
Timestamp: 2024-11-15T01:04:21.272Z
Learning: The files in `airbyte_cdk/cli/source_declarative_manifest/`, including `_run.py`, are imported from another repository, and changes to these files should be minimized or avoided when possible to maintain consistency.
Learnt from: aaronsteers
PR: airbytehq/airbyte-python-cdk#58
File: airbyte_cdk/cli/source_declarative_manifest/spec.json:9-15
Timestamp: 2024-11-15T00:59:08.154Z
Learning: When code in `airbyte_cdk/cli/source_declarative_manifest/` is being imported from another repository, avoid suggesting modifications to it during the import process.
airbyte_cdk/sources/declarative/models/declarative_component_schema.py (4)

undefined

<retrieved_learning>
Learnt from: pnilan
PR: airbytehq/airbyte-python-cdk#0
File: :0-0
Timestamp: 2024-12-11T16:34:46.319Z
Learning: In the airbytehq/airbyte-python-cdk repository, the declarative_component_schema.py file is auto-generated from declarative_component_schema.yaml and should be ignored in the recommended reviewing order.
</retrieved_learning>

<retrieved_learning>
Learnt from: ChristoGrab
PR: #58
File: airbyte_cdk/sources/declarative/yaml_declarative_source.py:0-0
Timestamp: 2024-11-18T23:40:06.391Z
Learning: When modifying the YamlDeclarativeSource class in airbyte_cdk/sources/declarative/yaml_declarative_source.py, avoid introducing breaking changes like altering method signatures within the scope of unrelated PRs. Such changes should be addressed separately to minimize impact on existing implementations.
</retrieved_learning>

<retrieved_learning>
Learnt from: aaronsteers
PR: #58
File: airbyte_cdk/cli/source_declarative_manifest/_run.py:62-65
Timestamp: 2024-11-15T01:04:21.272Z
Learning: The files in airbyte_cdk/cli/source_declarative_manifest/, including _run.py, are imported from another repository, and changes to these files should be minimized or avoided when possible to maintain consistency.
</retrieved_learning>

<retrieved_learning>
Learnt from: aaronsteers
PR: #174
File: airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py:1093-1102
Timestamp: 2025-01-14T00:20:32.310Z
Learning: In the airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py file, the strict module name checks in _get_class_from_fully_qualified_class_name (requiring module_name to be "components" and module_name_full to be "source_declarative_manifest.components") are intentionally designed to provide early, clear feedback when class declarations won't be found later in execution. These restrictions may be loosened in the future if the requirements for class definition locations change.
</retrieved_learning>

airbyte_cdk/sources/declarative/declarative_component_schema.yaml (3)

undefined

<retrieved_learning>
Learnt from: pnilan
PR: airbytehq/airbyte-python-cdk#0
File: :0-0
Timestamp: 2024-12-11T16:34:46.319Z
Learning: In the airbytehq/airbyte-python-cdk repository, the declarative_component_schema.py file is auto-generated from declarative_component_schema.yaml and should be ignored in the recommended reviewing order.
</retrieved_learning>

<retrieved_learning>
Learnt from: ChristoGrab
PR: #58
File: airbyte_cdk/sources/declarative/yaml_declarative_source.py:0-0
Timestamp: 2024-11-18T23:40:06.391Z
Learning: When modifying the YamlDeclarativeSource class in airbyte_cdk/sources/declarative/yaml_declarative_source.py, avoid introducing breaking changes like altering method signatures within the scope of unrelated PRs. Such changes should be addressed separately to minimize impact on existing implementations.
</retrieved_learning>

<retrieved_learning>
Learnt from: aaronsteers
PR: #58
File: airbyte_cdk/cli/source_declarative_manifest/_run.py:62-65
Timestamp: 2024-11-15T01:04:21.272Z
Learning: The files in airbyte_cdk/cli/source_declarative_manifest/, including _run.py, are imported from another repository, and changes to these files should be minimized or avoided when possible to maintain consistency.
</retrieved_learning>

🧬 Code Graph Analysis (1)
airbyte_cdk/sources/declarative/manifest_declarative_source.py (1)
airbyte_cdk/sources/declarative/parsers/manifest_component_transformer.py (2)
  • ManifestComponentTransformer (91-226)
  • propagate_types_and_parameters (92-193)
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Check: source-intercom
  • GitHub Check: Check: source-amplitude
  • GitHub Check: Check: source-pokeapi
  • GitHub Check: Check: source-shopify
  • GitHub Check: Check: source-hardcoded-records
  • GitHub Check: SDM Docker Image Build
  • GitHub Check: Pytest (Fast)
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
🔇 Additional comments (6)
airbyte_cdk/sources/declarative/models/declarative_component_schema.py (1)

2963-2967: LGTM! Correctly implements configurable use_parent_parameters feature.

The addition of the use_parent_parameters field to DynamicDeclarativeStream properly addresses the PR objectives. The implementation maintains backward compatibility with the default True value while allowing connectors to override parent parameters when needed. The field typing, description, and title are all appropriate.

Just noting that this file is auto-generated from declarative_component_schema.yaml, so the real source of truth would be the YAML schema file, wdyt?

airbyte_cdk/sources/declarative/manifest_declarative_source.py (2)

556-558: LGTM! Clean parameter extraction with good backward compatibility.

The implementation correctly extracts the use_parent_parameters flag from the dynamic definition with a sensible default value. The comment clearly explains the backward compatibility rationale.


562-562: Perfect! The hardcoded value is now properly configurable.

This change enables the intended functionality while preserving existing behavior through the default value.

unit_tests/sources/declarative/parsers/test_manifest_component_transformer.py (3)

574-649: Excellent test coverage for the parameter precedence logic!

This test thoroughly validates both True and False scenarios for use_parent_parameters, ensuring the flag correctly controls which parameters take precedence. The test structure is clear and the assertions verify the expected behavior well.


652-699: Great backward compatibility validation!

This test ensures that use_parent_parameters=None maintains the existing behavior, which is crucial for not breaking existing implementations. The test clearly validates the default precedence logic.


702-749: Comprehensive validation of dynamic stream parameter behavior!

This test excellently validates the use_parent_parameters functionality in the dynamic stream context, covering both scenarios where only parent parameters exist and where both parent and component parameters are present. This ensures the feature works as intended in its primary use case, wdyt?

Copy link

github-actions bot commented Jul 1, 2025

PyTest Results (Fast)

3 680 tests  +4   3 669 ✅ +4   6m 16s ⏱️ -16s
    1 suites ±0      11 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit 951053d. ± Comparison against base commit 1733ec3.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@aldogonzalez8 aldogonzalez8 left a comment

Choose a reason for hiding this comment

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

APPROVED

@ChristoGrab ChristoGrab enabled auto-merge (squash) July 1, 2025 22:48
Copy link

github-actions bot commented Jul 1, 2025

PyTest Results (Full)

3 683 tests  +4   3 672 ✅ +4   18m 16s ⏱️ +9s
    1 suites ±0      11 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit 951053d. ± Comparison against base commit 1733ec3.

@ChristoGrab ChristoGrab merged commit 2f8310e into main Jul 1, 2025
28 checks passed
@ChristoGrab ChristoGrab deleted the christo/configurable-parent-params branch July 1, 2025 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants