Skip to content

Conversation

@tuna1207
Copy link
Member

@tuna1207 tuna1207 commented Nov 11, 2025

Explanation

Add last subscription response in getSubscriptions method

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

Note

Adds lastSubscription to controller state and getSubscriptions response, updates comparison/update logic and metadata, extends Subscription fields, and updates tests/changelog.

  • Subscription Controller:
    • Add lastSubscription to SubscriptionControllerState and wire into getSubscriptions (fetch, compare, persist, expose to UI).
    • Introduce #isSubscriptionEqual and reuse in #areSubscriptionsEqual; update state only when lastSubscription/subscriptions/trialedProducts/customerId change.
    • Update metadata: subscriptions.includeInStateLogsfalse; add persist/usedInUi flags; add metadata for lastSubscription.
  • Types:
    • Extend GetSubscriptionsResponse with lastSubscription.
    • Extend Subscription with canceledAt, inactiveAt, and required isEligibleForSupport.
  • Tests:
    • Update mocks to include isEligibleForSupport.
    • Add test for lastSubscription state update; adjust snapshots for metadata changes.
  • Docs/Changelog:
    • Update CHANGELOG with lastSubscription addition.

Written by Cursor Bugbot for commit d9c1f29. This will update automatically on new commits. Configure here.

@tuna1207 tuna1207 marked this pull request as ready for review November 11, 2025 09:43
@tuna1207 tuna1207 requested review from a team as code owners November 11, 2025 09:43
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: State Log Snapshot Mismatch with Metadata (Bugbot Rules)

The test snapshot for includeInStateLogs still includes subscriptions in the expected output, but the metadata was changed to set includeInStateLogs: false for subscriptions. This will cause the test to fail since the snapshot expects subscriptions to be present but the metadata now excludes it from state logs. The snapshot needs updating to match the new metadata configuration.

packages/subscription-controller/src/SubscriptionController.test.ts#L1073-L1082

paymentTokenAddress: '0xtoken',
productType: PRODUCT_TYPES.SHIELD,
interval: RECURRING_INTERVALS.month,
}),
).toThrow('Product price not found');
},
);
});
it('throws when price not found for interval', async () => {

Fix in Cursor Fix in Web


@chaitanyapotti chaitanyapotti merged commit 0d67473 into main Nov 11, 2025
271 checks passed
@chaitanyapotti chaitanyapotti deleted the feat/user-last-subscription branch November 11, 2025 10:08
@tuna1207
Copy link
Member Author

@metamaskbot publish-preview

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants