fix(source-stripe): include canceled subscriptions in initial backfill#338
Open
janpio wants to merge 2 commits into
Open
fix(source-stripe): include canceled subscriptions in initial backfill#338janpio wants to merge 2 commits into
janpio wants to merge 2 commits into
Conversation
|
|
531fab2 to
8212d8f
Compare
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>
8212d8f to
da890f8
Compare
Author
|
Tests are waiting for approval in https://github.com/stripe/sync-engine/actions/runs/26182975327?pr=338 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add support for passing extra query parameters on list API calls to ensure canceled resources are included in syncs. Stripe's
/v1/subscriptionsand/v1/subscription_schedulesendpoints exclude canceled items by default, causing the initial backfill to miss them entirely.extraQueryParamsoptional parameter tobuildListFn()inpackages/openapiLIST_EXTRA_QUERY_PARAMSmapping inpackages/source-stripeto passstatus=allfor subscriptions andscope=allfor subscription schedulesHow 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 callspackages/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 schedulesRelated