Skip to content

Automatically set a user's usageAttributionId in cases where there is no ambiguity #10975

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

Merged
merged 3 commits into from
Jun 29, 2022

Conversation

jankeromnes
Copy link
Contributor

@jankeromnes jankeromnes commented Jun 28, 2022

Description

Automatically set a user's explicit usageAttributionId in cases where there is no ambiguity:

  • When a user hasn't selected a specific usageAttributionId, and they join a team with usage-based billing enabled --> automatically set the user's default usageAttributionId to that team
  • When a user hasn't selected a specific usageAttributionId, and one of their teams enables usage-based billing --> automatically set the user's default usageAttributionId to that team
  • When a user has set their usageAttributionId to a specific team, but they leave this team --> automatically unset the user's default usageAttributionId again

Related Issue(s)

Fixes #10973

How to test

  1. Start a workspace --> its usage should get attributed to your user
    • d_b_workspace_instance.usageAttributionId == user:{YOUR_USER_ID}
  2. Join a team that has usage-based billing enabled, and start another workspace --> its usage should get attributed to the team
    • d_b_workspace_instance.usageAttributionId == team:{TEAM_ID}
  3. Leave that team again, and start yet another workspace --> its usage should get attributed to your user again
    • d_b_workspace_instance.usageAttributionId == user:{YOUR_USER_ID}

Release Notes

NONE

Documentation

Werft options:

  • /werft with-preview
  • /werft with-payment

@jankeromnes jankeromnes changed the title Automatically set or unset a user's preferred "billing account" when they join or leave a single team with usage-based billing enabled Automatically set a user's usageAttributionId in cases where there is no ambiguity Jun 28, 2022
@jankeromnes jankeromnes force-pushed the jx/auto-re-attribute branch 2 times, most recently from 4f0e17c to 330b50f Compare June 28, 2022 13:24
@roboquat roboquat added size/S and removed size/M labels Jun 28, 2022
@jankeromnes jankeromnes force-pushed the jx/auto-re-attribute branch from 330b50f to 2ae3173 Compare June 28, 2022 13:48
@roboquat roboquat added size/M and removed size/S labels Jun 28, 2022
@jankeromnes jankeromnes force-pushed the jx/auto-re-attribute branch from 2ae3173 to a50d03e Compare June 28, 2022 15:15
…am with usage-based billing enabled, automatically re-attribute usage to that team
…eaves that team, reset their selected 'usageAttributionId'
…tribute member usage to that team when the member has no explicit 'usageAttributionId' yet
@jankeromnes jankeromnes force-pushed the jx/auto-re-attribute branch from a50d03e to f1aa0f9 Compare June 29, 2022 08:15
@jankeromnes jankeromnes marked this pull request as ready for review June 29, 2022 09:28
@jankeromnes jankeromnes requested a review from a team June 29, 2022 09:28
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Jun 29, 2022
Copy link
Member

@easyCZ easyCZ left a comment

Choose a reason for hiding this comment

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

Ran through the tests and looks to work. Shame writing tests for this is currently so hard without proper setup.

@roboquat roboquat merged commit 1c72fca into main Jun 29, 2022
@roboquat roboquat deleted the jx/auto-re-attribute branch June 29, 2022 09:40
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none size/M team: webapp Issue belongs to the WebApp team
Projects
None yet
3 participants