Skip to content
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

🚨🚨 Source Zendesk Support: update cursor for Tickets stream #28774

Merged
merged 21 commits into from Aug 24, 2023

Conversation

artem1205
Copy link
Collaborator

@artem1205 artem1205 commented Jul 27, 2023

What

Resolve https://github.com/airbytehq/oncall/issues/2593

How

Recommended reading order

  1. streams.py

🚨 User Impact 🚨

cursor_field for Tickets stream is changed to generated_timestamp. Need to refresh source schema and make a reset.

Playbook: https://docs.google.com/document/d/1yO70HQkV4Mk1SZriFrCSoynw7E2yz1Civ3KmFJHYNvw/edit

Pre-merge Actions

Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)
  • Unit & integration tests added

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 27, 2023

Before Merging a Connector Pull Request

Wow! What a great pull request you have here! 🎉

To merge this PR, ensure the following has been done/considered for each connector added or updated:

  • PR name follows PR naming conventions
  • Breaking changes are considered. If a Breaking Change is being introduced, ensure an Airbyte engineer has created a Breaking Change Plan.
  • Connector version has been incremented in the Dockerfile and metadata.yaml according to our Semantic Versioning for Connectors guidelines
  • You've updated the connector's metadata.yaml file any other relevant changes, including a breakingChanges entry for major version bumps. See metadata.yaml docs
  • Secrets in the connector's spec are annotated with airbyte_secret
  • All documentation files are up to date. (README.md, bootstrap.md, docs.md, etc...)
  • Changelog updated in docs/integrations/<source or destination>/<name>.md with an entry for the new version. See changelog example
  • Migration guide updated in docs/integrations/<source or destination>/<name>-migrations.md with an entry for the new version, if the version is a breaking change. See migration guide example
  • If set, you've ensured the icon is present in the platform-internal repo. (Docs)

If the checklist is complete, but the CI check is failing,

  1. Check for hidden checklists in your PR description

  2. Toggle the github label checklist-action-run on/off to re-run the checklist CI.

@artem1205 artem1205 marked this pull request as ready for review July 27, 2023 12:47
@artem1205 artem1205 changed the title Source Zendesk Support: add retry test Source Zendesk Support: fix retry logic Jul 27, 2023
@octavia-squidington-iii
Copy link
Collaborator

source-zendesk-support test report (commit 91ecf83723) - ❌

⏲️ Total pipeline duration: 11mn39s

Step Result
Validate airbyte-integrations/connectors/source-zendesk-support/metadata.yaml
Connector version semver check
QA checks
Code format checks
Connector package install
Build source-zendesk-support docker image for platform linux/x86_64
Unit tests
Acceptance tests

🔗 View the logs here

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-zendesk-support test

@artem1205 artem1205 marked this pull request as draft July 27, 2023 13:06
@octavia-squidington-iii octavia-squidington-iii added the area/documentation Improvements or additions to documentation label Jul 27, 2023
@artem1205 artem1205 marked this pull request as ready for review July 27, 2023 14:11
@octavia-squidington-iii
Copy link
Collaborator

source-zendesk-support test report (commit 82ef94779e) - ❌

⏲️ Total pipeline duration: 12mn34s

Step Result
Validate airbyte-integrations/connectors/source-zendesk-support/metadata.yaml
Connector version semver check
QA checks
Code format checks
Connector package install
Build source-zendesk-support docker image for platform linux/x86_64
Unit tests
Acceptance tests

🔗 View the logs here

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-zendesk-support test

@artem1205 artem1205 marked this pull request as draft July 27, 2023 17:45
@artem1205 artem1205 changed the title Source Zendesk Support: fix retry logic 🚨🚨 Source Zendesk Support: update cursor for Tickets stream Jul 27, 2023
@artem1205 artem1205 added the breaking-change Don't merge me unless you are ready. label Jul 27, 2023
@artem1205 artem1205 marked this pull request as ready for review July 27, 2023 17:56
@octavia-squidington-iii
Copy link
Collaborator

source-zendesk-support test report (commit e7e4205447) - ❌

⏲️ Total pipeline duration: 01mn12s

Step Result
Validate airbyte-integrations/connectors/source-zendesk-support/metadata.yaml
Connector version semver check
QA checks
Code format checks
Connector package install
Build source-zendesk-support docker image for platform linux/x86_64
Unit tests

🔗 View the logs here

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-zendesk-support test

@octavia-squidington-iii
Copy link
Collaborator

source-zendesk-support test report (commit 2668b522ff) - ❌

⏲️ Total pipeline duration: 13mn20s

Step Result
Validate airbyte-integrations/connectors/source-zendesk-support/metadata.yaml
Connector version semver check
QA checks
Code format checks
Connector package install
Build source-zendesk-support docker image for platform linux/x86_64
Unit tests
Acceptance tests

🔗 View the logs here

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-zendesk-support test

@octavia-squidington-iii
Copy link
Collaborator

source-zendesk-support test report (commit 2668b522ff) - ❌

⏲️ Total pipeline duration: 12mn32s

Step Result
Validate airbyte-integrations/connectors/source-zendesk-support/metadata.yaml
Connector version semver check
QA checks
Code format checks
Connector package install
Build source-zendesk-support docker image for platform linux/x86_64
Unit tests
Acceptance tests

🔗 View the logs here

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-zendesk-support test

@octavia-squidington-iii
Copy link
Collaborator

source-zendesk-support test report (commit dc3d16dabe) - ❌

⏲️ Total pipeline duration: 12mn10s

Step Result
Validate airbyte-integrations/connectors/source-zendesk-support/metadata.yaml
Connector version semver check
QA checks
Code format checks
Connector package install
Build source-zendesk-support docker image for platform linux/x86_64
Unit tests
Acceptance tests

🔗 View the logs here

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-zendesk-support test

@octavia-squidington-iii
Copy link
Collaborator

source-zendesk-support test report (commit eda859cb3a) - ❌

⏲️ Total pipeline duration: 12mn12s

Step Result
Validate airbyte-integrations/connectors/source-zendesk-support/metadata.yaml
Connector version semver check
QA checks
Code format checks
Connector package install
Build source-zendesk-support docker image for platform linux/x86_64
Unit tests
Acceptance tests

🔗 View the logs here

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-zendesk-support test

@artem1205 artem1205 requested a review from a team August 1, 2023 10:26
…ndesk-check-permissions

# Conflicts:
#	airbyte-integrations/connectors/source-zendesk-support/Dockerfile
#	airbyte-integrations/connectors/source-zendesk-support/metadata.yaml
#	docs/integrations/sources/zendesk-support.md
@octavia-squidington-iii
Copy link
Collaborator

source-zendesk-support test report (commit 9065223c07) - ❌

⏲️ Total pipeline duration: 12mn10s

Step Result
Validate airbyte-integrations/connectors/source-zendesk-support/metadata.yaml
Connector version semver check
Connector version increment check
QA checks
Code format checks
Connector package install
Build source-zendesk-support docker image for platform linux/x86_64
Unit tests
Acceptance tests

🔗 View the logs here

☁️ View runs for commit in Dagger Cloud

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-zendesk-support test

@octavia-squidington-iii
Copy link
Collaborator

source-zendesk-support test report (commit 6a18a879e9) - ✅

⏲️ Total pipeline duration: 12mn15s

Step Result
Validate airbyte-integrations/connectors/source-zendesk-support/metadata.yaml
Connector version semver check
Connector version increment check
QA checks
Code format checks
Connector package install
Build source-zendesk-support docker image for platform linux/x86_64
Unit tests
Acceptance tests

🔗 View the logs here

☁️ View runs for commit in Dagger Cloud

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-zendesk-support test

@artem1205 artem1205 requested review from erohmensing and a team August 9, 2023 17:16
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.

Nice work so far. I had a few questions to clarify how we decide state. Additionally, because this is a breaking change I want to make sure of a few things.

The new cursor value:
In your testing, did you confirm that the incremental/tickets/cursor.json endpoint returns a field with generated_timestamp? I saw it in the tests expected_records.jsonl, but their documentation is quite confusing with a lot of ways to do things. The part that stuck out to me was:

Incremental Ticket Export, Cursor Based (What we use):
https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/#incremental-ticket-export-cursor-based
This doesn’t make mention of the generated_timestamp field in the response.

Incremental Ticket Export, Time Based:
https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/#incremental-ticket-export-time-based
This is the one that explicitly mentioned the generated_timestamp field being present. Although in their response example it also does not include it.

Our code looks to be using the cursor based given how we paginate, but we should double check by making a CURL request that emulates our Ticket stream requests and verify that our expected cursor value generated_timestamp is present.

Lastly, we have some merge conflicts that we should address before final approval.

new_value = (latest_record or {}).get(self.cursor_field, 0)
return {self.cursor_field: max(new_value, old_value)}

def check_stream_state(self, stream_state: Mapping[str, Any] = None):
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add the return type in the signature

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added

if self.sideload_param:
params["include"] = self.sideload_param
if next_page_token:
params.update(next_page_token)
return params

def get_updated_state(self, current_stream_state: MutableMapping[str, Any], latest_record: Mapping[str, Any]) -> Mapping[str, Any]:
old_value = (current_stream_state or {}).get(self.cursor_field, 0)
new_value = (latest_record or {}).get(self.cursor_field, 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we certain that records are transmitted in chronological order and there is no way to get records outside the current slice window? The past Salesforce bug has me cautious about this type of thing.

Is it valid for the stream_state and the latest_record to not have a generated_timestamp value. It doesn't seem right to save a timestamp of 0 as state. That would effectively turn this into an incredibly early sync on the next run (unless we get the max of start_date and state). Regardless, if this condition shouldn't be possible, then it feels more like we should be throwing some type of error

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated with start date

# Conflicts:
#	airbyte-integrations/connectors/source-zendesk-support/Dockerfile
#	airbyte-integrations/connectors/source-zendesk-support/metadata.yaml
#	docs/integrations/sources/zendesk-support.md
@artem1205
Copy link
Collaborator Author

artem1205 commented Aug 13, 2023

@brianjlai ,
I've double checked the responses for tickets stream, records are returned in asc order (based on generated_timestamp).
Reason why we should use this field is better described here.

The updated_at property is not used to record system updates. System updates are recorded by the generated_timestamp property (as are all other ticket updates). The updated_at property is only used for ticket updates that generate a defined ticket event. Therefore, any ticket in the results that was only updated by the system will have a generated_timestamp that's later than the start_time but an updated_at time that's earlier than the start_time.

This situation was discovered during the incremental sync tests: after the initial sync and setting stream_state to the updated_at value of the latest record, we performed a new sync with start_date=stream_state_value in the query to ensure that no records would be returned. However, there were some records in the response, indicating that the filter works on the generated_timestamp field.

@octavia-squidington-iii
Copy link
Collaborator

source-zendesk-support test report (commit e2c92b6319) - ✅

⏲️ Total pipeline duration: 10mn30s

Step Result
Validate airbyte-integrations/connectors/source-zendesk-support/metadata.yaml
Connector version semver check
Connector version increment check
QA checks
Code format checks
Connector package install
Build source-zendesk-support docker image for platform linux/x86_64
Unit tests
Acceptance tests

🔗 View the logs here

☁️ View runs for commit in Dagger Cloud

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-zendesk-support test

@octavia-squidington-iii
Copy link
Collaborator

source-zendesk-support test report (commit 32740b82d7) - ✅

⏲️ Total pipeline duration: 10mn27s

Step Result
Validate airbyte-integrations/connectors/source-zendesk-support/metadata.yaml
Connector version semver check
Connector version increment check
QA checks
Code format checks
Connector package install
Build source-zendesk-support docker image for platform linux/x86_64
Unit tests
Acceptance tests

🔗 View the logs here

☁️ View runs for commit in Dagger Cloud

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-zendesk-support test

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.

Thanks for rechecking the generated_timestamp the changes make sense. Approved, but before we publish and merge, we should coordinate with @erica-airbyte to communicate the breaking change out. I see on the OC that it was to go out 8/10, but lets make sure we're aligned on a new date to release

@erica-airbyte
Copy link
Contributor

@brianjlai is this the exact same change it just didnt go out?

@artem1205
Copy link
Collaborator Author

@erica-airbyte , yes, this is the exact same change it just didnt go out on time

@github-actions
Copy link
Contributor

source-zendesk-support test report (commit 570c9166b6) - ✅

⏲️ Total pipeline duration: 10mn31s

Step Result
Connector package install
Build source-zendesk-support docker image for platform linux/x86_64
Unit tests
Acceptance tests
Code format checks
Validate airbyte-integrations/connectors/source-zendesk-support/metadata.yaml
Connector version semver check
Connector version increment check
QA checks

🔗 View the logs here

☁️ View runs for commit in Dagger Cloud

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-zendesk-support test

@artem1205 artem1205 merged commit 2d8a63c into master Aug 24, 2023
23 checks passed
@artem1205 artem1205 deleted the artem1205/source-zendesk-check-permissions branch August 24, 2023 16:06
Comment on lines +29 to +33
releases:
breakingChanges:
1.0.0:
message: "`cursor_field` for `Tickets` stream is changed to `generated_timestamp`"
upgradeDeadline: "2023-07-19"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a poor breaking change message. Why was this change? What do users need to do to get syncs working again?

harrytou pushed a commit to KYVENetwork/airbyte that referenced this pull request Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation breaking-change Don't merge me unless you are ready. connectors/source/zendesk-support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants