flowfuse icon indicating copy to clipboard operation
flowfuse copied to clipboard

Fix team upgrade when it includes instance types unavailable at target type

Open knolleary opened this issue 1 year ago • 0 comments

Description

The logic that handles changing team types verifies that the current team's usage is within the restrictions of the target team type and rejects the change if not.

This logic prevents a 'Team' tier team with lots of instances from 'downgrading' to the 'Starter' tier where they would only pay the flat rate.

However, this same logic also prevents a 'Starter' or 'Team' tier with a Small instance from upgrading to 'Enterprise' as we have disabled small instances in Enterprise. We need to define the expected behaviour when upgrading in this scenario.

There are two possible solutions:

  1. For an 'upgrade', allow a team to bring in 'inactive' instance types, whilst preventing creation of new ones.
    • Challenges:
      • We do the same check of 'isAllowed' in both the create and unsuspend paths. We'd need to differentiate the two - prevent creation, but allow unsuspend
      • We don't currently have a concept of 'upgrade' versus 'downgrade' - so would need a way to do so
  2. When trying to change team type, if there are disallowed instances, ask the user what to do (delete/upgrade type).
    • Challenges:
      • That's a lot of UX work and API work

I think the quicker solution is option 1 - allow a team to bring in 'inactive' instance types when upgrading - but disallow in downgrading.

Workaround

There are current two possible workarounds to this, although neither are ideal - hence the need to improve.

  1. Delete all Small instances before upgrading
  2. First upgrade to 'Team' tier and upgrade Small instances to Medium. Then upgrade to 'Enterprise'. This will generate a lot of Stripe churn.

knolleary avatar May 15 '24 09:05 knolleary