-
Notifications
You must be signed in to change notification settings - Fork 6
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
fix(low-code): Fix declarative low-code state migration in SubstreamPartitionRouter #267
Conversation
📝 WalkthroughWalkthroughThe pull request introduces a refactor of the Changes
Possibly related PRs
Suggested reviewers
Hey there! 👋 I noticed you've done a nice refactoring of the state migration logic. A couple of quick thoughts:
Would love to hear your thoughts on these suggestions! 🚀 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (8)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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)
unit_tests/sources/declarative/partition_routers/test_substream_partition_router.py (1)
467-475
: Possible typo in 'looback_window'?It appears "looback_window" might be a misspelling of "loopback_window". Would you confirm it's intentional or rename it for clarity? wdyt?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
airbyte_cdk/sources/declarative/partition_routers/substream_partition_router.py
(1 hunks)unit_tests/sources/declarative/partition_routers/test_substream_partition_router.py
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: Check: 'source-pokeapi' (skip=false)
- GitHub Check: Check: 'source-the-guardian-api' (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: Pytest (Fast)
- GitHub Check: Pytest (All, Python 3.10, Ubuntu)
- GitHub Check: Analyze (python)
🔇 Additional comments (3)
airbyte_cdk/sources/declarative/partition_routers/substream_partition_router.py (2)
298-299
: Consider partial parent_state merges?Currently, if
parent_state
exists, the migration is skipped entirely. Would you consider merging child state into existingparent_state
in some scenarios, or is this all-or-nothing approach intentional? wdyt?
306-349
: Heads-up about handling multiple cursor_fields.If
cursor_field
is a list, the logic storingsubstream_state
inparent_config.stream.cursor_field
might behave unexpectedly. Would you consider validating the field to ensure it's a single string or otherwise handle lists? wdyt?unit_tests/sources/declarative/partition_routers/test_substream_partition_router.py (1)
483-483
: New test ID looks good.Thanks for adding a clear and descriptive test ID. No changes needed.
There was a problem hiding this 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
🔭 Outside diff range comments (1)
airbyte_cdk/sources/declarative/incremental/concurrent_partition_cursor.py (1)
Line range hint
279-285
: Safeguard potential missing keys in the per-partition state dictionary?
Right now, the code assumes"partition"
and"cursor"
keys exist instate
. If these are absent, aKeyError
could occur. Would you consider adding a quick check to ensure these keys exist or handle it gracefully, perhaps raising a user-friendly error if the keys are missing? wdyt?
🧹 Nitpick comments (1)
airbyte_cdk/sources/declarative/incremental/concurrent_partition_cursor.py (1)
267-270
: Add a clarifying log for global-state assumption?
Currently, if both_PERPARTITION_STATE_KEY
and_GLOBAL_STATE_KEY
are absent, the entirestream_state
is assumed to be global. Would you consider adding a brief log or comment here to clarify that assumption for future maintainers? For instance, logging something like: “No known partition keys present; interpreting stream_state as global.” wdyt?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
airbyte_cdk/sources/declarative/incremental/concurrent_partition_cursor.py
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: Check: 'source-pokeapi' (skip=false)
- GitHub Check: Check: 'source-the-guardian-api' (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: Pytest (Fast)
- GitHub Check: Pytest (All, Python 3.10, Ubuntu)
- GitHub Check: Analyze (python)
There was a problem hiding this 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
🧹 Nitpick comments (1)
unit_tests/sources/declarative/incremental/test_concurrent_perpartitioncursor.py (1)
1385-1403
: Unusedtest_name
parameter (nitpick)
In your second@pytest.mark.parametrize
definition, the function signature includestest_name
, but it doesn’t appear to be used. Perhaps removing thetest_name
parameter or using it for descriptive logs might make the tests cleaner, wdyt?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
unit_tests/sources/declarative/incremental/test_concurrent_perpartitioncursor.py
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: Check: 'source-pokeapi' (skip=false)
- GitHub Check: Check: 'source-the-guardian-api' (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: Pytest (Fast)
- GitHub Check: Pytest (All, Python 3.10, Ubuntu)
- GitHub Check: Analyze (python)
unit_tests/sources/declarative/incremental/test_concurrent_perpartitioncursor.py
Show resolved
Hide resolved
Regression tests for Jira: https://github.com/airbytehq/airbyte/actions/runs/12955458269/job/36139617550 |
Summary by CodeRabbit
Refactor
Tests