fix(sync): preserve shape-matched Stripe prices - #2340
Open
charlietlamb wants to merge 1 commit into
Open
Conversation
| /** Only a stored Stripe price identity selects the catalog base price. */ | ||
| export const isBasePriceMatch = (match: ItemMatch): match is AutumnPriceMatch => | ||
| isAutumnPriceMatch(match) && | ||
| matchesOnBasePrice(match) && |
Contributor
There was a problem hiding this comment.
Mapped Catalog Price Becomes Custom
When an unknown Stripe price belongs to the plan's own mapped Stripe product and matches its catalog base shape, this condition now routes it to isCustomBaseMatch. That changes the plan base from a catalog match with an autumn_price_id to a generated customization, so back-sync can persist or provision a custom price even though the owning catalog price was identified.
Prompt To Fix With AI
This is a comment left during a code review.
Path: server/src/internal/billing/v2/providers/stripe/utils/sync/matchUtils/classifyItemMatch.ts
Line: 53
Comment:
**Mapped Catalog Price Becomes Custom**
When an unknown Stripe price belongs to the plan's own mapped Stripe product and matches its catalog base shape, this condition now routes it to `isCustomBaseMatch`. That changes the plan base from a catalog match with an `autumn_price_id` to a generated customization, so back-sync can persist or provision a custom price even though the owning catalog price was identified.
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
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
Tests
bunx tsgo --build --noEmitbun test tests/unit/billing/sync/stripe-sync-currency.test.ts./run.sh tests/integration/billing/sync/sync-multi-currency.test.ts./run.sh tests/integration/billing/sync/sync-plan-version.test.ts./run.sh tests/integration/billing/stripe-webhooks/subscription-created/licenses/sub-created-mobbin-license-backsync.test.tsSummary by cubic
Preserves shape-matched Stripe prices during sync by keeping them as custom prices with the observed Stripe price IDs, and only uses the catalog base price when an exact stored Stripe price identity exists. This fixes plan selection and seat syncing for Mobbin Team quarterly/yearly and keeps Enterprise seats isolated.
Written for commit 7e5c4d0. Summary will update on new commits.
Greptile Summary
This PR preserves shape-matched Stripe prices during subscription back-sync. The main changes are:
Confidence Score: 5/5
The change is mostly safe, but mapped-product shape matches may need to retain their catalog identity.
server/src/internal/billing/v2/providers/stripe/utils/sync/matchUtils/classifyItemMatch.ts
Important Files Changed
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "fix(sync): preserve shape-matched Stripe..." | Re-trigger Greptile
Context used: