This document outlines how we model Enterprise Subscriptions for management in Sourcegraph Enterprise Portal (EP), which is the successor to an older management system that used to live directly in the Sourcegraph.com database.

See Sourcegraph Enterprise Portal (EP) for a quick introduction on the Enterprise Portal service.

Core concepts

Untitled

<aside> 🚨 TL;DR: There should never be licenses for multiple Sourcegraph instances within a single Enterprise subscription. If this is the case, please reach out to #discuss-core-services for assistance in re-linking existing licenses to new Enterprise subscriptions.

</aside>

Enterprise Subscriptions are the source-of-truth for customer and instance metadata

A customer’s Display name, Salesforce Subscription ID, custom Cody Gateway access, known instance domain, etc. are all tracked and updated at the Enterprise Subscription level. This means that the Enterprise Subscription can be updated at any time, and represents the absolute latest metadata about a subscription/customer/instance, and can serve as a source of truth.

For analytics, any of a subscription’s license key (even one issued a long time ago) can be mapped to its parent subscription for the most up-to-date information about the customer.

Examples:

  1. âś… Salesforce metadata (Salesforce account ID, Salesforce subscription ID), human-friendly display name, etc: This is used for internal reference and can change or be updated at any time.
    1. Salesforce Account ID ****is required on all customer Enterprise Subscriptions.
  2. âś… Instance domain: This is set manually by Sourcegraph teammates to ensure malicious clients cannot self-report an incorrect domain. It is used for internal reference and online services, and persists across licenses as a long-lived data point.
  3. âś… Instance type: one of PRIMARY (production), SECONDARY (dev/testing), INTERNAL
  4. âś… Cody Analytics access: This persists across licenses even when they expire, and is a long-lived data point (i.e. a customer admin today will be a customer admin tomorrow, most likely). An online service that does not use license keys will use this metadata.
  5. âś… Cody Gateway rate limit overrides: This persists across licenses even when they expire, and is a long-lived data point. An online service that does not use license keys will use this metadata.
  6. âś… Subscription archival: permanently and immediately revokes all licenses and Sourcegraph-provided online capabilities.
  7. ❌ Offline product capabilities: Changes are not propagated until a new license key is given to the customer.

Future possibilities:

  1. Since Enterprise Portal is a dedicated standalone service, we can be fairly liberal with custom integrations if the need arises: for example, integrations with Salesforce or data warehouse systems to publish or sync the metadata Enterprise Portal tracks. See RFC 885 Stage 2 ideas.

License keys are immutable, offline snapshots