Compare commits

...
Author SHA1 Message Date
Sonarly Claude Code 40f630421d fix(twenty-shared): add GraphQL scalar type names to reserved metadata keywords
https://sonarly.com/issue/32169?type=bug

Installing a marketplace app that defines a custom object named "position" causes the GraphQL schema to fail with a duplicate type name error, blocking app installation for that workspace.

Fix: Added all GraphQL scalar type names used in the workspace schema to the `RESERVED_METADATA_NAME_KEYWORDS` list. These scalar types (`Position`, `BigFloat`, `BigInt`, `Cursor`, `Date`, `Time`, `TSVector`, `UUID`) are defined in `packages/twenty-server/src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars/` and are referenced by workspace object fields. When a user or marketplace app creates a custom object whose PascalCase name matches any of these scalar names, the GraphQL schema constructor throws "Schema must contain uniquely named types".

The fix adds both singular and plural forms of each scalar name (as camelCase, matching existing convention) to the reserved keywords list:
- `position` / `positions` — the immediate trigger for this Sentry error
- `bigFloat` / `bigFloats`, `bigInt` / `bigInts`, `cursor` / `cursors`, `date` / `dates`, `time` / `times`, `tsVector` / `tsVectors`, `uuid` / `uuids` — preventive additions for the same class of collision

This follows the exact pattern used in commit ee3ebd0ca0 which added `search` / `searches` to prevent the same type of collision with the search resolver.

**Note for existing workspaces:** If a workspace already has an object named "position" (from a previously installed marketplace app), this fix won't retroactively rename it. The app would need to be updated to use a different object name, or the `addCustomSuffixIfIsReserved` utility could be applied during the sync process.
2026-04-28 17:34:47 +00:00
@@ -64,4 +64,20 @@ export const RESERVED_METADATA_NAME_KEYWORDS = [
'aggregate',
'search',
'searches',
'position',
'positions',
'bigFloat',
'bigFloats',
'bigInt',
'bigInts',
'cursor',
'cursors',
'date',
'dates',
'time',
'times',
'tsVector',
'tsVectors',
'uuid',
'uuids',
];