Skip to content

Do not revert isSystem update for workspaceMember#15691

Merged
ijreilly merged 1 commit intomainfrom
demo--allow-workspace-member-non-system
Nov 7, 2025
Merged

Do not revert isSystem update for workspaceMember#15691
ijreilly merged 1 commit intomainfrom
demo--allow-workspace-member-non-system

Conversation

@ijreilly
Copy link
Copy Markdown
Contributor

@ijreilly ijreilly commented Nov 7, 2025

Until this is done: Make workspaceMembers non-system

Let's make that update to allow us to have workspaces with workspaceMember not being system object, to allow user to customize their data model.

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.

Greptile Overview

Greptile Summary

Adds a temporary workaround to preserve the current isSystem value for workspaceMember objects during metadata sync operations. This prevents the sync process from overwriting the existing isSystem flag, allowing workspaces to transition workspaceMember from a system object to a customizable one.

  • Adds import for STANDARD_OBJECT_IDS constant
  • Implements conditional logic in updateEntities method to detect workspaceMember objects and preserve their isSystem value
  • Uses standardId check with type guards to safely identify and handle workspaceMember updates
  • Includes TODO comment referencing issue #15688 for future removal once the migration is complete

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk as a temporary workaround
  • The change is a focused, defensive workaround that only affects workspaceMember object updates. The logic is well-guarded with type checks and doesn't modify the broader sync behavior. While temporary solutions can introduce technical debt, this one is clearly documented with a TODO and linked issue for removal
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/services/workspace-metadata-updater.service.ts 4/5 Adds temporary workaround to prevent isSystem updates for workspaceMember object during metadata sync, preserving existing isSystem value

Sequence Diagram

sequenceDiagram
    participant Sync as Workspace Sync Process
    participant Updater as WorkspaceMetadataUpdaterService
    participant Repo as ObjectMetadata Repository
    participant DB as Database

    Sync->>Updater: updateObjectMetadata(manager, storage)
    Updater->>Updater: updateEntities(ObjectMetadataEntity, updateCollection)
    
    loop For each update item
        Updater->>Repo: findBy(id)
        Repo->>DB: Query existing entities
        DB-->>Repo: Return old entities
        Repo-->>Updater: oldEntities
        
        Updater->>Updater: Merge old + new metadata
        
        alt Is workspaceMember object?
            Updater->>Updater: Check standardId === STANDARD_OBJECT_IDS.workspaceMember
            Updater->>Updater: Preserve oldEntity.isSystem value
            Note over Updater: Prevents isSystem from being overwritten
        else Other objects
            Updater->>Updater: Apply updates normally
        end
        
        Updater->>Updater: Apply keysToOmit filtering
    end
    
    Updater->>Repo: save(entityUpdateCollection)
    Repo->>DB: Batch update entities
    DB-->>Repo: Updated entities
    Repo-->>Updater: updatedEntities
    Updater-->>Sync: Return update results
Loading

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

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.

👌

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 7, 2025

🚀 Preview Environment Ready!

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

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

@ijreilly ijreilly merged commit 66ef867 into main Nov 7, 2025
49 of 50 checks passed
@ijreilly ijreilly deleted the demo--allow-workspace-member-non-system branch November 7, 2025 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants