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.