Skip to content

Conversation

@maxi297
Copy link
Contributor

@maxi297 maxi297 commented Aug 20, 2025

What

We are applying Connector Builder stream slice limit to real syncs

Repro steps:

version: 6.60.7

type: DeclarativeSource

check:
  type: CheckStream
  stream_names:
    - pokemon

streams:
  - type: DeclarativeStream
    name: pokemon
    retriever:
      type: SimpleRetriever
      partition_router:
        type: ListPartitionRouter
        values:
          - bulbasaur
          - ivysaur
          - venusaur
          - charmander
          - charmeleon
          - charizard
        cursor_field: name
      requester:
        type: HttpRequester
        url: https://pokeapi.co/api/v2/pokemon/{{ stream_partition.name }}
        http_method: GET
      record_selector:
        type: RecordSelector
        extractor:
          type: DpathExtractor
          field_path:
            - abilities
    schema_loader:
      type: InlineSchemaLoader
      schema:
        type: object
        $schema: http://json-schema.org/schema#
        properties:
          any:
            type:
              - string
              - "null"
        additionalProperties: true

spec:
  type: Spec
  connection_specification:
    type: object
    $schema: http://json-schema.org/draft-07/schema#
    required: []
    properties: {}
    additionalProperties: true

Before the change: {"type":"LOG","log":{"level":"INFO","message":"Read 10 records from pokemon stream"}}
After the change: {"type":"LOG","log":{"level":"INFO","message":"Read 12 records from pokemon stream"}}

How

Remove the casting of the StreamSlicer. This should be fine for Connector Builder stuff because we will only take this code path when it is not Connector Builder stuff (see this condition).

Summary by CodeRabbit

  • Bug Fixes

    • Removed an inadvertent slice-processing cap that could truncate data in sliced streams, ensuring all slices are processed and data is complete.
  • Performance

    • Sliced syncs with many partitions may take longer, as all slices are now processed without a limit.
  • Stability

    • Improves consistency of incremental and partitioned reads by aligning slice handling with expected behavior.

@github-actions github-actions bot added bug Something isn't working security labels Aug 20, 2025
@github-actions
Copy link

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

Testing This CDK Version

You 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@maxi297/fix-faulty-merge#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 maxi297/fix-faulty-merge

Helpful Resources

PR Slash Commands

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

  • /autofix - Fixes most formatting and linting issues
  • /poetry-lock - Updates poetry.lock file
  • /test - Runs connector tests with the updated CDK
  • /poe build - Regenerate git-committed build artifacts, such as the pydantic models which are generated from the manifest JSON schema in YAML.
  • /poe <command> - Runs any poe command in the CDK environment

📝 Edit this welcome message.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 20, 2025

📝 Walkthrough

Walkthrough

The stream slicer passed to StreamSlicerPartitionGenerator in create_declarative_stream was changed from a StreamSlicerTestReadDecorator-wrapped combined_slicers (enforcing a per-slice limit) to the raw combined_slicers, effectively removing the per-slice fetch limit. No public signatures were altered.

Changes

Cohort / File(s) Summary of changes
Declarative stream slicer construction
airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py
Replaced StreamSlicerTestReadDecorator(combined_slicers, max_slices) with direct combined_slicers when initializing StreamSlicerPartitionGenerator, removing the test-read slice limit.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Config
  participant Factory as model_to_component_factory
  participant Slicer as StreamSlicerPartitionGenerator
  participant Source

  Note over Factory: New flow (no decorator)
  Config->>Factory: create_declarative_stream()
  Factory->>Factory: build combined_slicers
  Factory->>Slicer: init(stream_slicer=combined_slicers)
  Slicer->>Source: generate partitions (no per-slice cap)
  Source-->>Slicer: slices/partitions
Loading
sequenceDiagram
  autonumber
  participant Config
  participant Factory as model_to_component_factory
  participant Decorator as StreamSlicerTestReadDecorator
  participant Slicer as StreamSlicerPartitionGenerator
  participant Source

  Note over Factory,Decorator: Previous flow (with test-read limit)
  Config->>Factory: create_declarative_stream()
  Factory->>Factory: build combined_slicers
  Factory->>Decorator: wrap(combined_slicers, max_number_of_slices)
  Decorator->>Slicer: init(stream_slicer=wrapped_slicer)
  Slicer->>Source: generate limited partitions
  Source-->>Slicer: slices/partitions
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

bug

Suggested reviewers

  • pnilan

Would you like to add or update tests to cover behavior without the per-slice limit, including large-slice scenarios and regression checks for test-read paths, wdyt?

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch maxi297/fix-faulty-merge

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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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/parsers/model_to_component_factory.py (1)

2081-2090: Confirm intent: removing the StreamSlicerTestReadDecorator here also disables test slice limiting for DefaultStream

Passing combined_slicers directly fixes the over-eager “connector builder” limit being applied everywhere. However, it also disables honoring _limit_slices_fetched for streams that go through the DefaultStream path (where previously the decorator capped slices). Do you want to retain slice limiting only when _should_limit_slices_fetched() is true (i.e., in tests or builder), similar to create_simple_retriever/AsyncRetriever, while keeping it off by default for production? If yes, this conditional keeps test ergonomics without reintroducing the KB/CB bug, wdyt?

             partition_generator = StreamSlicerPartitionGenerator(
                 DeclarativePartitionFactory(
                     stream_name,
                     schema_loader,
                     retriever,
                     self._message_repository,
                 ),
-                stream_slicer=combined_slicers,
+                stream_slicer=(
+                    cast(
+                        StreamSlicer,
+                        StreamSlicerTestReadDecorator(
+                            wrapped_slicer=combined_slicers,
+                            maximum_number_of_slices=self._limit_slices_fetched or 5,
+                        ),
+                    )
+                    if self._should_limit_slices_fetched()
+                    else combined_slicers
+                ),
             )

Can you confirm whether any tests rely on _limit_slices_fetched being enforced for streams that hit this DefaultStream path? If so, the conditional above will preserve that behavior only under test/CB modes. Otherwise, we can keep your current change as-is. Wdyt?

📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 02246dc and e40642a.

📒 Files selected for processing (1)
  • airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: Check: source-pokeapi
  • GitHub Check: Check: destination-motherduck
  • GitHub Check: Check: source-intercom
  • 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)
  • GitHub Check: Analyze (python)

@maxi297 maxi297 requested review from brianjlai and lmossman August 20, 2025 16:49
@github-actions
Copy link

PyTest Results (Fast)

3 694 tests  ±0   3 683 ✅ ±0   6m 29s ⏱️ -12s
    1 suites ±0      11 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit e40642a. ± Comparison against base commit 02246dc.

Copy link
Contributor

@lmossman lmossman left a comment

Choose a reason for hiding this comment

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

Change LGTM, did not test

@github-actions
Copy link

PyTest Results (Full)

3 697 tests  ±0   3 686 ✅ ±0   9m 34s ⏱️ -4s
    1 suites ±0      11 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit e40642a. ± Comparison against base commit 02246dc.

@maxi297 maxi297 merged commit 2ccff10 into main Aug 20, 2025
30 checks passed
@maxi297 maxi297 deleted the maxi297/fix-faulty-merge branch August 20, 2025 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants