-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
SAT: improve check_if_cursor_field_was_changed
to make it less strict
#15835
SAT: improve check_if_cursor_field_was_changed
to make it less strict
#15835
Conversation
check_if_cursor_field_was_changed
to make it less radical
check_if_cursor_field_was_changed
to make it less radicalcheck_if_cursor_field_was_changed
to make it less strict
@@ -944,7 +944,7 @@ def as_pytest_param(self): | |||
# Checking that all transitions in FAILING_SPEC_TRANSITIONS have should_fail == True to prevent typos | |||
assert all([transition.should_fail for transition in FAILING_SPEC_TRANSITIONS]) | |||
# Checking that all transitions in VALID_SPEC_TRANSITIONS have should_fail = False to prevent typos | |||
assert not all([transition.should_fail for transition in VALID_SPEC_TRANSITIONS]) | |||
assert not any([transition.should_fail for transition in VALID_SPEC_TRANSITIONS]) |
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.
This assertion was not working correctly.
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.
perhaps assert all([not transition.should_fail for transition in VALID_SPEC_TRANSITIONS])
is more readable?
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.
mainly just one Q and then a nit 👍
@@ -227,5 +227,6 @@ def check_if_stream_was_removed(self, diff: DeepDiff): | |||
|
|||
def check_if_cursor_field_was_changed(self, diff: DeepDiff): | |||
"""Check if a default cursor field value was changed.""" | |||
if diff: | |||
invalid_changes = {"values_changed", "iterable_item_added", "iterable_item_removed"} | |||
if diff and set(diff.keys()).issubset(invalid_changes): |
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.
could this now pass in a case where we have a new stream but also breaking cursor field change on another stream?
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.
Thank for the suggestion, I added a corresponding test case and discovered the check was not robust enough: improved in 3231e6d
@@ -944,7 +944,7 @@ def as_pytest_param(self): | |||
# Checking that all transitions in FAILING_SPEC_TRANSITIONS have should_fail == True to prevent typos | |||
assert all([transition.should_fail for transition in FAILING_SPEC_TRANSITIONS]) | |||
# Checking that all transitions in VALID_SPEC_TRANSITIONS have should_fail = False to prevent typos | |||
assert not all([transition.should_fail for transition in VALID_SPEC_TRANSITIONS]) | |||
assert not any([transition.should_fail for transition in VALID_SPEC_TRANSITIONS]) |
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.
perhaps assert all([not transition.should_fail for transition in VALID_SPEC_TRANSITIONS])
is more readable?
@@ -1197,7 +1223,7 @@ def test_validate_previous_configs(previous_connector_spec, actual_connector_spe | |||
# Checking that all transitions in FAILING_CATALOG_TRANSITIONS have should_fail == True to prevent typos | |||
assert all([transition.should_fail for transition in FAILING_CATALOG_TRANSITIONS]) | |||
# Checking that all transitions in VALID_CATALOG_TRANSITIONS have should_fail = False to prevent typos | |||
assert not all([transition.should_fail for transition in VALID_CATALOG_TRANSITIONS]) | |||
assert not any([transition.should_fail for transition in VALID_CATALOG_TRANSITIONS]) |
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.
similar here
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.
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.
LGTM! Nice one 👍
/publish connector=bases/source-acceptance-test auto-bump-version=false
if you have connectors that successfully published but failed definition generation, follow step 4 here |
What
Closing #15692
The current implementation of
check_if_cursor_field_was_changed
is too strict: it fails if a new stream is added to the catalog:.How
airbyte/airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/utils/backward_compatibility.py
Lines 228 to 232 in 26a4e19
Recommended reading order
test_backward_compatibility.py
backward_compatibility.py
🚨 User Impact 🚨
PRs adding new streams to a connector catalog should have their acceptance test pass now.