chore: remove dead feature flags#20460
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes four dead feature flags from the shared FeatureFlagKey enum and updates the corresponding generated GraphQL/SDK artifacts and a server test mock to match, reducing unused surface area in the feature-flag system and upgrade commands.
Changes:
- Remove
IS_COMMAND_MENU_ITEM_ENABLED,IS_DATASOURCE_MIGRATED,IS_RICH_TEXT_V1_MIGRATED, andIS_CONNECTED_ACCOUNT_MIGRATEDfromFeatureFlagKey. - Drop the unused
FeatureFlagService/IS_CONNECTED_ACCOUNT_MIGRATEDearly-return guard from the 1.21 messaging infrastructure migration command. - Update generated GraphQL/SDK schemas and a workspace entity manager test mock to reflect the trimmed enum.
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/twenty-shared/src/types/FeatureFlagKey.ts | Removes the four dead feature-flag keys from the shared enum source of truth. |
| packages/twenty-server/src/engine/twenty-orm/entity-manager/workspace-entity-manager.spec.ts | Updates mocked featureFlagsMap to no longer include the removed keys. |
| packages/twenty-server/src/database/commands/upgrade-version-command/1-21/1-21-workspace-command-1775500012000-migrate-messaging-infrastructure-to-metadata.command.ts | Removes the unused feature-flag guard and dependency from the upgrade command. |
| packages/twenty-front/src/generated-metadata/graphql.ts | Regenerates client metadata GraphQL types to remove the deleted enum values. |
| packages/twenty-front/src/generated-admin/graphql.ts | Regenerates admin GraphQL types to remove the deleted enum values. |
| packages/twenty-client-sdk/src/metadata/generated/schema.ts | Updates SDK generated TypeScript schema types/constants for the trimmed enum. |
| packages/twenty-client-sdk/src/metadata/generated/schema.graphql | Updates SDK generated GraphQL schema to remove the deleted enum values. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
🔍 Automated Pre-Review✅ No issues detected - This PR is ready for human review. Automated pre-review. Human approval still required. |
|
🚀 Preview Environment Ready! Your preview environment is available at: https://purse-fcc-sellers-involve.trycloudflare.com 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 |
7fe5a28 to
5a50869
Compare
690e51f to
7207415
Compare
|
|
||
| @Module({ | ||
| imports: [ | ||
| V1_21_UpgradeVersionCommandModule, | ||
| V1_22_UpgradeVersionCommandModule, | ||
| V1_23_UpgradeVersionCommandModule, | ||
| V2_0_UpgradeVersionCommandModule, |
There was a problem hiding this comment.
Bug: The PR incompletely removes support for upgrading from version 1.21.0. The version remains in TWENTY_PREVIOUS_VERSIONS while its associated workspace commands are deleted, causing silent upgrade failures.
Severity: CRITICAL
Suggested Fix
To fix this, remove '1.21.0' from the TWENTY_PREVIOUS_VERSIONS array. This will ensure the upgrade sequence generator correctly identifies 1.21.0 as an unsupported version and throws the intended error, preventing data corruption.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location:
packages/twenty-server/src/database/commands/upgrade-version-command/workspace-command-provider.module.ts#L10-L15
Potential issue: The pull request aims to drop support for upgrading from version
`1.21.0` but fails to remove `'1.21.0'` from the `TWENTY_PREVIOUS_VERSIONS` list. While
the workspace commands for the 1.21 upgrade path are deleted, the version's continued
presence in the supported versions list prevents the system from correctly erroring out
for users on `1.21.0`. Instead, the upgrade process will silently skip the missing 1.21
workspace commands and proceed to execute the 1.22 commands on un-migrated data, leading
to database corruption.
Did we get this right? 👍 / 👎 to inform future reviews.
Drops four feature flags that have no remaining runtime consumers: - IS_COMMAND_MENU_ITEM_ENABLED — never read anywhere - IS_DATASOURCE_MIGRATED — already commented @deprecated, no consumers - IS_RICH_TEXT_V1_MIGRATED — never read; the 1-19 migration that used it was removed in #19074 - IS_CONNECTED_ACCOUNT_MIGRATED — only read in the 1-21 messaging migration command as an idempotency guard, but the flag is never written, so the guard never fired. Drop the guard since the underlying save() upserts are already idempotent. Updates the FeatureFlagKey enum, the workspace-entity-manager test mock, and the generated GraphQL/SDK schemas accordingly.
Same cleanup pattern as #19074 which removed upgrade commands <= 1.18. Twenty is now on 2-5; the 1-21 commands have long since run on every active workspace and are dead code. Deletes all 18 1-21 instance and workspace commands plus the V1_21_UpgradeVersionCommandModule registration, and drops the three 1-21 instance command entries from INSTANCE_COMMANDS.
7207415 to
7c9fa00
Compare
Picks up the schema drift accumulated on main that touched these generated files (SSO/AvailableWorkspace/BillingEntitlement/etc.) so the Check for Pending Code Generation CI step passes.
This reverts commit 7c9fa00.
There was a problem hiding this comment.
3 issues found across 16 files (changes from recent commits).
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/database/commands/upgrade-version-command/1-21/1-21-workspace-command-1775500007000-fix-select-all-command-menu-items.command.ts">
<violation number="1">
P2: Use the workspace custom application identifier when calling `validateBuildAndRunWorkspaceMigration` instead of the standard application identifier.
(Based on your team's feedback about using workspaceCustom application context for validate/build/run migrations.) [FEEDBACK_USED]</violation>
</file>
<file name="packages/twenty-server/src/database/commands/upgrade-version-command/workspace-command-provider.module.ts">
<violation number="1">
P1: Re-adding `V1_21_UpgradeVersionCommandModule` keeps the removed 1-21 workspace commands wired into the upgrade pipeline. This reintroduces deprecated command providers instead of removing them.</violation>
</file>
<file name="packages/twenty-server/src/database/commands/upgrade-version-command/1-21/1-21-workspace-command-1775500014000-fix-message-thread-view-and-label-identifier.command.ts">
<violation number="1">
P2: View-field migration is not idempotent: it always deletes and recreates `allMessageThreads` fields, even when already synced.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Reordered types only - restoring V1_21_UpgradeVersionCommandModule changes module load order, which the SDK metadata generator reflects.
Summary
Two related cleanups, following the same pattern as #19916 and #19074.
Dead feature flags
Drops four feature flags whose only references are the enum entry and the generated GraphQL/SDK files:
IS_COMMAND_MENU_ITEM_ENABLED— never read anywhere.IS_DATASOURCE_MIGRATED— already commented@deprecated. Zero non-generated consumers.IS_RICH_TEXT_V1_MIGRATED— the 1-19 migration that gated it was removed in chore: remove completed migration feature flags and upgrade commands <= 1.18 #19074; the flag became dead at that point.IS_CONNECTED_ACCOUNT_MIGRATED— only read by the 1-21migrate-messaging-infrastructure-to-metadatacommand as an early-return guard, but the flag was never written anywhere in the codebase, so the guard never fired (and that workspace command is now removed entirely — see below).Generated GraphQL/SDK schemas and the
workspace-entity-managertest mock are trimmed to match.1-21 workspace commands
Same pattern as #19074 (which removed workspace commands ≤ 1.18). Twenty is now on 2-5; the 1-21 workspace commands have long since run on every active workspace and are dead code.
Removes:
upgrade-version-command/1-21/(compose-email menu item, key-value-pair index, datasource backfill, message-thread backfill, dedup engine commands, select-all fixes, AI response format migration, edit-layout label, drop messaging FKs, folder parent-id migration, messaging-infra-to-metadata, navigation refactor, message-thread label fix, search-menu-item label).1-21-upgrade-version-command.module.tsregistration and theV1_21_UpgradeVersionCommandModuleimport fromWorkspaceCommandProviderModule.Kept (intentionally): the 3
1-21-instance-command-fast-*files. Unlike workspace commands (which mutate data), instance commands carry schema deltas still required by current entity definitions (AddViewFieldGroupIdIndex,MigrateMessagingCalendarToCore,AddEmailThreadWidgetType). They remain registered inINSTANCE_COMMANDSand'1.21.0'stays inTWENTY_PREVIOUS_VERSIONS. They will fold away naturally on a future version bump when aCoreMigrationCheck-style snapshot picks them up.Test plan
npx nx typecheck twenty-sharednpx nx typecheck twenty-servernpx nx typecheck twenty-frontnpx prettier --checkon the changed filesnpx oxlinton the changed server filesnpx jest feature-flag(4 suites, 20 tests pass)npx jest workspace-entity-manager(1 suite, 5 tests pass)