Skip to content
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

Closed

Conversation

AMoreaux
Copy link
Contributor

@AMoreaux AMoreaux commented Dec 19, 2024

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

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.
@AMoreaux AMoreaux self-assigned this Dec 19, 2024
Copy link
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.

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

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.
@FelixMalfait
Copy link
Member

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?

@AMoreaux
Copy link
Contributor Author

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.

@FelixMalfait
Copy link
Member

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)

@AMoreaux
Copy link
Contributor Author

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 👌

@AMoreaux AMoreaux closed this Dec 19, 2024
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.

Updated to 0.34 and now cannot login - "You're not member of this workspace."
2 participants