Do not revert isSystem update for workspaceMember#15691
Merged
Conversation
Contributor
There was a problem hiding this comment.
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_IDSconstant - Implements conditional logic in
updateEntitiesmethod to detectworkspaceMemberobjects and preserve theirisSystemvalue - Uses
standardIdcheck with type guards to safely identify and handleworkspaceMemberupdates - 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
workspaceMemberobject 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
1 file reviewed, no comments
Contributor
|
🚀 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.