-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(domain-manager): prioritize non-seed workspaces in selection #9148
Conversation
Updated workspace selection logic to prioritize non-seed workspaces. Returns a seed workspace only if no non-seed workspaces are available to improve filtering consistency and avoid unintended behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR modifies the workspace selection logic in single-workspace mode to properly handle seed and non-seed workspaces, ensuring consistent workspace prioritization.
- Added logic in
getDefaultWorkspace()
to filter out seed workspaces (SEED_APPLE_WORKSPACE_ID, SEED_ACME_WORKSPACE_ID) and prioritize non-seed workspaces - Added fallback to use last available workspace if no non-seed workspaces exist
- Added warning log when multiple workspaces are detected in single-workspace mode
- Added test coverage in
domain-manager.service.spec.ts
for workspace selection scenarios
1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
packages/twenty-server/src/engine/core-modules/domain-manager/service/domain-manager.service.ts
Outdated
Show resolved
Hide resolved
…mode-with-multiple-workspaces
Updated workspace selection logic to prioritize non-seed workspaces. Returns a seed workspace only if no non-seed workspaces are available to improve filtering consistency and avoid unintended behavior.
I'm not sure this is a good idea. If users create seed workspaces in a production environment that's a security risk for their server. We should rather find the root cause and limit seeds to a dev environment, maybe this one will help: #9112 Do you see anything else in the doc that's misleading/still leading them to create seeds when self-hosting? |
Agree with you and it was my first assumption that's why this issue happened. But this PR would be useful if the case happen. The warning will inform the user about the strange state of the DB but the non-seed workspace remains available. |
I totally get your point but we usually try to avoid putting edge-cases like that in the code. I think over time it can pollute and add complexity (it's strange to have a reference to seeds in a prod environment/function, doesn't feel very elegant) |
Ok I understand 👌 |
Updated workspace selection logic to prioritize non-seed workspaces. Returns a seed workspace only if no non-seed workspaces are available to improve filtering consistency and avoid unintended behavior.
Fix #9041 #9109