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

Restrict teams features based on org status #2897

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

wojtekmach
Copy link
Contributor

No description provided.

Copy link

github-actions bot commented Dec 17, 2024

Uffizzi Ephemeral Environment deployment-59180

☁️ https://app.uffizzi.com/github.com/livebook-dev/livebook/pull/2897

📄 View Application Logs etc.

What is Uffizzi? Learn more!

@@ -18,4 +18,5 @@ defmodule LivebookProto.AgentConnected do
json_name: "appDeployments"

field :agents, 9, repeated: true, type: LivebookProto.Agent
field :org_active, 10, type: :bool, json_name: "orgActive"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, we have a dependency issue here. We need to either:

  1. Deploy Teams with this before we publish a new Livebook version
  2. Rename field to org_disabled : bool or something like org_status : active | disabled

The reason is the default value for booleans is false so if Teams is not sending this value it is considered false which would block Teams features. The DSL allows a default: true, which would be my preference, but that is not available on proto3.

I guess option 1 is fine, option 2 with :org_status could be more future proof though. @jonatanklosko @josevalim @hugobarauna Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

Making it an enum is probably going to be better in the long term?

Copy link
Member

Choose a reason for hiding this comment

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

@josevalim

/**
* We're only using Enum in this case because
* the Client is the source of the information,
* and the Server will always be up-to-date.
*
* Otherwise, it shouldn't be used.
*/
enum AppDeploymentStatusType {
preparing = 0;
available = 1;
}

Copy link
Member

@jonatanklosko jonatanklosko Dec 18, 2024

Choose a reason for hiding this comment

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

We are going to deploy Teams first anyway (1.), otherwise the new Livebook release would probably have issues, no?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, correct. We always need to deploy Livebook Teams first before we release a new Livebook. But if anyone uses main or nightly build, then it will be fully broken saying they need to pay. That's why we may also want to have an enum with better defaults? Or the enum would be broken as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why couldn't we return more values in the future? Is that Protobuf limitation or it's depend on us how we treat incoming values (e.g. exhaustive case/2 on exact values)?

Copy link
Contributor

Choose a reason for hiding this comment

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

So let's ship with the inverse for now: inactive

Copy link
Member

Choose a reason for hiding this comment

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

Why couldn't we return more values in the future? Is that Protobuf limitation or it's depend on us how we treat incoming values (e.g. exhaustive case/2 on exact values)?

The protobuf library would keep an unknown value, but it would be an integer (see commit message in elixir-protobuf/protobuf@6b8f40f). Leaking the integer to the rest of the application is probably a bad idea, so we would need to account for the unknown value early. In some cases this could be as simple as picking a default value, but here I'm not sure if that's clear. Using strings has the benefit that it's safer to keep them around, but it mostly pushes the catch all and default behaviour problem to other parts of the app.

I don't remember if there was a specific scenario behind the AppDeploymentStatusType comment though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Im gonna go with inactive bool flag then. Though if anyone prefers can call it disabled, lmk. Thanks everyone!

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good to me!

@wojtekmach wojtekmach force-pushed the wm-disable-when-not-active branch from 7a654e8 to 05045c7 Compare December 23, 2024 12:50
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.

4 participants