chore: remove completed migration feature flags and upgrade commands <= 1.18#19074
Conversation
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
1 issue found across 47 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/twenty-server/src/engine/constants/upgrade-command-supported-versions.constant.ts">
<violation number="1" location="packages/twenty-server/src/engine/constants/upgrade-command-supported-versions.constant.ts:1">
P1: Removing `1.18.0` breaks the `1.19.x` upgrade path because `getPreviousVersion()` can no longer resolve a source version for the registered `1.19.0` commands.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
packages/twenty-server/src/engine/constants/upgrade-command-supported-versions.constant.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
This PR removes now-obsolete migration feature flags and deprecates upgrade command support for versions ≤ 1.18, while simplifying activity/attachment targeting logic to always use the morph-relation path across server and frontend.
Changes:
- Removed completed migration feature flags (
IS_ATTACHMENT_MIGRATED,IS_NOTE_TARGET_MIGRATED,IS_TASK_TARGET_MIGRATED) and their default/seeded behavior. - Dropped upgrade-command implementations and module registrations for versions
1.16,1.17, and1.18, and narrowed supported upgrade versions to1.19and1.20. - Simplified frontend activity targeting utilities/hooks/components by removing the
isMorphRelationbranching and always using morph field naming.
Reviewed changes
Copilot reviewed 47 out of 47 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/twenty-shared/src/types/FeatureFlagKey.ts | Removes completed migration feature flag keys from the shared enum. |
| packages/twenty-server/src/engine/workspace-manager/workspace-migration/constant/default-feature-flags.ts | Clears default feature flags list (now empty) after flag removal. |
| packages/twenty-server/src/engine/workspace-manager/dev-seeder/core/utils/seed-feature-flags.util.ts | Stops seeding removed migration flags. |
| packages/twenty-server/src/engine/twenty-orm/entity-manager/workspace-entity-manager.spec.ts | Updates expected feature flag maps in tests after flag removal. |
| packages/twenty-server/src/engine/metadata-modules/object-metadata/utils/build-default-relation-flat-field-metadatas-for-custom-object.util.ts | Always treats attachment/noteTarget/taskTarget as morph relations (no feature-flag gating). |
| packages/twenty-server/src/engine/metadata-modules/object-metadata/object-metadata.service.ts | Removes passing existingFeatureFlagsMap into object creation flow. |
| packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/utils/from-create-object-input-to-flat-object-metadata-and-flat-field-metadatas-to-create.util.ts | Removes existingFeatureFlagsMap from args and downstream call. |
| packages/twenty-server/src/engine/constants/upgrade-command-supported-versions.constant.ts | Restricts supported upgrade command versions to 1.19 and 1.20 only. |
| packages/twenty-server/src/database/commands/upgrade-version-command/upgrade.command.ts | Removes <=1.18 command wiring and version-to-commands mappings. |
| packages/twenty-server/src/database/commands/upgrade-version-command/upgrade-version-command.module.ts | Removes 1.17/1.18 module imports/registration. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-18/1-18-upgrade-version-command.module.ts | Deleted deprecated 1.18 upgrade module. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-18/1-18-migrate-workspace-pictures.command.ts | Deleted deprecated 1.18 command implementation. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-18/1-18-migrate-workflow-send-email-attachments.command.ts | Deleted deprecated 1.18 command implementation. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-18/1-18-migrate-person-avatar-files.command.ts | Deleted deprecated 1.18 command implementation. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-18/1-18-migrate-favorites-to-navigation-menu-items.command.ts | Deleted deprecated 1.18 command implementation. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-18/1-18-migrate-attachment-files.command.ts | Deleted deprecated 1.18 command implementation. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-18/1-18-migrate-activity-rich-text-attachment-file-ids.command.ts | Deleted deprecated 1.18 command implementation. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-18/1-18-delete-orphan-favorites.command.ts | Deleted deprecated 1.18 command implementation. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-18/1-18-backfill-standard-views-and-field-metadata.command.ts | Deleted deprecated 1.18 command implementation. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-18/1-18-backfill-message-channel-throttle-retry-after.command.ts | Deleted deprecated 1.18 command implementation. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-18/1-18-backfill-file-size-and-mime-type.command.ts | Deleted deprecated 1.18 command implementation. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-17/utils/migrate-send-email-step.util.ts | Deleted deprecated 1.17 utility. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-17/utils/tests/migrate-send-email-step.util.spec.ts | Deleted deprecated 1.17 tests. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-17/1-17-upgrade-version-command.module.ts | Deleted deprecated 1.17 module. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-17/1-17-migrate-task-target-to-morph-relations.command.ts | Deleted deprecated 1.17 command implementation. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-17/1-17-migrate-send-email-recipients.command.ts | Deleted deprecated 1.17 command implementation. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-17/1-17-migrate-note-target-to-morph-relations.command.ts | Deleted deprecated 1.17 command implementation. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-17/1-17-migrate-date-time-is-filter-values.command.ts | Deleted deprecated 1.17 command implementation. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-17/1-17-migrate-attachment-to-morph-relations.command.ts | Deleted deprecated 1.17 command implementation. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-17/1-17-make-webhook-universal-identifier-and-application-id-not-nullable-migration.command.ts | Deleted deprecated 1.17 command implementation. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-17/1-17-identify-webhook-metadata.command.ts | Deleted deprecated 1.17 command implementation. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-17/1-17-fix-morph-relation-field-names.command.ts | Deleted deprecated 1.17 command implementation. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-17/1-17-delete-all-files-and-update-table.command.ts | Deleted deprecated 1.17 command implementation. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-17/1-17-backfill-application-package-files.command.ts | Deleted deprecated 1.17 command implementation. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-16/constants/standard-index-field-names.constant.ts | Deleted deprecated 1.16 constant data. |
| packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/StandaloneRichTextWidget.tsx | Removes feature-flag gating; always uses morph field naming for attachment targeting. |
| packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RichTextFieldEditor.tsx | Removes feature-flag gating; always uses morph field naming for attachment targeting. |
| packages/twenty-front/src/modules/activities/utils/getActivityTargetsFilter.ts | Simplifies filter building to always use morph join column naming. |
| packages/twenty-front/src/modules/activities/utils/getActivityTargetObjectFieldIdName.ts | Removes isMorphRelation branching; always returns morph-style field id name. |
| packages/twenty-front/src/modules/activities/utils/getActivityTargetFieldNameForObject.ts | Removes non-morph path; derives target field name from morph-style id name. |
| packages/twenty-front/src/modules/activities/utils/generateActivityTargetMorphFieldKeys.ts | Removes isMorphRelation parameter; always generates morph-style keys. |
| packages/twenty-front/src/modules/activities/inline-cell/hooks/useUpdateActivityTargetFromCell.ts | Removes feature-flag checks and always uses morph naming path. |
| packages/twenty-front/src/modules/activities/hooks/usePrepareFindManyActivitiesQuery.ts | Removes feature-flag checks and always generates morph field signatures. |
| packages/twenty-front/src/modules/activities/hooks/useActivityTargetsForTargetableObjects.ts | Removes feature-flag checks; builds activity target filter via morph path. |
| packages/twenty-front/src/modules/activities/graphql/operation-signatures/factories/findActivitiesOperationSignatureFactory.ts | Removes isMorphRelation branching; always includes morph field keys. |
| packages/twenty-front/src/modules/activities/files/hooks/useUploadAttachmentFile.tsx | Removes feature-flag gating; always sets attachment target via morph join field. |
| packages/twenty-front/src/modules/activities/files/hooks/useAttachments.tsx | Removes feature-flag gating; always filters attachments via morph join field. |
Comments suppressed due to low confidence (1)
packages/twenty-front/src/modules/activities/utils/getActivityTargetsFilter.ts:28
targetableObjects.map(...)always returns a tuple, so.filter(isDefined)is redundant here. Removing it will simplify the code and avoid implying thatundefinedentries are expected.
const findManyActivityTargetsQueryFilter = Object.fromEntries(
targetableObjects
.map((targetableObject) => {
const joinColumnName = getActivityTargetObjectFieldIdName({
nameSingular: targetableObject.targetObjectNameSingular,
});
return [
joinColumnName,
{
eq: targetableObject.id,
},
];
})
.filter(isDefined),
);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const isObjectMigratedToMorphRelations = | ||
| isObjectMigratedFromOlderReleases || isFeatureFlagEnabled; | ||
| objectMetadataNameSingular === 'timelineActivity' || | ||
| objectMetadataNameSingular === 'attachment' || | ||
| objectMetadataNameSingular === 'noteTarget' || | ||
| objectMetadataNameSingular === 'taskTarget'; |
There was a problem hiding this comment.
isObjectMigratedToMorphRelations is currently hard-coded for a subset of DEFAULT_RELATIONS_OBJECTS_STANDARD_IDS, duplicating knowledge already present in morphIdByRelationObjectNameSingular. This risks the two getting out of sync if objects are added/removed; consider deriving the boolean from the morphId map (e.g., morphIdByRelationObjectNameSingular[name] != null) or using a single source of truth.
…<= 1.18 Remove IS_ATTACHMENT_MIGRATED, IS_NOTE_TARGET_MIGRATED, and IS_TASK_TARGET_MIGRATED feature flags since these migrations are complete and the flags were already enabled by default for all new workspaces. Also delete all upgrade commands for versions <= 1.18 (1-16, 1-17, 1-18 directories) as they are no longer needed. Frontend utility functions (getActivityTargetObjectFieldIdName, getActivityTargetsFilter, getActivityTargetFieldNameForObject, etc.) are simplified to always use the morph relation path, removing the legacy code branches. Made-with: Cursor
00b7679 to
a70250b
Compare
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:9588 This environment will automatically shut down after 5 hours. |
📊 API Changes ReportGraphQL Schema ChangesGraphQL Schema Changes[error] Error: Unable to read JSON file: /home/runner/work/twenty/twenty/main-schema-introspection.json: Not valid JSON content GraphQL Metadata Schema ChangesGraphQL Metadata Schema Changes[error] Error: Unable to read JSON file: /home/runner/work/twenty/twenty/main-metadata-schema-introspection.json: Not valid JSON content REST API Analysis ErrorError OutputREST Metadata API Analysis ErrorError Output |
|
Hey @charlesBochet! After you've done the QA of your Pull Request, you can mark it as done here. Thank you! |
Summary
IS_ATTACHMENT_MIGRATED,IS_NOTE_TARGET_MIGRATED,IS_TASK_TARGET_MIGRATED— these were already enabled by default for all new workspaces viaDEFAULT_FEATURE_FLAGS1-16/,1-17/,1-18/) along with their module registrations, removing ~6,600 lines of dead migration codegetActivityTargetObjectFieldIdName,getActivityTargetsFilter,getActivityTargetFieldNameForObject,generateActivityTargetMorphFieldKeys,findActivitiesOperationSignatureFactory) by removing theisMorphRelationparameter and always using the morph relation pathbuildDefaultRelationFlatFieldMetadatasForCustomObjectserver util to always treat attachment, noteTarget, and taskTarget as morph relations without checking feature flags