This repository was archived by the owner on Sep 30, 2024. It is now read-only.
feat/enterprise-portal: subscriptions.ListEnterpriseSubscriptionLicenses#62932
Merged
bobheadxi merged 5 commits intoMay 28, 2024
Conversation
This was referenced May 27, 2024
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @bobheadxi and the rest of your teammates on |
49220d7 to
cfd65ae
Compare
Comment on lines
48
to
78
Check notice
Code scanning / Semgrep OSS
Semgrep Finding: security-semgrep-rules.semgrep-rules.generic.comment-tagging-rule
Base automatically changed from
05-17-enterprise-portal-cody-gateway-accesses-connectrpc
to
main
May 27, 2024 20:39
60f1581 to
86beaab
Compare
unknwon
approved these changes
May 27, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR implements the DB and RPC layer for the
subscriptions.ListEnterpriseSubscriptionLicensesRPC proposed in https://github.com/sourcegraph/sourcegraph/pull/62263. Previous PRs https://github.com/sourcegraph/sourcegraph/pull/62706 and https://github.com/sourcegraph/sourcegraph/pull/62771 set up the scaffolding for implementing DB and RPC layers for Enterprise Portal, so now we can implement both in a single PR without massive diffs.We need this RPC, in particular the
pageSize=1 archived=falsevariant, for Cody Gateway to adopt Enterprise Portal, as Cody Gateway depends on license tags for certain features.Closes https://linear.app/sourcegraph/issue/CORE-111
Usage in Cody Gateway
In production (not internal-only mode), this should only be used for diagnostics information. In the future, we will revisit the current use cases (identifying if a subscription is dev/internal, and finding a subscription's display name) and replace this usage in Cody Gateway with one of:
For now, needing another round-trip should be acceptable, and in the migration I'll make sure failure to fetch the active license is handled gracefully and won't affect customer usage.
For a more in-depth view, see https://github.com/sourcegraph/sourcegraph/pull/62934 for the implementation of the actual integration.
DB query
Product
EXPLAIN ANALYZEfor a query forarchived=false subscriptionid='$S2-subscription-id'shows this should be pretty quick:Test plan
DB integration tests, and similar manual testing to https://github.com/sourcegraph/sourcegraph/pull/62771 for the RPC layer, but this time requesting the
subscriptionscope when creating an access token:sg sams create-client-token -s 'enterprise_portal::subscription::read'