Compare commits

...
Author SHA1 Message Date
sonarly-bot 52f09c76b6 fix(server): stop diffing removed rolePermissionFlag.flag
https://sonarly.com/issue/39742?type=bug

App install/sync fails for apps declaring role permission flags because migration update actions include `rolePermissionFlag.update.flag`, which TypeORM rejects after the 2.7 cutover removed that property from active entity metadata.

Fix: Implemented a targeted server-side fix in the migration diff layer so post-2.7 installs/syncs stop generating invalid `rolePermissionFlag.update.flag` payloads.

What changed:
1) `packages/twenty-server/src/engine/metadata-modules/flat-entity/constant/all-entity-properties-configuration-by-metadata-name.constant.ts`
- In the `rolePermissionFlag` property configuration, changed:
  - `flag.toCompare` from `true` to `false`.

Why this fixes the bug:
- The update payload is built from comparable properties. Marking `flag` as non-comparable prevents the diff engine from producing `update.flag`, which is the field TypeORM rejects after the 2.7 cutover removed/hidden that column from active metadata.

2) `packages/twenty-server/src/engine/metadata-modules/flat-entity/constant/__tests__/__snapshots__/all-universal-flat-entity-properties-to-compare-and-stringify.constant.spec.ts.snap`
- Updated snapshot so `rolePermissionFlag.propertiesToCompare` no longer includes `"flag"`.

I also checked recent history for an existing exact fix (`git log --all --since='30 days ago'` + candidate commit inspection). There is related work (`d13cc7c3497`), but this branch still has `rolePermissionFlag.flag` set as comparable, so the exact root-cause fix was not present here.

Authored by Sonarly by autonomous analysis (run 45294).
2026-05-22 11:50:06 +00:00
2 changed files with 1 additions and 2 deletions
@@ -258,7 +258,6 @@ exports[`ALL_UNIVERSAL_FLAT_ENTITY_PROPERTIES_TO_COMPARE_AND_STRINGIFY should ma
"propertiesToCompare": [
"permissionFlagUniversalIdentifier",
"roleUniversalIdentifier",
"flag",
],
"propertiesToStringify": [],
},
@@ -1198,7 +1198,7 @@ export const ALL_ENTITY_PROPERTIES_CONFIGURATION_BY_METADATA_NAME = {
universalProperty: 'roleUniversalIdentifier',
},
flag: {
toCompare: true,
toCompare: false,
toStringify: false,
universalProperty: undefined,
},