fix(backend): Update Subscription and SubscriptionItem resources#9196
fix(backend): Update Subscription and SubscriptionItem resources#9196dstaley wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: d40a9c3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📝 WalkthroughWalkthroughBilling subscription JSON contracts now include instance, pricing, totals, and seat fields. Shared billing converters normalize nested billing data, and subscription resources expose the converted structures through updated factories and constructors. Changes
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.changeset/tame-bats-tell.md:
- Around line 2-5: Update the changeset entry for `@clerk/backend` from minor to
major to reflect the breaking BillingSubscription and BillingSubscriptionItem
API changes, and add migration guidance covering the constructor shape and
nextPayment.amount type updates.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Repository UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 544eaf57-70d6-4fc0-820a-de60667aa155
📒 Files selected for processing (5)
.changeset/tame-bats-tell.mdpackages/backend/src/api/resources/CommerceSubscription.tspackages/backend/src/api/resources/CommerceSubscriptionItem.tspackages/backend/src/api/resources/JSON.tspackages/backend/src/util/billing.ts
| '@clerk/backend': minor | ||
| --- | ||
|
|
||
| Update fields for BillingSubscription and BillingSubscriptionItem |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
cat packages/backend/package.json
rg -n -C 3 '\b(BillingSubscription|BillingSubscriptionItem)\b' packages/backend/srcRepository: clerk/javascript
Length of output: 24693
🏁 Script executed:
#!/bin/bash
set -euo pipefail
sed -n '1,140p' packages/backend/src/api/resources/CommerceSubscription.ts
printf '\n---\n'
sed -n '1,140p' packages/backend/src/api/resources/CommerceSubscriptionItem.ts
printf '\n---\n'
sed -n '140,190p' packages/backend/src/index.ts
printf '\n---\n'
sed -n '1,80p' .changeset/tame-bats-tell.mdRepository: clerk/javascript
Length of output: 10343
Require a major changeset for the Billing API surface BillingSubscription and BillingSubscriptionItem are exported from @clerk/backend, so the constructor shape and nextPayment.amount type change are breaking API changes. Update this changeset to major and add migration guidance.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.changeset/tame-bats-tell.md around lines 2 - 5, Update the changeset entry
for `@clerk/backend` from minor to major to reflect the breaking
BillingSubscription and BillingSubscriptionItem API changes, and add migration
guidance covering the constructor shape and nextPayment.amount type updates.
Source: Coding guidelines
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
API Changes Report
Summary
🔴 Breaking changes index (7)Every breaking change, up front. Full diffs are in the package sections below.
@clerk/backendCurrent version: 3.11.7 🔴 Breaking Changes (7)Changed:
|
|
@macroscope-app review |
|
Manual reviews triggered for commit All prior checks · these links stay valid even if you push more commits. |
|
Review in progress. Results will be posted as check runs when complete. |
ApprovabilityVerdict: Needs human review This PR modifies billing-related resources which are treated as sensitive. Additionally, there's an unresolved comment noting that the type change to You can customize Macroscope's approvability policy. Learn more. |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/backend/src/api/resources/CommerceSubscriptionItem.ts (1)
38-44: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winUpdate the backend API documentation for the new payment shape.
nextPayment.amountis nowBillingMoneyAmountand includesperUnitTotals/totals, whileclerk-docsstill documents the older{ amount, date }shape. Update the public documentation with this API change.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/backend/src/api/resources/CommerceSubscriptionItem.ts` around lines 38 - 44, Update the public clerk-docs documentation for the nextPayment API shape to match CommerceSubscriptionItem: document amount as BillingMoneyAmount and include the optional perUnitTotals and totals fields alongside date. Replace the older { amount, date } representation without changing unrelated subscription documentation.Sources: Coding guidelines, Linked repositories
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@packages/backend/src/api/resources/CommerceSubscriptionItem.ts`:
- Around line 38-44: Update the public clerk-docs documentation for the
nextPayment API shape to match CommerceSubscriptionItem: document amount as
BillingMoneyAmount and include the optional perUnitTotals and totals fields
alongside date. Replace the older { amount, date } representation without
changing unrelated subscription documentation.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: e7a1b51e-6fc9-445d-a608-d21220fb711f
📒 Files selected for processing (1)
packages/backend/src/api/resources/CommerceSubscriptionItem.ts
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
clerk/clerk_go(manual)clerk/dashboard(manual)clerk/accounts(manual)clerk/backoffice(manual)clerk/clerk(manual)clerk/clerk-docs(manual)clerk/cloudflare-workers(manual)
Description
This PR updates the parsing logic for
BillingSubscriptionandBillingSubscriptionItemin the@clerk/backendpackage to align with the latest response shapes for the Backend API.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change