-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[server] Cleanup around EntitlementService and BillingMode #18429
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
Conversation
@@ -33,7 +32,7 @@ export class BillingModes { | |||
return { mode: "usage-based", paid }; | |||
} | |||
|
|||
async getBillingModeForUser(user: User, now: Date): Promise<BillingMode> { | |||
async getBillingModeForUser(): Promise<BillingMode> { |
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.
getBillingModeForUser
without any user context looks pretty odd from the outside. Do we need this method at all?
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.
I added a comment, and explicitly marked it as deprecated now. All we really need to do is add orgnaizationId to api.maySetTimeout
and api.updateWorkspaceTimeoutSetting
, then we can remove it entirely.
// gpl: Because with the current payment handling (pay-after-use) having a "paid" plan is not a good enough classifier for trushworthyness atm. | ||
// We're looking into improving this, but for the meantime we limit network connections for everybody to reduce the impact of abuse. | ||
return true; | ||
} | ||
|
||
private async hasPaidSubscription(user: User, date: Date): Promise<boolean> { | ||
private async hasPaidSubscription(userId: string, organizationId?: string): Promise<boolean> { | ||
if (organizationId) { |
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.
This is good and we should even aim for making the organization mandatory, but it is a breaking change. For instance, users who were able to change timeouts on workspaces running on their free org (but have another paid org) can now no longer do this.
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.
Exactly. But sharpening that behavior is sth we should have done all along, right after the migration to Stripe.
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.
I like this change and believe we can just roll it out. I would even consider it a bug that I would have all these paid features on a non-paid org before. So thanks for fixing! :-)
2be105e
to
5777c75
Compare
bd7191c
to
8d05a11
Compare
8d05a11
to
415e2f7
Compare
Description
Blocked by: #18412
This PR refactors the EntitlementService interface, which we did not follow up on after our move to Stripe, but is in the way of some refactorings around GitpodServerImpl and WorkspaceStarter.
This does container a "breaking change", though: We take away some features in non-paid orgs (details)
Summary generated by Copilot
🤖 Generated by Copilot at bd7191c
This pull request refactors and simplifies some of the code related to billing and entitlement logic in the server component. It removes unused or redundant parameters, imports, and code, and uses more consistent and concise method calls. It affects the files
billing-mode.ts
,entitlement-service-ubp.ts
,entitlement-service.ts
,gitpod-server-impl.ts
,workspace-starter.ts
, andprebuild-manager.ts
.Related Issue(s)
Fixes #
How to test
Documentation
Preview status
gitpod:summary
Build Options
Build
Run the build with werft instead of GHA
Run Leeway with
--dont-test
Publish
Installer
Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
If enabled this will build
install/preview
If enabled this will create the environment on GCE infra
Valid options are
all
,workspace
,webapp
,ide
,jetbrains
,vscode
,ssh
. If enabled,with-preview
andwith-large-vm
will be enabled./hold