Skip to content

fix(source-stripe): include canceled subscriptions in initial backfill#338

Open
janpio wants to merge 2 commits into
stripe:devfrom
janpio:claude/fix-sync-engine-336-Wj8Yw
Open

fix(source-stripe): include canceled subscriptions in initial backfill#338
janpio wants to merge 2 commits into
stripe:devfrom
janpio:claude/fix-sync-engine-336-Wj8Yw

Conversation

@janpio
Copy link
Copy Markdown

@janpio janpio commented May 19, 2026

Summary

Add support for passing extra query parameters on list API calls to ensure canceled resources are included in syncs. Stripe's /v1/subscriptions and /v1/subscription_schedules endpoints exclude canceled items by default, causing the initial backfill to miss them entirely.

  • Add extraQueryParams optional parameter to buildListFn() in packages/openapi
  • Define LIST_EXTRA_QUERY_PARAMS mapping in packages/source-stripe to pass status=all for subscriptions and scope=all for subscription schedules
  • Wire extra params through the resource registry when building list functions

How to test

Added comprehensive unit tests:

  • packages/openapi/__tests__/listFnResolver.test.ts: Two new tests verify extra query params are appended to both v1 and v2 list calls
  • packages/source-stripe/src/resourceRegistry.test.ts: Two new tests mock fetch and verify the correct status/scope params are passed when listing subscriptions and subscription schedules

Related

@cla-assistant
Copy link
Copy Markdown

cla-assistant Bot commented May 19, 2026

CLA assistant check
All committers have signed the CLA.

@cla-assistant
Copy link
Copy Markdown

cla-assistant Bot commented May 19, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@janpio janpio force-pushed the claude/fix-sync-engine-336-Wj8Yw branch from 531fab2 to 8212d8f Compare May 20, 2026 18:43
janpio and others added 2 commits May 20, 2026 18:47
Stripe's /v1/subscriptions endpoint excludes canceled subscriptions by
default. The list-based backfill therefore missed them entirely, and
only canceled subscriptions that triggered webhook events made it into
the destination database.

Pass status=all on the subscriptions list endpoint so the backfill
returns subscriptions in every status (including canceled).

To support this, buildListFn now accepts optional extraQueryParams that
are appended to every request — keeping endpoint-specific quirks like
this expressible per-resource in the registry without leaking into the
generic ListParams type.

Fixes stripe#336

Co-Authored-By: Claude <noreply@anthropic.com>
Stripe's /v1/subscription_schedules endpoint defaults to scope=not_canceled,
mirroring the issue stripe#336 problem on /v1/subscriptions. Pass scope=all so
canceled schedules are picked up by the initial backfill too.

Also add resourceRegistry tests that lock in the wiring for both
subscription (status=all) and subscription_schedule (scope=all).

Co-Authored-By: Claude <noreply@anthropic.com>
@janpio janpio force-pushed the claude/fix-sync-engine-336-Wj8Yw branch from 8212d8f to da890f8 Compare May 20, 2026 18:47
@janpio janpio marked this pull request as ready for review May 20, 2026 18:48
@janpio
Copy link
Copy Markdown
Author

janpio commented May 20, 2026

Tests are waiting for approval in https://github.com/stripe/sync-engine/actions/runs/26182975327?pr=338

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Canceled subscriptions are not being backfilled

1 participant