Skip to content

fix(source-twilio): Resume messages from saved cursor#78359

Draft
devin-ai-integration[bot] wants to merge 3 commits into
masterfrom
devin/1779451568-twilio-messages-state
Draft

fix(source-twilio): Resume messages from saved cursor#78359
devin-ai-integration[bot] wants to merge 3 commits into
masterfrom
devin/1779451568-twilio-messages-state

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

What

Fix the Twilio messages stream so incremental syncs resume from the saved global date_sent cursor instead of an older per-partition cursor.

Resolves https://github.com/airbytehq/oncall/issues/12688:

How

  • Enable global_substream_cursor for messages, which uses one account-level time cursor for the stream and avoids continuing to track stale per-partition cursors.
  • Migrate existing mixed messages state that already contains a stream-level state.date_sent value into the global cursor shape expected by the concurrent cursor.
  • Update focused stream tests to cover the saved global state shape and a mixed legacy state where the global cursor is newer than partition state.
  • Bump source-twilio to 1.0.1 and add a changelog entry.

Reproduction

  • Reproduced the state-handling failure with a focused test that passes mixed messages state containing a newer global state.date_sent cursor and an older per-partition cursor.
  • The test verifies the connector requests Twilio with DateSent> equal to the global cursor value instead of the stale partition cursor.

Declarative-First Evaluation

source-twilio is a low-code/manifest connector. The main behavior change is declarative: messages now uses the built-in DatetimeBasedCursor global_substream_cursor option. I also evaluated RecordFilter, AddFields / RemoveFields, DefaultPaginator, SubstreamPartitionRouter, HttpRequester error handlers, transformations, and $ref overrides; those do not migrate already-persisted mixed state. The custom state migration change is limited to converting existing mixed messages state with state.date_sent into the global cursor shape.

Breaking Change Evaluation

Not breaking. This does not change schemas, primary keys, cursor field, stream availability, or required config. The connector state format change is handled by a state migration, so users do not need to reset or clear data.

Test Coverage

  • cd /home/ubuntu/repos/airbyte/airbyte-integrations/connectors/source-twilio/unit_tests && poetry run pytest test_streams.py::TestIncrementalTwilioStream::test_messages_prefers_global_cursor_over_partition_state -x
  • cd /home/ubuntu/repos/airbyte/airbyte-integrations/connectors/source-twilio/unit_tests && poetry run pytest . -x
  • cd /home/ubuntu/repos/airbyte/airbyte-integrations/connectors/source-twilio && poe test-unit-tests
  • cd /home/ubuntu/repos/airbyte/airbyte-integrations/connectors/source-twilio && poe format-check

poe lint-check was not runnable because the shared manifest-only connector task definition currently has an unmatched quote in poe-tasks/manifest-only-connector-tasks.toml. The manifest-only connector's configured format-check task reports no format step.

Review guide

  1. airbyte-integrations/connectors/source-twilio/manifest.yaml
  2. airbyte-integrations/connectors/source-twilio/components.py
  3. airbyte-integrations/connectors/source-twilio/unit_tests/test_streams.py
  4. airbyte-integrations/connectors/source-twilio/metadata.yaml
  5. docs/integrations/sources/twilio.md

User Impact

Twilio messages incremental syncs should resume from the stream-level saved date_sent cursor and avoid re-reading old message history when stale partition state is present.

Can this PR be safely reverted and rolled back?

  • YES 💚
  • NO ❌

Link to Devin session: https://app.devin.ai/sessions/de88b2a7c1e442cf946bc22cce02e065

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@github-actions

Copy link
Copy Markdown
Contributor

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

💡 Show Tips and Tricks

PR Slash Commands

Airbyte Maintainers (that's you!) can execute the following slash commands on your PR:

  • 🛠️ Quick Fixes
    • /format-fix - Fixes most formatting issues.
    • /bump-version - Bumps connector versions, scraping changelog description from the PR title.
      • Bump types: patch (default), minor, major, major_rc, rc, promote.
      • The rc type is a smart default: applies minor_rc if stable, or bumps the RC number if already RC.
      • The promote type strips the RC suffix to finalize a release.
      • Example: /bump-version type=rc or /bump-version type=minor
    • /bump-progressive-rollout-version - Alias for /bump-version type=rc. Bumps with an RC suffix and enables progressive rollout.
  • ❇️ AI Testing and Review (internal link: AI-SDLC Docs):
    • /ai-prove-fix - Runs prerelease readiness checks, including testing against customer connections.
    • /ai-canary-prerelease - Rolls out prerelease to 5-10 connections for canary testing.
    • /ai-review - AI-powered PR review for connector safety and quality gates.
  • 📝 AI Documentation:
    • /ai-docs-review - AI-powered documentation review for PRs with connector changes.
    • /ai-create-docs-pr - Creates a documentation PR for connector changes, stacked on the current PR.
  • 🚀 Connector Releases:
    • /publish-connectors-prerelease - Publishes pre-release connector builds (tagged as {version}-preview.{git-sha}) for all modified connectors in the PR.
  • ☕️ JVM connectors:
    • /update-connector-cdk-version connector=<CONNECTOR_NAME> - Updates the specified connector to the latest CDK version.
      Example: /update-connector-cdk-version connector=destination-bigquery
  • 🐍 Python connectors:
    • /poe connector source-example lock - Run the Poe lock task on the source-example connector, committing the results back to the branch.
    • /poe source example lock - Alias for /poe connector source-example lock.
    • /poe source example use-cdk-branch my/branch - Pin the source-example CDK reference to the branch name specified.
    • /poe source example use-cdk-latest - Update the source-example CDK dependency to the latest available version.
  • ⚙️ Admin commands:
    • /force-merge reason="<REASON>" - Force merges the PR using admin privileges, bypassing CI checks. Requires a reason.
      Example: /force-merge reason="CI is flaky, tests pass locally"
📚 Show Repo Guidance

Helpful Resources

📝 Edit this welcome message.

@github-actions

Copy link
Copy Markdown
Contributor

source-twilio Connector Test Results

25 tests   22 ✅  33s ⏱️
 2 suites   3 💤
 2 files     0 ❌

Results for commit 81ad59a.

@github-actions

Copy link
Copy Markdown
Contributor

Deploy preview for airbyte-docs ready!

Project:airbyte-docs
Status: ✅  Deploy successful!
Preview URL:https://airbyte-docs-a9m6psls4-airbyte-growth.vercel.app
Latest Commit:81ad59a

Deployed with vercel-action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant