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.
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_stateexists, the migration is skipped entirely. Would you consider merging child state into existingparent_statein some scenarios, or is this all-or-nothing approach intentional? wdyt?
306-349: Heads-up about handling multiple cursor_fields.If
cursor_fieldis a list, the logic storingsubstream_stateinparent_config.stream.cursor_fieldmight 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.
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, aKeyErrorcould 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_KEYand_GLOBAL_STATE_KEYare absent, the entirestream_stateis 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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
unit_tests/sources/declarative/incremental/test_concurrent_perpartitioncursor.py (1)
1385-1403: Unusedtest_nameparameter (nitpick)
In your second@pytest.mark.parametrizedefinition, the function signature includestest_name, but it doesn’t appear to be used. Perhaps removing thetest_nameparameter 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)
|
Regression tests for Jira: https://github.com/airbytehq/airbyte/actions/runs/12955458269/job/36139617550 |
Summary by CodeRabbit
Refactor
Tests