Files
twenty/packages/twenty-server
Sonarly Claude Code 2e6519fbd1 fix: restore BillingPlan query backward compatibility
https://sonarly.com/issue/36824?type=bug

The billing page issues a GraphQL query requesting `licensedProducts`, but the backend `BillingPlan` schema no longer exposes that field, causing a 400 GraphQL validation error and a broken `/settings/billing` load for affected sessions.

Fix: I implemented a backward-compatibility fix for `BillingPlan` so old clients querying `licensedProducts` no longer fail GraphQL validation.

Changes made:
1) Reintroduced `licensedProducts` on the backend GraphQL `BillingPlan` type as a deprecated field.
- File: `packages/twenty-server/src/engine/core-modules/billing/dtos/billing-plan.dto.ts`
- Added:
  - `licensedProducts: BillingLicensedProduct[]`
  - `deprecationReason: 'Use baseProducts instead.'`

2) Ensured resolver output actually populates the compatibility field.
- File: `packages/twenty-server/src/engine/core-modules/billing/utils/format-database-product-to-graphql-dto.util.ts`
- Refactored mapped `baseProducts` into a local variable and returned:
  - `baseProducts`
  - `licensedProducts: baseProducts`

3) Updated the existing formatter unit test to assert `licensedProducts` is present and matches the legacy shape.
- File: `packages/twenty-server/src/engine/core-modules/billing/utils/__tests__/format-database-product-to-graphql-dto.util.spec.ts`

This restores compatibility for stale clients while preserving the migrated v2 schema fields (`baseProducts`, `resourceCreditProducts`, `meteredProducts`) and signals deprecation for eventual cleanup.
2026-05-12 09:29:03 +00:00
..
2026-04-02 11:20:08 +00:00
2026-04-02 11:20:08 +00:00