Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

feat/enterpriseportal: define SubscriptionLicenseChecksService #64396

Conversation

bobheadxi
Copy link
Member

@bobheadxi bobheadxi commented Aug 9, 2024

This PR defines an Enterprise Portal version of the "license check" API that is currently bundled in Souregraph as a separate gRPC service that will be implemented in Enterprise Portal (in a PR I will stack on top of this one). The API schema is pretty much the same, except:

  • removed the error field, since I'm pretty sure we can return a real error instead in a connectRPC implementation for the same effect.
  • made license_key a parameter, as we already propagate the license key all over the place (pings, telemetry) - this is a fairly low-frequency check so there shouldn't be any bandwidth concerns or the like. For now, this parameter will support the existing format so we can forward checks in dotcom to EP, but I've set a target removal release

Existing API: https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/cmd/frontend/internal/dotcom/productsubscription/license_check_handler.go?L133

Part of https://linear.app/sourcegraph/issue/CORE-227

Test plan

CI

@bobheadxi bobheadxi marked this pull request as ready for review August 9, 2024 17:23
@bobheadxi bobheadxi requested review from a team August 9, 2024 17:24
@bobheadxi bobheadxi force-pushed the 08-09-feat_enterpriseportal_define_subscriptionlicensechecksservice branch from ef80872 to a05b35b Compare August 9, 2024 17:24
load("@rules_proto_grpc//doc:defs.bzl", "doc_template_compile")
load("@rules_buf//buf:defs.bzl", "buf_lint_test")

# Bazel-generated files are different from what is generated locally by buf and
Copy link
Member

Choose a reason for hiding this comment

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

Huh how’s that 🙃

Copy link
Member Author

Choose a reason for hiding this comment

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

the issue mentioned in the docstring https://github.com/sourcegraph/devx-support/issues/932 has an archive of my debugging efforts. tl;dr i'm not sure, and the bazel-generated files are invalid, causing everything to fail to build if you use Bazel but not if you use Go

@bobheadxi bobheadxi force-pushed the 08-02-feat_enterpriseportal_add_instance_category branch 2 times, most recently from ed907cc to 958195f Compare August 10, 2024 00:09
@bobheadxi bobheadxi force-pushed the 08-09-feat_enterpriseportal_define_subscriptionlicensechecksservice branch from a05b35b to f07d4ff Compare August 10, 2024 00:09
@bobheadxi bobheadxi force-pushed the 08-02-feat_enterpriseportal_add_instance_category branch from 958195f to e4eaa6e Compare August 10, 2024 00:26
@bobheadxi bobheadxi force-pushed the 08-09-feat_enterpriseportal_define_subscriptionlicensechecksservice branch 3 times, most recently from da734d3 to 9d3d1e1 Compare August 10, 2024 00:54
Base automatically changed from 08-02-feat_enterpriseportal_add_instance_category to main August 10, 2024 01:19
@bobheadxi
Copy link
Member Author

Discussed with @eseliger offline, I'm introducing another change here:

made license_key a parameter, as we already propagate the license key all over the place (pings, telemetry) - this is a fairly low-frequency check so there shouldn't be any bandwidth concerns or the like.

For now, this parameter will support the existing format so we can forward checks in dotcom to EP, but I've set a target removal release

@bobheadxi bobheadxi force-pushed the 08-09-feat_enterpriseportal_define_subscriptionlicensechecksservice branch 3 times, most recently from d8b3432 to 8e0f2d9 Compare August 12, 2024 18:50
@bobheadxi bobheadxi force-pushed the 08-09-feat_enterpriseportal_define_subscriptionlicensechecksservice branch from 8e0f2d9 to 9f29a98 Compare August 12, 2024 20:56
@bobheadxi bobheadxi force-pushed the 08-09-feat_enterpriseportal_define_subscriptionlicensechecksservice branch 2 times, most recently from f15b76f to 1ebd646 Compare August 15, 2024 00:16
@bobheadxi bobheadxi requested a review from pjlast August 15, 2024 00:57
@bobheadxi bobheadxi force-pushed the 08-09-feat_enterpriseportal_define_subscriptionlicensechecksservice branch 2 times, most recently from 01de0f8 to ba89637 Compare August 15, 2024 22:07
@bobheadxi bobheadxi force-pushed the 08-09-feat_enterpriseportal_define_subscriptionlicensechecksservice branch from ba89637 to fab52ee Compare August 15, 2024 23:13
@bobheadxi bobheadxi merged commit 8ad337e into main Aug 16, 2024
14 checks passed
@bobheadxi bobheadxi deleted the 08-09-feat_enterpriseportal_define_subscriptionlicensechecksservice branch August 16, 2024 16:37
bobheadxi referenced this pull request Aug 16, 2024
…4400)

Implements the RPC defined in
https://github.com/sourcegraph/sourcegraph/pull/64396. Follow-up PRs
will implement migrations for in-instance checks and for through-dotcom
checks.

One major change is that we now bypass the check for subscriptions that
are denoted as associated with `INTERNAL` instances.

Most of the diff is generated mocks.

Part of https://linear.app/sourcegraph/issue/CORE-227

## Test plan

- [x] Unit tests
- [x] E2E tests (`sg test enterprise-portal-e2e`)


![image](https://github.com/user-attachments/assets/56fde7dd-95a0-4d98-bb4c-943b1f155e33)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants