Skip to content

Conversation

@darynaishchenko
Copy link
Contributor

@darynaishchenko darynaishchenko commented Apr 28, 2025

For client side incremental sync use transform_before_filtering from manifest, default True if not provided

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of the transform_before_filtering setting to ensure consistent behavior based on configuration without altering internal state.
  • Tests

    • Added tests to verify the correct behavior of the transform_before_filtering option with client-side incremental syncs.

@darynaishchenko darynaishchenko self-assigned this Apr 28, 2025
@github-actions github-actions bot added the bug Something isn't working label Apr 28, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 28, 2025

📝 Walkthrough

Walkthrough

The changes update the logic for handling the transform_before_filtering attribute in the create_record_selector method within the model-to-component factory. Instead of mutating the model instance based on the attribute's value, the code now uses local variable assignment with conditional expressions to determine the correct value for transform_before_filtering. Additionally, a new parameterized test is added to verify that the transform_before_filtering attribute behaves as expected for streams configured with is_client_side_incremental, covering different input scenarios.

Changes

File(s) Change Summary
airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py Refactored the logic for determining the value of transform_before_filtering in the create_record_selector method to use local variables and conditional expressions instead of mutating the model instance. The assignment now preserves the original value unless it is None, in which case it defaults to False or True based on context.
unit_tests/sources/declarative/test_concurrent_declarative_source.py Added a parameterized test test_stream_using_is_client_side_incremental_has_transform_before_filtering_according_to_manifest to verify that the transform_before_filtering attribute on the stream's record_selector matches the manifest or defaults to True when is_client_side_incremental is enabled and the attribute is not set.

Sequence Diagram(s)

sequenceDiagram
    participant Test as Test Function
    participant Manifest as Manifest (deep copy)
    participant Source as ConcurrentDeclarativeSource
    participant Stream as DefaultStream
    participant Selector as RecordSelector

    Test->>Manifest: Enable is_client_side_incremental
    Test->>Manifest: Set transform_before_filtering (True/False/None)
    Test->>Source: Instantiate with Manifest and state
    Source->>Stream: Group streams
    Stream->>Selector: Access record_selector
    Test->>Selector: Assert transform_before_filtering as expected
Loading

Possibly related PRs

Suggested labels

bug

Suggested reviewers

  • tolik0

Would you like to consider adding more test cases for other attributes affected by similar logic, 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 37516af and 765017f.

📒 Files selected for processing (1)
  • unit_tests/sources/declarative/test_concurrent_declarative_source.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • unit_tests/sources/declarative/test_concurrent_declarative_source.py
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Check: 'source-pokeapi' (skip=false)
  • GitHub Check: Check: 'source-amplitude' (skip=false)
  • GitHub Check: Check: 'source-shopify' (skip=false)
  • GitHub Check: Check: 'source-hardcoded-records' (skip=false)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
  • GitHub Check: SDM Docker Image Build
  • GitHub Check: Pytest (Fast)
  • GitHub Check: Analyze (python)
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
✨ 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3a9d54b and 37516af.

📒 Files selected for processing (2)
  • airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py (2 hunks)
  • unit_tests/sources/declarative/test_concurrent_declarative_source.py (2 hunks)
🧰 Additional context used
🪛 GitHub Actions: Linters
unit_tests/sources/declarative/test_concurrent_declarative_source.py

[error] 5-55: Ruff: Import block is un-sorted or un-formatted. Organize imports. 1 error found, fixable with '--fix' option.

⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Check: 'source-pokeapi' (skip=false)
  • GitHub Check: Check: 'source-amplitude' (skip=false)
  • GitHub Check: Check: 'source-shopify' (skip=false)
  • GitHub Check: Check: 'source-hardcoded-records' (skip=false)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
  • GitHub Check: SDM Docker Image Build
  • GitHub Check: Pytest (Fast)
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
  • GitHub Check: Analyze (python)
🔇 Additional comments (2)
airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py (1)

2830-2846: Improvement to transform_before_filtering handling

This change looks good! Instead of mutating the model attributes directly, you're now properly using a local variable with conditional expressions. This preserves any explicit value set in the manifest while still defaulting to True when needed for client-side incremental sync.

The approach is cleaner and respects configuration settings better. Nice work!

unit_tests/sources/declarative/test_concurrent_declarative_source.py (1)

1880-1941: Well-structured test for transform_before_filtering behavior!

This test nicely verifies that transform_before_filtering is correctly set from the manifest when is_client_side_incremental=true. The parameterized approach covers all cases elegantly - explicit True/False values and the default behavior.

@darynaishchenko
Copy link
Contributor Author

darynaishchenko commented Apr 28, 2025

/autofix

Auto-Fix Job Info

This job attempts to auto-fix any linting or formating issues. If any fixes are made,
those changes will be automatically committed and pushed back to the PR.

Note: This job can only be run by maintainers. On PRs from forks, this command requires
that the PR author has enabled the Allow edits from maintainers option.

PR auto-fix job started... Check job output.

✅ Changes applied successfully.

Copy link
Contributor

@brianjlai brianjlai left a comment

Choose a reason for hiding this comment

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

🚢

@darynaishchenko darynaishchenko merged commit 8ef954c into main Apr 29, 2025
26 of 28 checks passed
@darynaishchenko darynaishchenko deleted the daryna/low-code/fix-client-side-incremental-transforming branch April 29, 2025 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants