Skip to content

Fix index field comparison#17896

Merged
prastoin merged 2 commits intomainfrom
fix-critical-prod
Feb 12, 2026
Merged

Fix index field comparison#17896
prastoin merged 2 commits intomainfrom
fix-critical-prod

Conversation

@prastoin
Copy link
Copy Markdown
Contributor

@prastoin prastoin commented Feb 12, 2026

Introduction

Related twentyhq/core-team-issues#2227

On a field name update side effect leading to an index field mutation it wouldn't get caught by the builder leading to an index field desync

We should land on a standard pattern regarding the field index either jsonb or syncableEntity so this would not occur anymore as it would have been strictly typed

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 12, 2026

🚀 Preview Environment Ready!

Your preview environment is available at: http://bore.pub:20806

This environment will automatically shut down when the PR is closed or after 5 hours.

@prastoin prastoin marked this pull request as ready for review February 12, 2026 14:54
@prastoin prastoin self-assigned this Feb 12, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Copy link
Copy Markdown
Member

@Weiko Weiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 12, 2026

Greptile Overview

Greptile Summary

This PR fixes a bug where index field metadata changes would not be detected during field name updates. The fix adds the missing universalProperty mapping for flatIndexFieldMetadatasuniversalFlatIndexFieldMetadatas in the index configuration.

Key changes:

  • Maps flatIndexFieldMetadatas to universalFlatIndexFieldMetadatas for proper comparison during workspace migrations
  • Updates type definition to allow undefined | string for universal property, enabling non-standard mappings like this one
  • Removes obsolete @ts-expect-error comment for labelIdentifierFieldMetadataId (now properly typed)
  • Updates test snapshot to reflect the corrected property names used in comparison logic

The fix ensures that when a field name is updated, the side effect mutation to index fields is now properly detected by the builder, preventing index field desynchronization. The universalFlatIndexFieldMetadatas property is used for portable comparisons across workspace instances using universal identifiers instead of database IDs.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are straightforward and correct: adding a missing property mapping that should have existed based on the type definitions. The type system change (undefined | string) properly accommodates this mapping pattern. Test snapshot updated correctly. No breaking changes or side effects expected.
  • No files require special attention

Important Files Changed

Filename Overview
packages/twenty-server/src/engine/metadata-modules/flat-entity/constant/all-entity-properties-configuration-by-metadata-name.constant.ts Adds missing universalProperty mapping for flatIndexFieldMetadatas to universalFlatIndexFieldMetadatas, fixing index field comparison bug. Also removes unnecessary @ts-expect-error comment and adjusts type to allow string values.
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 Updates test snapshot to reflect the corrected property name universalFlatIndexFieldMetadatas used for comparison and stringification.

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@prastoin prastoin added this pull request to the merge queue Feb 12, 2026
Copy link
Copy Markdown
Contributor

@etiennejouan etiennejouan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Merged via the queue into main with commit 09e48ad Feb 12, 2026
71 of 75 checks passed
@prastoin prastoin deleted the fix-critical-prod branch February 12, 2026 15:22
@twenty-eng-sync
Copy link
Copy Markdown

Hey @prastoin! After you've done the QA of your Pull Request, you can mark it as done here. Thank you!

1 similar comment
@twenty-eng-sync
Copy link
Copy Markdown

Hey @prastoin! After you've done the QA of your Pull Request, you can mark it as done here. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants