From 24839d044a7088e48031faafa3aa51a48639baf1 Mon Sep 17 00:00:00 2001 From: Charles Bochet Date: Tue, 9 Jun 2026 17:37:51 +0200 Subject: [PATCH] fix(server): repair server typecheck broken by isCustom deprecation (#21376) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What Repairs `server-lint-typecheck`, which is **currently red on `main`**. After #21228 retyped `FlatObjectMetadata.isCustom` as `WasRemovedInUpgrade | undefined`, the spec added in #21311 still passed `flatObjectMetadata.isCustom` to `computeTableName(nameSingular, isCustom: boolean)`: ``` graphql-query-order-group-by.parser.spec.ts(83,5): error TS2345: Argument of type 'WasRemovedInUpgrade | undefined' is not assignable to parameter of type 'boolean'. ``` Both PRs merged via stale bases, and `server-lint-typecheck` only runs on PRs (not `main` pushes), so the regression landed undetected — the next PR to touch anything server-wide surfaces it. ## Fix Compute the expected physical table name with **`computeObjectTargetTable`** — the production helper that derives custom-ness from the application (`applicationUniversalIdentifier !== TWENTY_STANDARD_APPLICATION`), which is exactly the pattern the `isCustom` deprecation steers callers toward. This stops reading the deprecated field and won't break again when it's removed. One-line change in a single test file; behaviour is unchanged (custom object → `_`-prefixed physical table). ## Verification - `nx typecheck twenty-server` ✅ (was failing on `main`, now passes) - The spec runs green (3/3) - `nx lint:diff-with-main twenty-server` ✅ (lint + format) --- .../graphql-query-order-group-by.parser.spec.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/graphql-query-parsers/graphql-query-order/__tests__/graphql-query-order-group-by.parser.spec.ts b/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/graphql-query-parsers/graphql-query-order/__tests__/graphql-query-order-group-by.parser.spec.ts index 520cb443f0..17c3a36015 100644 --- a/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/graphql-query-parsers/graphql-query-order/__tests__/graphql-query-order-group-by.parser.spec.ts +++ b/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/graphql-query-parsers/graphql-query-order/__tests__/graphql-query-order-group-by.parser.spec.ts @@ -15,11 +15,11 @@ import { getFlatFieldMetadataMock } from 'src/engine/metadata-modules/flat-field import { type FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type'; import { getFlatObjectMetadataMock } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/get-flat-object-metadata.mock'; import { type FlatObjectMetadata } from 'src/engine/metadata-modules/flat-object-metadata/types/flat-object-metadata.type'; -import { computeTableName } from 'src/engine/utils/compute-table-name.util'; +import { computeObjectTargetTable } from 'src/engine/utils/compute-object-target-table.util'; // The query builder aliases the FROM table with `getObjectAlias` (= nameSingular), // NOT the physical table name (which is `_`-prefixed for custom objects via -// `computeTableName`). These tests pin order-by clauses to that alias so the +// `computeObjectTargetTable`). These tests pin order-by clauses to that alias so the // parser stays in sync if the alias convention ever changes. describe('GraphqlQueryOrderGroupByParser - object alias in order-by clauses', () => { const OBJECT_ID = 'rocket-object-id'; @@ -78,10 +78,7 @@ describe('GraphqlQueryOrderGroupByParser - object alias in order-by clauses', () } as unknown as FlatEntityMaps; const objectAlias = getObjectAlias(flatObjectMetadata); - const physicalTableName = computeTableName( - flatObjectMetadata.nameSingular, - flatObjectMetadata.isCustom, - ); + const physicalTableName = computeObjectTargetTable(flatObjectMetadata); const buildParser = () => new GraphqlQueryOrderGroupByParser(